TagLib  2.2.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 "tbytevector.h"
30 #include "tstring.h"
31 #include "tlist.h"
32 #include "tmap.h"
33 #include "taglib.h"
34 #include "taglib_export.h"
35 #include "tag.h"
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 
50 
52 
69  {
70  public:
72  virtual ~Latin1StringHandler();
73  Latin1StringHandler(const Latin1StringHandler &) = delete;
74  Latin1StringHandler &operator=(const Latin1StringHandler &) = delete;
75 
80  virtual String parse(const ByteVector &data) const;
81 
82  private:
83  class Latin1StringHandlerPrivate;
85  std::unique_ptr<Latin1StringHandlerPrivate> d;
86  };
87 
89 
134  {
135  public:
141  Tag();
142 
155  Tag(File *file, offset_t tagOffset,
156  const FrameFactory *factory = FrameFactory::instance());
157 
161  ~Tag() override;
162 
163  Tag(const Tag &) = delete;
164  Tag &operator=(const Tag &) = delete;
165 
166  // Reimplementations.
167 
168  String title() const override;
169  String artist() const override;
170  String album() const override;
171  String comment() const override;
172  String genre() const override;
173  unsigned int year() const override;
174  unsigned int track() const override;
175 
176  void setTitle(const String &s) override;
177  void setArtist(const String &s) override;
178  void setAlbum(const String &s) override;
179  void setComment(const String &s) override;
180  void setGenre(const String &s) override;
181  void setYear(unsigned int i) override;
182  void setTrack(unsigned int i) override;
183 
184  bool isEmpty() const override;
185 
189  Header *header() const;
190 
195  ExtendedHeader *extendedHeader() const;
196 
231  const FrameListMap &frameListMap() const;
232 
243  const FrameList &frameList() const;
244 
256  const FrameList &frameList(const ByteVector &frameID) const;
257 
265  void addFrame(Frame *frame);
266 
274  void removeFrame(Frame *frame, bool del = true);
275 
282  void removeFrames(const ByteVector &id);
283 
313  PropertyMap properties() const override;
314 
326  void removeUnsupportedProperties(const StringList &properties) override;
327 
332  PropertyMap setProperties(const PropertyMap &) override;
333 
334  StringList complexPropertyKeys() const override;
335  List<VariantMap> complexProperties(const String &key) const override;
336  bool setComplexProperties(const String &key, const List<VariantMap> &value) override;
337 
341  ByteVector render() const;
342 
349  ByteVector render(Version version) const;
350 
357  static Latin1StringHandler const *latin1StringHandler();
358 
370  static void setLatin1StringHandler(const Latin1StringHandler *handler);
371 
372  protected:
379  void read();
380 
385  void parse(const ByteVector &origData);
386 
391  void setTextFrame(const ByteVector &id, const String &value);
392 
396  void downgradeFrames(FrameList *frames, FrameList *newFrames) const;
397 
398  private:
399  class TagPrivate;
401  std::unique_ptr<TagPrivate> d;
402  };
403 
404  } // namespace ID3v2
405 } // namespace TagLib
406 
407 #endif
A generic, implicitly shared list.
Definition: tlist.h:53
A map for format-independent <key,values> tag representations.
Definition: tpropertymap.h:122
A simple, generic interface to common audio metadata fields.
Definition: tag.h:48
An implementation of ID3v2 headers.
Definition: id3v2header.h:48
A file class with some useful methods for tag manipulation.
Definition: tfile.h:50
A wide string class suitable for unicode.
Definition: tstring.h:82
A byte vector.
Definition: tbytevector.h:45
A factory for creating ID3v2 frames during parsing.
Definition: id3v2framefactory.h:67
#define TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
Definition: taglib_export.h:55
A generic, implicitly shared map.
Definition: tmap.h:44
A list of strings.
Definition: tstringlist.h:43
ID3v2 frame implementation.
Definition: id3v2frame.h:56
#define TAGLIB_EXPORT
Definition: taglib_export.h:40
static FrameFactory * instance()
ID3v2 extended header implementation.
Definition: id3v2extendedheader.h:48
Version
Definition: id3v2.h:27
String TAGLIB_EXPORT genre(int index)
The main class in the ID3v2 implementation.
Definition: id3v2tag.h:133
off_t offset_t
Definition: taglib.h:64
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:68