1
/* --------------------------------------------------------------------------
3
libmusicbrainz4 - Client library to access MusicBrainz
5
Copyright (C) 2011 Andrew Hawkins
7
This file is part of libmusicbrainz4.
9
This library is free software; you can redistribute it and/or
10
modify it under the terms of v2 of the GNU Lesser General Public
11
License as published by the Free Software Foundation.
13
Flactag is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
Lesser General Public License for more details.
18
You should have received a copy of the GNU General Public License
19
along with this library. If not, see <http://www.gnu.org/licenses/>.
21
$Id: c-int-query-source.inc 13259 2011-08-10 12:02:50Z adhawkins $
23
----------------------------------------------------------------------------*/
25
Mb4Query mb4_query_new(const char *UserAgent, const char *Server, int Port)
27
return new MusicBrainz4::CQuery(UserAgent, Server ? Server : "musicbrainz.org", Port!=0 ? Port : 80);
30
MB4_C_STR_SETTER(Query,query,UserName,username)
31
MB4_C_STR_SETTER(Query,query,Password,password)
32
MB4_C_STR_SETTER(Query,query,ProxyHost,proxyhost)
33
MB4_C_INT_SETTER(Query,query,ProxyPort,proxyport)
34
MB4_C_STR_SETTER(Query,query,ProxyUserName,proxyusername)
35
MB4_C_STR_SETTER(Query,query,ProxyPassword,proxypassword)
37
Mb4ReleaseList mb4_query_lookup_discid(Mb4Query Query, const char *DiscID)
43
MusicBrainz4::CQuery *TheQuery=reinterpret_cast<MusicBrainz4::CQuery *>(Query);
45
return new MusicBrainz4::CReleaseList(TheQuery->LookupDiscID(DiscID));
56
Mb4Release mb4_query_lookup_release(Mb4Query Query, const char *Release)
62
MusicBrainz4::CQuery *TheQuery=reinterpret_cast<MusicBrainz4::CQuery *>(Query);
64
return new MusicBrainz4::CRelease(TheQuery->LookupRelease(Release));
75
Mb4Metadata mb4_query_query(Mb4Query Query, const char *Entity, const char *ID, const char *Resource, int NumParams, char **ParamName, char **ParamValue)
81
MusicBrainz4::CQuery::tParamMap Params;
83
for (int count=0;count<NumParams;count++)
85
if (ParamName[count] && ParamValue[count])
86
Params[ParamName[count]]=ParamValue[count];
89
MusicBrainz4::CQuery *TheQuery=reinterpret_cast<MusicBrainz4::CQuery *>(Query);
91
return new MusicBrainz4::CMetadata(TheQuery->Query(Entity?Entity:"",
105
unsigned char mb4_query_add_collection_entries(Mb4Query Query, const char *Collection, int NumEntries, const char **Entries)
111
std::vector<std::string> VecEntries;
113
MusicBrainz4::CQuery *TheQuery=reinterpret_cast<MusicBrainz4::CQuery *>(Query);
116
for (int count=0;count<NumEntries;count++)
118
if (Entries && Entries[count])
120
VecEntries.push_back(Entries[count]);
124
return TheQuery->AddCollectionEntries(Collection,VecEntries)?1:0;
136
unsigned char mb4_query_delete_collection_entries(Mb4Query Query, const char *Collection, int NumEntries, const char **Entries)
142
std::vector<std::string> VecEntries;
144
MusicBrainz4::CQuery *TheQuery=reinterpret_cast<MusicBrainz4::CQuery *>(Query);
147
for (int count=0;count<NumEntries;count++)
149
if (Entries && Entries[count])
151
VecEntries.push_back(Entries[count]);
155
return TheQuery->AddCollectionEntries(Collection,VecEntries)?1:0;
167
tQueryResult mb4_query_get_lastresult(Mb4Query o)
173
return (tQueryResult)((MusicBrainz4::CQuery *)o)->LastResult();
181
return eQuery_FetchError;