TagLib API Documentation
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
39namespace TagLib {
40
41 class File;
42
43 namespace ID3v2 {
44
45 class Header;
46 class ExtendedHeader;
47
50
52
69 {
70 public:
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:
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
196
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
333
335 List<VariantMap> complexProperties(const String &key) const override;
336 bool setComplexProperties(const String &key, const List<VariantMap> &value) override;
337
342
349 ByteVector render(Version version) const;
350
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 byte vector.
Definition: tbytevector.h:46
A file class with some useful methods for tag manipulation.
Definition: tfile.h:51
ID3v2 extended header implementation.
Definition: id3v2extendedheader.h:49
A factory for creating ID3v2 frames during parsing.
Definition: id3v2framefactory.h:68
static FrameFactory * instance()
ID3v2 frame implementation.
Definition: id3v2frame.h:57
An implementation of ID3v2 headers.
Definition: id3v2header.h:49
An abstraction for the ISO-8859-1 string to data encoding in ID3v2 tags.
Definition: id3v2tag.h:69
Latin1StringHandler(const Latin1StringHandler &)=delete
Latin1StringHandler & operator=(const Latin1StringHandler &)=delete
virtual String parse(const ByteVector &data) const
The main class in the ID3v2 implementation.
Definition: id3v2tag.h:134
String genre() const override
PropertyMap setProperties(const PropertyMap &) override
void removeFrame(Frame *frame, bool del=true)
void setYear(unsigned int i) override
static Latin1StringHandler const * latin1StringHandler()
ExtendedHeader * extendedHeader() const
String artist() const override
void setTrack(unsigned int i) override
unsigned int track() const override
StringList complexPropertyKeys() const override
PropertyMap properties() const override
static void setLatin1StringHandler(const Latin1StringHandler *handler)
void removeFrames(const ByteVector &id)
String album() const override
ByteVector render() const
Header * header() const
const FrameListMap & frameListMap() const
List< VariantMap > complexProperties(const String &key) const override
Tag(File *file, offset_t tagOffset, const FrameFactory *factory=FrameFactory::instance())
void setComment(const String &s) override
void setArtist(const String &s) override
const FrameList & frameList() const
bool isEmpty() const override
Tag(const Tag &)=delete
ByteVector render(Version version) const
void setTextFrame(const ByteVector &id, const String &value)
const FrameList & frameList(const ByteVector &frameID) const
unsigned int year() const override
String comment() const override
void setAlbum(const String &s) override
Tag & operator=(const Tag &)=delete
void setGenre(const String &s) override
bool setComplexProperties(const String &key, const List< VariantMap > &value) override
void setTitle(const String &s) override
void addFrame(Frame *frame)
void parse(const ByteVector &origData)
void downgradeFrames(FrameList *frames, FrameList *newFrames) const
void removeUnsupportedProperties(const StringList &properties) override
String title() const override
A generic, implicitly shared list.
Definition: tlist.h:54
A generic, implicitly shared map.
Definition: tmap.h:45
A map for format-independent <key,values> tag representations.
Definition: tpropertymap.h:123
A list of strings.
Definition: tstringlist.h:44
A wide string class suitable for unicode.
Definition: tstring.h:83
A simple, generic interface to common audio metadata fields.
Definition: tag.h:49
Version
Definition: id3v2.h:27
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41
off_t offset_t
Definition: taglib.h:64
#define TAGLIB_EXPORT
Definition: taglib_export.h:40
#define TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
Definition: taglib_export.h:55