/usr/include/musicbrainz3/query.h is in libmusicbrainz3-dev 3.0.2-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | /*
* MusicBrainz -- The Internet music metadatabase
*
* Copyright (C) 2006 Lukas Lalinsky
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* $Id: query.h 8789 2007-01-13 23:01:56Z luks $
*/
#ifndef __MUSICBRAINZ3_QUERY_H__
#define __MUSICBRAINZ3_QUERY_H__
#include <map>
#include <string>
#include <musicbrainz3/webservice.h>
#include <musicbrainz3/metadata.h>
#include <musicbrainz3/model.h>
namespace MusicBrainz
{
/**
* A simple interface to the MusicBrainz web service.
*
* This is a facade which provides a simple interface to the MusicBrainz
* web service. It hides all the details like fetching data from a server,
* parsing the XML and creating an object tree. Using this class, you can
* request data by ID or search the \e collection of all resources
* (artists, releases, or tracks) to retrieve those matching given
* criteria.
*
* @todo Add examples here.
*/
class MB_API Query
{
public:
/**
* Constructor.
*
* The \a ws parameter has to be a subclass of IWebService.
* If it isn't given, the default WebService class is used to
* create an IWebService instance.
*
* If the constructor is called without arguments, an instance
* of WebService is used, preconfigured to use the MusicBrainz
* server. This should be enough for most users.
*
* If you want to use queries which require authentication you
* have to pass a WebService instance where user name and
* password have been set.
*
* The \a clientId parameter is required for data submission.
* The format is \c "application-version", where \c application
* is your application's name and \c version is a version
* number which may not contain a '-' character.
*
* @param ws a pointer to subclass instance of IWebService, or \c NULL
* @param clientId a string containing the application's ID
*/
Query(IWebService *ws = NULL, const std::string &clientId = std::string());
/**
* Destructor.
*/
virtual ~Query();
/**
* Returns an artist.
*
* If no artist with that ID can be found, \a include contains
* invalid tags or there's a server problem, an exception is
* raised.
*
* @param id a string containing the artist's ID
* @param include an ArtistIncludes instance
*
* @return a pointer to Artist instance, or \c NULL
*
* @note If the returned pointer is not \c NULL, the caller takes
* responsibility for deleting it when it is no longer needed.
*
* @throw ConnectionError couldn't connect to server
* @throw RequestError invalid ID or include tags
* @throw ResourceNotFoundError artist doesn't exist
* @throw ResponseError server returned invalid data
*/
Artist *getArtistById(const std::string &id,
const ArtistIncludes *include = NULL);
/**
* Returns a release.
*
* If no release with that ID can be found, \a include contains
* invalid tags or there's a server problem, and exception is
* raised.
*
* @param id a string containing the release's ID
* @param include an ReleaseIncludes instance
*
* @return a pointer to Release instance, or \c NULL
*
* @note If the returned pointer is not \c NULL, the caller takes
* responsibility for deleting it when it is no longer needed.
*
* @throw ConnectionError couldn't connect to server
* @throw RequestError invalid ID or include tags
* @throw ResourceNotFoundError artist doesn't exist
* @throw ResponseError server returned invalid data
*/
Release *getReleaseById(const std::string &id,
const ReleaseIncludes *include = NULL);
/**
* Returns a track.
*
* If no track with that ID can be found, \a include contains
* invalid tags or there's a server problem, and exception is
* raised.
*
* @param id a string containing the track's ID
* @param include an TrackIncludes instance
*
* @return a pointer to Track instance, or \c NULL
*
* @note If the returned pointer is not \c NULL, the caller takes
* responsibility for deleting it when it is no longer needed.
*
* @throw ConnectionError couldn't connect to server
* @throw RequestError invalid ID or include tags
* @throw ResourceNotFoundError artist doesn't exist
* @throw ResponseError server returned invalid data
*/
Track *getTrackById(const std::string &id,
const TrackIncludes *include = NULL);
/**
* Returns information about a MusicBrainz user.
*
* You can only request user data if you know the user name and
* password for that account. If username and/or password are
* incorrect, an AuthenticationError is raised.
*
* See the example in Query on how to supply user name and
* password.
*
* @param name a string containing the user's name
*
* @return a pointer to User instance, or \c NULL
*
* @note If the returned pointer is not \c NULL, the caller takes
* responsibility for deleting it when it is no longer needed.
*
* @throw ConnectionError couldn't connect to server
* @throw RequestError invalid ID or include tags
* @throw ResourceNotFoundError artist doesn't exist
* @throw ResponseError server returned invalid data
*/
User *getUserByName(const std::string &name);
/**
* Returns artists matching given criteria.
*
* @param filter: a pointer to ArtistFilter object
*
* @return a vector of pointers to ArtistResult objects
*
* @note The caller is responsible for deleting all
* returned ArtistResult objects.
*
* @throw ConnectionError couldn't connect to server
* @throw RequestError invalid ID or include tags
* @throw ResponseError server returned invalid data
*/
ArtistResultList getArtists(const ArtistFilter *filter);
/**
* Returns releases matching given criteria.
*
* @param filter a pointer to ReleaseFilter object
*
* @return a vector of pointers to ReleaseResult objects
*
* @note The caller is responsible for deleting all
* returned ReleaseResult objects.
*
* @throw ConnectionError couldn't connect to server
* @throw RequestError invalid ID or include tags
* @throw ResponseError server returned invalid data
*/
ReleaseResultList getReleases(const ReleaseFilter *filter);
/**
* Returns tracks matching given criteria.
*
* @param filter a pointer to TrackFilter object
*
* @return a vector of pointers to TrackResult objects
*
* @note The caller is responsible for deleting all
* returned TrackResult objects.
*
* @throw ConnectionError couldn't connect to server
* @throw RequestError invalid ID or include tags
* @throw ResponseError server returned invalid data
*/
TrackResultList getTracks(const TrackFilter *filter);
/**
* Submit track to PUID mappings.
*
* The \a tracks2puids parameter has to be a map, with the
* keys being MusicBrainz track IDs (either as absolute URIs or
* in their 36 character ASCII representation) and the values
* being PUIDs (ASCII, 36 characters).
* Note that this method only works if a valid user name and
* password have been set. See the example in Query on how
* to supply authentication data.
*
* @param tracks2puids a map mapping track IDs to PUIDs
*
* @throw ConnectionError couldn't connect to server
* @throw RequestError invalid track- or PUIDs
* @throw AuthenticationError invalid user name and/or password
*/
void submitPuids(const std::map<std::string, std::string> &tracks2puids);
protected:
Metadata *getFromWebService(const std::string &entity,
const std::string &id,
const IIncludes *include = NULL,
const IFilter *filter = NULL);
private:
class QueryPrivate;
QueryPrivate *d;
};
}
#endif
|