libmusicbrainz3  3.0.2
disc.h
Go to the documentation of this file.
1 /*
2  * MusicBrainz -- The Internet music metadatabase
3  *
4  * Copyright (C) 2006 Lukas Lalinsky
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  *
20  * $Id: disc.h 8466 2006-09-05 08:59:44Z luks $
21  */
22 
23 #ifndef __MUSICBRAINZ3_DISC_H__
24 #define __MUSICBRAINZ3_DISC_H__
25 
26 #include <string>
27 #include <vector>
28 #include <utility>
30 
31 namespace MusicBrainz
32 {
33 
54  class MB_API Disc
55  {
56  public:
57 
58  typedef std::pair<int, int> Track;
59  typedef std::vector<Disc::Track> TrackList;
60 
66  Disc(const std::string &id = std::string());
67 
71  virtual ~Disc();
72 
78  std::string getId() const;
79 
85  void setId(const std::string &value);
86 
92  int getSectors() const;
93 
99  void setSectors(const int sectors);
100 
106  int getFirstTrackNum() const;
107 
113  void setFirstTrackNum(const int trackNum);
114 
120  int getLastTrackNum() const;
121 
127  void setLastTrackNum(const int trackNum);
128 
140  Disc::TrackList &getTracks();
141 
153  void addTrack(Disc::Track track);
154 
155  private:
156 
157  class DiscPrivate;
158  DiscPrivate *d;
159  };
160 
168  class MB_API DiscError : public Exception
169  {
170  public:
171  DiscError(const std::string &msg = std::string()) : Exception(msg) {}
172  };
173 
196  MB_API Disc *readDisc(const std::string &deviceName = std::string());
197 
218  MB_API std::string getSubmissionUrl(Disc *disc,
219  const std::string &host = "mm.musicbrainz.org",
220  int port = 80);
221 
222 }
223 
224 #endif
225 
std::string getSubmissionUrl(Disc *disc, const std::string &host="mm.musicbrainz.org", int port=80)
Returns a URL for adding a disc to the MusicBrainz database.
Represents an Audio CD.
Definition: disc.h:54
Definition: musicbrainz.h:34
Definition: artist.h:32
std::pair< int, int > Track
Definition: disc.h:58
DiscError(const std::string &msg=std::string())
Definition: disc.h:171
The Audio CD could not be read.
Definition: disc.h:168
std::vector< Disc::Track > TrackList
Definition: disc.h:59
#define MB_API
Definition: defines.h:40
Disc * readDisc(const std::string &deviceName=std::string())
Reads an Audio CD in the disc drive.