TagLib::ID3v2::Tag Class Reference
The main class in the ID3v2 implementation. More...
#include <id3v2tag.h>
Inheritance diagram for TagLib::ID3v2::Tag:

Public Member Functions | |
Tag () | |
Tag (File *file, long tagOffset, const FrameFactory *factory=FrameFactory::instance()) | |
virtual | ~Tag () |
virtual String | title () const |
virtual String | artist () const |
virtual String | album () const |
virtual String | comment () const |
virtual String | genre () const |
virtual uint | year () const |
virtual uint | track () const |
virtual void | setTitle (const String &s) |
virtual void | setArtist (const String &s) |
virtual void | setAlbum (const String &s) |
virtual void | setComment (const String &s) |
virtual void | setGenre (const String &s) |
virtual void | setYear (uint i) |
virtual void | setTrack (uint i) |
virtual bool | isEmpty () const |
Header * | header () const |
ExtendedHeader * | extendedHeader () const |
Footer * | footer () const |
const FrameListMap & | frameListMap () const |
const FrameList & | frameList () const |
void | addFrame (Frame *frame) |
void | removeFrame (Frame *frame, bool del=true) |
void | removeFrames (const ByteVector &id) |
ByteVector | render () const |
Protected Member Functions | |
void | read () |
void | parse (const ByteVector &data) |
void | setTextFrame (const ByteVector &id, const String &value) |
Detailed Description
The main class in the ID3v2 implementation.This is the main class in the ID3v2 implementation. It serves two functions. This first, as is obvious from the public API, is to provide a container for the other ID3v2 related classes. In addition, through the read() and parse() protected methods, it provides the most basic level of parsing. In these methods the ID3v2 tag is extracted from the file and split into data components.
ID3v2 tags have several parts, TagLib attempts to provide an interface for them all. header(), footer() and extendedHeader() corespond to those data structures in the ID3v2 standard and the APIs for the classes that they return attempt to reflect this.
Also ID3v2 tags are built up from a list of frames, which are in turn have a header and a list of fields. TagLib provides two ways of accessing the list of frames that are in a given ID3v2 tag. The first is simply via the frameList() method. This is just a list of pointers to the frames. The second is a map from the frame type -- i.e. "COMM" for comments -- and a list of frames of that type. (In some cases ID3v2 allows for multiple frames of the same type, hence this being a map to a list rather than just a map to an individual frame.)
More information on the structure of frames can be found in the ID3v2::Frame class.
read() and parse() pass binary data to the other ID3v2 class structures, they do not handle parsing of flags or fields, for instace. Those are handled by similar functions within those classes.
- Note:
- All pointers to data structures within the tag will become invalid when the tag is destroyed.
- Warning:
- Dealing with the nasty details of ID3v2 is not for the faint of heart and should not be done without much meditation on the spec. It's rather long, but if you're planning on messing with this class and others that deal with the details of ID3v2 (rather than the nice, safe, abstract TagLib::Tag and friends), it's worth your time to familiarize yourself with said spec (which is distrubuted with the TagLib sources). TagLib tries to do most of the work, but with a little luck, you can still convince it to generate invalid ID3v2 tags. The APIs for ID3v2 assume a working knowledge of ID3v2 structure. You're been warned.
Definition at line 100 of file id3v2tag.h.
Constructor & Destructor Documentation
|
Constructs an empty ID3v2 tag.
Reimplemented from TagLib::Tag. |
|
Constructs an ID3v2 tag read from file starting at tagOffset. factory specifies which FrameFactory will be used for the construction of new frames.
|
|
Destroys this Tag instance. Reimplemented from TagLib::Tag. |
Member Function Documentation
|
Returns the track name; if no track name is present in the tag String::null will be returned. Implements TagLib::Tag. |
|
Returns the artist name; if no artist name is present in the tag String::null will be returned. Implements TagLib::Tag. |
|
Returns the album name; if no album name is present in the tag String::null will be returned. Implements TagLib::Tag. |
|
Returns the track comment; if no comment is present in the tag String::null will be returned. Implements TagLib::Tag. |
|
Returns the genre name; if no genre is present in the tag String::null will be returned. Implements TagLib::Tag. |
|
Returns the year; if there is no year set, this will return 0. Implements TagLib::Tag. |
|
Returns the track number; if there is no track number set, this will return 0. Implements TagLib::Tag. |
|
Sets the title to s. If s is String::null then this value will be cleared. Implements TagLib::Tag. |
|
Sets the artist to s. If s is String::null then this value will be cleared. Implements TagLib::Tag. |
|
Sets the album to s. If s is String::null then this value will be cleared. Implements TagLib::Tag. |
|
Sets the album to s. If s is String::null then this value will be cleared. Implements TagLib::Tag. |
|
Sets the genre to s. If s is String::null then this value will be cleared. For tag formats that use a fixed set of genres, the appropriate value will be selected based on a string comparison. A list of available genres for those formats should be available in that type's implementation. Implements TagLib::Tag. |
|
Sets the year to i. If s is 0 then this value will be cleared. Implements TagLib::Tag. |
|
Sets the track to i. If s is 0 then this value will be cleared. Implements TagLib::Tag. |
|
Returns true if the tag does not contain any data. This should be reimplemented in subclasses that provide more than the basic tagging abilities in this class. Reimplemented from TagLib::Tag. |
|
Returns a pointer to the tag's header. |
|
Returns a pointer to the tag's extended header or null if there is no extended header. |
|
Returns a pointer to the tag's footer or null if there is no footer.
|
|
Returns a pointer to the frame list map. This is an FrameListMap of all of the frames in the tag.
|
|
Returns a pointer to the frame list. This is an FrameList of all of the frames in the tag in the order that they were parsed.
|
|
Add a frame to the tag. At this point the tag takes ownership of the frame and will handle freeing its memory. |
|
Remove a frame from the tag. If del is true the frame's memory will be freed; if it is false, it must be deleted by the user. |
|
Remove all frames of type id from the tag and free their memory. |
|
Render the tag back to binary data, suitable to be written to disk. |
|
Reads data from the file specified in the constructor. It does basic parsing of the data in the largest chunks. It partitions the tag into the Header, the body of the tag (which contains the ExtendedHeader and frames) and Footer. |
|
This is called by read to parse the body of the tag. It determines if an extended header exists and adds frames to the FrameListMap. |
|
Sets the value of the text frame with the Frame ID id to value. If the frame does not exist, it is created. |
The documentation for this class was generated from the following file: