Miam-Player  0.8.0
A nice music player
TagLib::ID3v2::TableOfContentsFrame Class Reference

This is an implementation of ID3v2 table of contents frames. More...

#include <tableofcontentsframe.h>

Inheritance diagram for TagLib::ID3v2::TableOfContentsFrame:
TagLib::ID3v2::Frame TagLib::ID3v2::Header

Public Member Functions

 TableOfContentsFrame (const ID3v2::Header *tagHeader, const ByteVector &data)
 Creates a table of contents frame based on data. More...
 
 TableOfContentsFrame (const ByteVector &elementID, const ByteVectorList &children=ByteVectorList(), const FrameList &embeddedFrames=FrameList())
 Creates a table of contents frame with the element ID elementID, the child elements children and embedded frames, which become owned by this frame, in embeddedFrames. More...
 
 ~TableOfContentsFrame ()
 Destroys the frame. More...
 
ByteVector elementID () const
 Returns the elementID of the frame. More...
 
bool isTopLevel () const
 Returns true, if the frame is top-level (doesn't have any parent CTOC frame). More...
 
bool isOrdered () const
 Returns true, if the child elements list entries are ordered. More...
 
unsigned int entryCount () const
 Returns count of child elements of the frame. More...
 
ByteVectorList childElements () const
 Returns list of child elements of the frame. More...
 
void setElementID (const ByteVector &eID)
 Sets the elementID of the frame to eID. More...
 
void setIsTopLevel (const bool &t)
 Sets, if the frame is top-level (doesn't have any parent CTOC frame). More...
 
void setIsOrdered (const bool &o)
 Sets, if the child elements list entries are ordered. More...
 
void setChildElements (const ByteVectorList &l)
 Sets list of child elements of the frame to l. More...
 
void addChildElement (const ByteVector &cE)
 Adds cE to list of child elements of the frame. More...
 
void removeChildElement (const ByteVector &cE)
 Removes cE to list of child elements of the frame. More...
 
const FrameListMapembeddedFrameListMap () const
 Returns a reference to the frame list map. More...
 
const FrameListembeddedFrameList () const
 Returns a reference to the embedded frame list. More...
 
const FrameListembeddedFrameList (const ByteVector &frameID) const
 Returns the embedded frame list for frames with the id frameID or an empty list if there are no embedded frames of that type. More...
 
void addEmbeddedFrame (Frame *frame)
 Add an embedded frame to the CTOC frame. More...
 
void removeEmbeddedFrame (Frame *frame, bool del=true)
 Remove an embedded frame from the CTOC frame. More...
 
void removeEmbeddedFrames (const ByteVector &id)
 Remove all embedded frames of type id from the CTOC frame and free their memory. More...
 
virtual String toString () const
 This returns the textual representation of the data in the frame. More...
 
PropertyMap asProperties () const
 
- Public Member Functions inherited from TagLib::ID3v2::Frame
virtual ~Frame ()
 Destroys this Frame instance. More...
 
ByteVector frameID () const
 Returns the Frame ID (Structure, 4) (Frames, 4) More...
 
unsigned int size () const
 Returns the size of the frame. More...
 
void setData (const ByteVector &data)
 Sets the data that will be used as the frame. More...
 
virtual void setText (const String &text)
 Set the text of frame in the sanest way possible. More...
 
ByteVector render () const
 Render the frame back to its binary format in a ByteVector. More...
 
 Header (const ByteVector &data, bool synchSafeInts)
 Construct a Frame Header based on data. More...
 
 Header (const ByteVector &data, unsigned int version=4)
 Construct a Frame Header based on data. More...
 
virtual ~Header ()
 Destroys this Header instance. More...
 
void setData (const ByteVector &data, bool synchSafeInts)
 Sets the data for the Header. More...
 
void setData (const ByteVector &data, unsigned int version=4)
 Sets the data for the Header. More...
 
ByteVector frameID () const
 Returns the Frame ID (Structure, 4) (Frames, 4) More...
 
void setFrameID (const ByteVector &id)
 Sets the frame's ID to id. More...
 
unsigned int frameSize () const
 Returns the size of the frame data portion, as set when setData() was called or set explicitly via setFrameSize(). More...
 
void setFrameSize (unsigned int size)
 Sets the size of the frame data portion. More...
 
unsigned int version () const
 Returns the ID3v2 version of the header, as passed in from the construction of the header or set via setVersion(). More...
 
void setVersion (unsigned int version)
 Sets the ID3v2 version of the header, changing has impact on the correct parsing/rendering of frame data. More...
 
bool tagAlterPreservation () const
 Returns true if the flag for tag alter preservation is set. More...
 
void setTagAlterPreservation (bool discard)
 Sets the flag for preservation of this frame if the tag is set. More...
 
bool fileAlterPreservation () const
 Returns true if the flag for file alter preservation is set. More...
 
bool readOnly () const
 Returns true if the frame is meant to be read only. More...
 
bool groupingIdentity () const
 Returns true if the flag for the grouping identity is set. More...
 
bool compression () const
 Returns true if compression is enabled for this frame. More...
 
bool encryption () const
 Returns true if encryption is enabled for this frame. More...
 
bool unsycronisation () const
 
bool unsynchronisation () const
 Returns true if unsynchronisation is enabled for this frame. More...
 
bool dataLengthIndicator () const
 Returns true if the flag for a data length indicator is set. More...
 
ByteVector render () const
 Render the Header back to binary format in a ByteVector. More...
 
bool frameAlterPreservation () const
 

Static Public Member Functions

static TableOfContentsFramefindByElementID (const Tag *tag, const ByteVector &eID)
 CTOC frames each have a unique element ID. More...
 
static TableOfContentsFramefindTopLevel (const Tag *tag)
 CTOC frames each contain a flag that indicates, if CTOC frame is top-level (there isn't any frame, which contains this frame in its child elements list). More...
 
- Static Public Member Functions inherited from TagLib::ID3v2::Frame
static FramecreateTextualFrame (const String &key, const StringList &values)
 Creates a textual frame which corresponds to a single key in the PropertyMap interface. More...
 
static unsigned int headerSize ()
 Returns the size of the frame header. More...
 
static unsigned int headerSize (unsigned int version)
 Returns the size of the frame header for the given ID3v2 version. More...
 
static ByteVector textDelimiter (String::Type t)
 Returns the text delimiter that is used between fields for the string type t. More...
 
static unsigned int size ()
 Returns the size of the frame header in bytes. More...
 
static unsigned int size (unsigned int version)
 Returns the size of the frame header in bytes for the ID3v2 version that's given. More...
 

Protected Member Functions

virtual void parseFields (const ByteVector &data)
 Called by parse() to parse the field data. More...
 
virtual ByteVector renderFields () const
 Render the field data back to a binary format in a ByteVector. More...
 
- Protected Member Functions inherited from TagLib::ID3v2::Frame
 Frame (const ByteVector &data)
 Constructs an ID3v2 frame using data to read the header information. More...
 
 Frame (Header *h)
 This creates an Frame using the header h. More...
 
Headerheader () const
 Returns a pointer to the frame header. More...
 
void setHeader (Header *h, bool deleteCurrent=true)
 Sets the header to h. More...
 
void parse (const ByteVector &data)
 Called by setData() to parse the frame data. More...
 
ByteVector fieldData (const ByteVector &frameData) const
 Returns a ByteVector containing the field data given the frame data. More...
 
String readStringField (const ByteVector &data, String::Type encoding, int *positon=0)
 Reads a String of type encoding from the ByteVector data. More...
 
String::Type checkTextEncoding (const StringList &fields, String::Type encoding) const
 Checks a the list of string values to see if they can be used with the specified encoding and returns the recommended encoding. More...
 
PropertyMap asProperties () const
 Parses the contents of this frame as PropertyMap. More...
 

Friends

class FrameFactory
 

Additional Inherited Members

- Static Public Attributes inherited from TagLib::ID3v2::Frame
static const String instrumentPrefix
 The string with which an instrument name is prefixed to build a key in a PropertyMap; used to translate PropertyMaps to TMCL frames. More...
 
static const String commentPrefix
 The PropertyMap key prefix which triggers the use of a COMM frame instead of a TXXX frame for a non-standard key. More...
 
static const String lyricsPrefix
 The PropertyMap key prefix which triggers the use of a USLT frame instead of a TXXX frame for a non-standard key. More...
 
static const String urlPrefix
 The PropertyMap key prefix which triggers the use of a WXXX frame instead of a TXX frame for a non-standard key. More...
 
- Static Protected Member Functions inherited from TagLib::ID3v2::Frame
static String::Type checkEncoding (const StringList &fields, String::Type encoding)
 Checks a the list of string values to see if they can be used with the specified encoding and returns the recommended encoding. More...
 
static String::Type checkEncoding (const StringList &fields, String::Type encoding, unsigned int version)
 Checks a the list of string values to see if they can be used with the specified encoding and returns the recommended encoding. More...
 
static ByteVector keyToFrameID (const String &)
 Returns an appropriate ID3 frame ID for the given free-form tag key. More...
 
static String frameIDToKey (const ByteVector &)
 Returns a free-form tag name for the given ID3 frame ID. More...
 
static String keyToTXXX (const String &)
 Returns an appropriate TXXX frame description for the given free-form tag key. More...
 
static String txxxToKey (const String &)
 Returns a free-form tag name for the given ID3 frame description. More...
 
static void splitProperties (const PropertyMap &original, PropertyMap &singleFrameProperties, PropertyMap &tiplProperties, PropertyMap &tmclProperties)
 This helper function splits the PropertyMap original into three ProperytMaps singleFrameProperties, tiplProperties, and tmclProperties, such that: More...
 

Detailed Description

This is an implementation of ID3v2 table of contents frames.

Purpose of this frame is to allow a table of contents to be defined.An implementation of ID3v2 table of contents frames

Constructor & Destructor Documentation

TagLib::ID3v2::TableOfContentsFrame::TableOfContentsFrame ( const ID3v2::Header tagHeader,
const ByteVector data 
)

Creates a table of contents frame based on data.

tagHeader is required as the internal frames are parsed based on the tag version.

TagLib::ID3v2::TableOfContentsFrame::TableOfContentsFrame ( const ByteVector elementID,
const ByteVectorList children = ByteVectorList(),
const FrameList embeddedFrames = FrameList() 
)

Creates a table of contents frame with the element ID elementID, the child elements children and embedded frames, which become owned by this frame, in embeddedFrames.

TagLib::ID3v2::TableOfContentsFrame::~TableOfContentsFrame ( )

Destroys the frame.

Member Function Documentation

void TagLib::ID3v2::TableOfContentsFrame::addChildElement ( const ByteVector cE)

Adds cE to list of child elements of the frame.

See also
childElements()
void TagLib::ID3v2::TableOfContentsFrame::addEmbeddedFrame ( Frame frame)

Add an embedded frame to the CTOC frame.

At this point the CTOC frame takes ownership of the embedded frame and will handle freeing its memory.

Note
Using this method will invalidate any pointers on the list returned by embeddedFrameList()
PropertyMap TagLib::ID3v2::TableOfContentsFrame::asProperties ( ) const
ByteVectorList TagLib::ID3v2::TableOfContentsFrame::childElements ( ) const

Returns list of child elements of the frame.

See also
setChildElements()
ByteVector TagLib::ID3v2::TableOfContentsFrame::elementID ( ) const

Returns the elementID of the frame.

Element ID is a null terminated string, however it's not human-readable.

See also
setElementID()
const FrameList& TagLib::ID3v2::TableOfContentsFrame::embeddedFrameList ( ) const

Returns a reference to the embedded frame list.

This is an FrameList of all of the frames embedded in the CTOC frame in the order that they were parsed.

This can be useful if for example you want iterate over the CTOC frame's embedded frames in the order that they occur in the CTOC frame.

Warning
You should not modify this data structure directly, instead use addEmbeddedFrame() and removeEmbeddedFrame().
const FrameList& TagLib::ID3v2::TableOfContentsFrame::embeddedFrameList ( const ByteVector frameID) const

Returns the embedded frame list for frames with the id frameID or an empty list if there are no embedded frames of that type.

This is just a convenience and is equivalent to:

See also
embeddedFrameListMap()
const FrameListMap& TagLib::ID3v2::TableOfContentsFrame::embeddedFrameListMap ( ) const

Returns a reference to the frame list map.

This is an FrameListMap of all of the frames embedded in the CTOC frame.

This is the most convenient structure for accessing the CTOC frame's embedded frames. Many frame types allow multiple instances of the same frame type so this is a map of lists. In most cases however there will only be a single frame of a certain type.

Warning
You should not modify this data structure directly, instead use addEmbeddedFrame() and removeEmbeddedFrame().
See also
embeddedFrameList()
unsigned int TagLib::ID3v2::TableOfContentsFrame::entryCount ( ) const

Returns count of child elements of the frame.

It always corresponds to size of child elements list.

See also
childElements()
static TableOfContentsFrame* TagLib::ID3v2::TableOfContentsFrame::findByElementID ( const Tag tag,
const ByteVector eID 
)
static

CTOC frames each have a unique element ID.

This searches for a CTOC frame with the element ID eID and returns a pointer to it. This can be used to link together parent and child CTOC frames.

See also
elementID()
static TableOfContentsFrame* TagLib::ID3v2::TableOfContentsFrame::findTopLevel ( const Tag tag)
static

CTOC frames each contain a flag that indicates, if CTOC frame is top-level (there isn't any frame, which contains this frame in its child elements list).

Only a single frame within tag can be top-level. This searches for a top-level CTOC frame.

See also
isTopLevel()
bool TagLib::ID3v2::TableOfContentsFrame::isOrdered ( ) const

Returns true, if the child elements list entries are ordered.

See also
setIsOrdered()
bool TagLib::ID3v2::TableOfContentsFrame::isTopLevel ( ) const

Returns true, if the frame is top-level (doesn't have any parent CTOC frame).

See also
setIsTopLevel()
virtual void TagLib::ID3v2::TableOfContentsFrame::parseFields ( const ByteVector data)
protectedvirtual

Called by parse() to parse the field data.

It makes this information available through the public API. This must be overridden by the subclasses.

Implements TagLib::ID3v2::Frame.

void TagLib::ID3v2::TableOfContentsFrame::removeChildElement ( const ByteVector cE)

Removes cE to list of child elements of the frame.

See also
childElements()
void TagLib::ID3v2::TableOfContentsFrame::removeEmbeddedFrame ( Frame frame,
bool  del = true 
)

Remove an embedded frame from the CTOC frame.

If del is true the frame's memory will be freed; if it is false, it must be deleted by the user.

Note
Using this method will invalidate any pointers on the list returned by embeddedFrameList()
void TagLib::ID3v2::TableOfContentsFrame::removeEmbeddedFrames ( const ByteVector id)

Remove all embedded frames of type id from the CTOC frame and free their memory.

Note
Using this method will invalidate any pointers on the list returned by embeddedFrameList()
virtual ByteVector TagLib::ID3v2::TableOfContentsFrame::renderFields ( ) const
protectedvirtual

Render the field data back to a binary format in a ByteVector.

This must be overridden by subclasses.

Implements TagLib::ID3v2::Frame.

void TagLib::ID3v2::TableOfContentsFrame::setChildElements ( const ByteVectorList l)

Sets list of child elements of the frame to l.

See also
childElements()
void TagLib::ID3v2::TableOfContentsFrame::setElementID ( const ByteVector eID)

Sets the elementID of the frame to eID.

If eID isn't null terminated, a null char is appended automatically.

See also
elementID()
void TagLib::ID3v2::TableOfContentsFrame::setIsOrdered ( const bool &  o)

Sets, if the child elements list entries are ordered.

See also
isOrdered()
void TagLib::ID3v2::TableOfContentsFrame::setIsTopLevel ( const bool &  t)

Sets, if the frame is top-level (doesn't have any parent CTOC frame).

See also
isTopLevel()
virtual String TagLib::ID3v2::TableOfContentsFrame::toString ( ) const
virtual

This returns the textual representation of the data in the frame.

Subclasses must reimplement this method to provide a string representation of the frame's data.

Implements TagLib::ID3v2::Frame.

Friends And Related Function Documentation

friend class FrameFactory
friend

The documentation for this class was generated from the following file: