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 "id3v2framefactory.h"
37
38namespace TagLib {
39
40 class File;
41
43
51 namespace ID3v2 {
52
53 class Header;
54 class ExtendedHeader;
55 class Footer;
56
59
61
78 {
79 public:
82
87 virtual String parse(const ByteVector &data) const;
88 };
89
91
136 {
137 public:
144
157 Tag(File *file, long tagOffset,
158 const FrameFactory *factory = FrameFactory::instance());
159
163 virtual ~Tag();
164
165 // Reimplementations.
166
167 virtual String title() const;
168 virtual String artist() const;
169 virtual String album() const;
170 virtual String comment() const;
171 virtual String genre() const;
172 virtual unsigned int year() const;
173 virtual unsigned int track() const;
174
175 virtual void setTitle(const String &s);
176 virtual void setArtist(const String &s);
177 virtual void setAlbum(const String &s);
178 virtual void setComment(const String &s);
179 virtual void setGenre(const String &s);
180 virtual void setYear(unsigned int i);
181 virtual void setTrack(unsigned int i);
182
183 virtual bool isEmpty() const;
184
188 Header *header() const;
189
195
204 Footer *footer() const;
205
241
252 const FrameList &frameList() const;
253
265 const FrameList &frameList(const ByteVector &frameID) const;
266
274 void addFrame(Frame *frame);
275
283 void removeFrame(Frame *frame, bool del = true);
284
291 void removeFrames(const ByteVector &id);
292
323
336
342
347
354 // BIC: combine with the above method
355 ByteVector render(int version) const;
356
364
376 static void setLatin1StringHandler(const Latin1StringHandler *handler);
377
378 protected:
385 void read();
386
391 void parse(const ByteVector &data);
392
397 void setTextFrame(const ByteVector &id, const String &value);
398
399 void downgradeFrames(FrameList *existingFrames, FrameList *newFrames) const;
400
401 private:
402 Tag(const Tag &);
403 Tag &operator=(const Tag &);
404
405 class TagPrivate;
406 TagPrivate *d;
407 };
408
409 }
410}
411
412#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
ID3v2 footer implementation.
Definition: id3v2footer.h:51
A factory for creating ID3v2 frames during parsing.
Definition: id3v2framefactory.h:66
static FrameFactory * instance()
ID3v2 frame implementation.
Definition: id3v2frame.h:55
An implementation of ID3v2 headers.
Definition: id3v2header.h:48
An abstraction for the ISO-8859-1 string to data encoding in ID3v2 tags.
Definition: id3v2tag.h:78
virtual String parse(const ByteVector &data) const
The main class in the ID3v2 implementation.
Definition: id3v2tag.h:136
virtual String artist() const
virtual void setGenre(const String &s)
virtual void setComment(const String &s)
Footer * footer() const
void removeFrame(Frame *frame, bool del=true)
virtual String genre() const
void downgradeFrames(FrameList *existingFrames, FrameList *newFrames) const
static Latin1StringHandler const * latin1StringHandler()
ExtendedHeader * extendedHeader() const
virtual void setAlbum(const String &s)
virtual void setTitle(const String &s)
virtual unsigned int year() const
PropertyMap properties() const
virtual void setTrack(unsigned int i)
static void setLatin1StringHandler(const Latin1StringHandler *handler)
void removeUnsupportedProperties(const StringList &properties)
void removeFrames(const ByteVector &id)
void parse(const ByteVector &data)
ByteVector render() const
virtual String album() const
Header * header() const
const FrameListMap & frameListMap() const
const FrameList & frameList() const
Tag(File *file, long tagOffset, const FrameFactory *factory=FrameFactory::instance())
void setTextFrame(const ByteVector &id, const String &value)
const FrameList & frameList(const ByteVector &frameID) const
virtual String title() const
PropertyMap setProperties(const PropertyMap &)
void addFrame(Frame *frame)
virtual bool isEmpty() const
virtual unsigned int track() const
virtual void setYear(unsigned int i)
virtual String comment() const
ByteVector render(int version) const
virtual void setArtist(const String &s)
A generic, implicitly shared list.
Definition: tlist.h:54
A generic, implicitly shared map.
Definition: tmap.h:44
A map for format-independent <key,valuelist> tag representations.
Definition: tpropertymap.h:109
A list of strings.
Definition: tstringlist.h:46
A wide string class suitable for unicode.
Definition: tstring.h:85
Definition: tag.h:47
List< Frame * > FrameList
Definition: id3v2tag.h:57
Map< ByteVector, FrameList > FrameListMap
Definition: id3v2tag.h:58
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41
#define TAGLIB_EXPORT
Definition: taglib_export.h:40