TagLib  1.13.1
id3v2tag.h
Go to the documentation of this file.
1 /***************************************************************************
2  copyright : (C) 2002 - 2008 by Scott Wheeler
3  email : wheeler@kde.org
4  ***************************************************************************/
5 
6 /***************************************************************************
7  * This library is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU Lesser General Public License version *
9  * 2.1 as published by the Free Software Foundation. *
10  * *
11  * This library is distributed in the hope that it will be useful, but *
12  * 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 *
19  * 02110-1301 USA *
20  * *
21  * Alternatively, this file is available under the Mozilla Public *
22  * License Version 1.1. You may obtain a copy of the License at *
23  * http://www.mozilla.org/MPL/ *
24  ***************************************************************************/
25 
26 #ifndef TAGLIB_ID3V2TAG_H
27 #define TAGLIB_ID3V2TAG_H
28 
29 #include "tag.h"
30 #include "tbytevector.h"
31 #include "tstring.h"
32 #include "tlist.h"
33 #include "tmap.h"
34 #include "taglib_export.h"
35 
36 #include "id3v2.h"
37 #include "id3v2framefactory.h"
38 
39 namespace TagLib {
40 
41  class File;
42 
43  namespace ID3v2 {
44 
45  class Header;
46  class ExtendedHeader;
47  class Footer;
48 
49  typedef List<Frame *> FrameList;
51 
53 
70  {
71  public:
73  virtual ~Latin1StringHandler();
74 
79  virtual String parse(const ByteVector &data) const;
80  };
81 
83 
128  {
129  public:
135  Tag();
136 
149  Tag(File *file, long tagOffset,
150  const FrameFactory *factory = FrameFactory::instance());
151 
155  virtual ~Tag();
156 
157  // Reimplementations.
158 
159  virtual String title() const;
160  virtual String artist() const;
161  virtual String album() const;
162  virtual String comment() const;
163  virtual String genre() const;
164  virtual unsigned int year() const;
165  virtual unsigned int track() const;
166 
167  virtual void setTitle(const String &s);
168  virtual void setArtist(const String &s);
169  virtual void setAlbum(const String &s);
170  virtual void setComment(const String &s);
171  virtual void setGenre(const String &s);
172  virtual void setYear(unsigned int i);
173  virtual void setTrack(unsigned int i);
174 
175  virtual bool isEmpty() const;
176 
180  Header *header() const;
181 
186  ExtendedHeader *extendedHeader() const;
187 
196  TAGLIB_DEPRECATED Footer *footer() const;
197 
232  const FrameListMap &frameListMap() const;
233 
244  const FrameList &frameList() const;
245 
257  const FrameList &frameList(const ByteVector &frameID) const;
258 
266  void addFrame(Frame *frame);
267 
275  void removeFrame(Frame *frame, bool del = true);
276 
283  void removeFrames(const ByteVector &id);
284 
314  PropertyMap properties() const;
315 
327  void removeUnsupportedProperties(const StringList &properties);
328 
333  PropertyMap setProperties(const PropertyMap &);
334 
338  ByteVector render() const;
339 
343  TAGLIB_DEPRECATED ByteVector render(int version) const;
344 
351  ByteVector render(Version version) const;
352 
359  static Latin1StringHandler const *latin1StringHandler();
360 
372  static void setLatin1StringHandler(const Latin1StringHandler *handler);
373 
374  protected:
381  void read();
382 
387  void parse(const ByteVector &data);
388 
393  void setTextFrame(const ByteVector &id, const String &value);
394 
398  void downgradeFrames(FrameList *existingFrames, FrameList *newFrames) const;
399 
400  private:
401  Tag(const Tag &);
402  Tag &operator=(const Tag &);
403 
404  class TagPrivate;
405  TagPrivate *d;
406  };
407 
408  } // namespace ID3v2
409 } // namespace TagLib
410 
411 #endif
A generic, implicitly shared list.
Definition: tlist.h:53
A map for format-independent <key,valuelist> tag representations.
Definition: tpropertymap.h:118
Definition: tag.h:46
An implementation of ID3v2 headers.
Definition: id3v2header.h:48
Map< ByteVector, FrameList > FrameListMap
Definition: id3v2tag.h:50
A file class with some useful methods for tag manipulation.
Definition: tfile.h:50
A wide string class suitable for unicode.
Definition: tstring.h:84
A byte vector.
Definition: tbytevector.h:45
A factory for creating ID3v2 frames during parsing.
Definition: id3v2framefactory.h:65
#define TAGLIB_DEPRECATED
Definition: taglib.h:54
A generic, implicitly shared map.
Definition: tmap.h:43
A list of strings.
Definition: tstringlist.h:45
ID3v2 frame implementation.
Definition: id3v2frame.h:54
#define TAGLIB_EXPORT
Definition: taglib_export.h:40
static FrameFactory * instance()
ID3v2 extended header implementation.
Definition: id3v2extendedheader.h:48
Version
Definition: id3v2.h:17
List< Frame * > FrameList
Definition: id3v2tag.h:47
String TAGLIB_EXPORT genre(int index)
The main class in the ID3v2 implementation.
Definition: id3v2tag.h:127
ID3v2 footer implementation.
Definition: id3v2footer.h:50
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41
An abstraction for the ISO-8859-1 string to data encoding in ID3v2 tags.
Definition: id3v2tag.h:69