TagLib API Documentation
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
TagLib::APE::Tag Class Reference

An APE tag implementation. More...

#include <apetag.h>

Inheritance diagram for TagLib::APE::Tag:
[legend]
Collaboration diagram for TagLib::APE::Tag:
[legend]

Public Member Functions

 Tag ()
 
 Tag (TagLib::File *file, offset_t footerLocation)
 
 ~Tag () override
 
 Tag (const Tag &)=delete
 
Tagoperator= (const Tag &)=delete
 
ByteVector render () const
 
String title () const override
 
String artist () const override
 
String album () const override
 
String comment () const override
 
String genre () const override
 
unsigned int year () const override
 
unsigned int track () const override
 
void setTitle (const String &s) override
 
void setArtist (const String &s) override
 
void setAlbum (const String &s) override
 
void setComment (const String &s) override
 
void setGenre (const String &s) override
 
void setYear (unsigned int i) override
 
void setTrack (unsigned int i) override
 
PropertyMap properties () const override
 
void removeUnsupportedProperties (const StringList &properties) override
 
PropertyMap setProperties (const PropertyMap &) override
 
StringList complexPropertyKeys () const override
 
List< VariantMapcomplexProperties (const String &key) const override
 
bool setComplexProperties (const String &key, const List< VariantMap > &value) override
 
Footerfooter () const
 
const ItemListMapitemListMap () const
 
void removeItem (const String &key)
 
void addValue (const String &key, const String &value, bool replace=true)
 
void setData (const String &key, const ByteVector &value)
 
void setItem (const String &key, const Item &item)
 
bool isEmpty () const override
 
- Public Member Functions inherited from TagLib::Tag
virtual ~Tag ()
 
 Tag (const Tag &)=delete
 
Tagoperator= (const Tag &)=delete
 
virtual PropertyMap properties () const
 
virtual void removeUnsupportedProperties (const StringList &properties)
 
virtual PropertyMap setProperties (const PropertyMap &origProps)
 
virtual StringList complexPropertyKeys () const
 
virtual List< VariantMapcomplexProperties (const String &key) const
 
virtual bool setComplexProperties (const String &key, const List< VariantMap > &value)
 
virtual String title () const =0
 
virtual String artist () const =0
 
virtual String album () const =0
 
virtual String comment () const =0
 
virtual String genre () const =0
 
virtual unsigned int year () const =0
 
virtual unsigned int track () const =0
 
virtual void setTitle (const String &s)=0
 
virtual void setArtist (const String &s)=0
 
virtual void setAlbum (const String &s)=0
 
virtual void setComment (const String &s)=0
 
virtual void setGenre (const String &s)=0
 
virtual void setYear (unsigned int i)=0
 
virtual void setTrack (unsigned int i)=0
 
virtual bool isEmpty () const
 

Static Public Member Functions

static ByteVector fileIdentifier ()
 
static bool checkKey (const String &)
 
- Static Public Member Functions inherited from TagLib::Tag
static void duplicate (const Tag *source, Tag *target, bool overwrite=true)
 
static String joinTagValues (const StringList &values)
 

Protected Member Functions

void read ()
 
void parse (const ByteVector &data)
 
- Protected Member Functions inherited from TagLib::Tag
 Tag ()
 

Detailed Description

An APE tag implementation.

Constructor & Destructor Documentation

◆ Tag() [1/3]

TagLib::APE::Tag::Tag ( )

Create an APE tag with default values.

◆ Tag() [2/3]

TagLib::APE::Tag::Tag ( TagLib::File file,
offset_t  footerLocation 
)

Create an APE tag and parse the data in file with APE footer at tagOffset.

◆ ~Tag()

TagLib::APE::Tag::~Tag ( )
overridevirtual

Destroys this Tag instance.

Reimplemented from TagLib::Tag.

◆ Tag() [3/3]

TagLib::APE::Tag::Tag ( const Tag )
delete

Member Function Documentation

◆ addValue()

void TagLib::APE::Tag::addValue ( const String key,
const String value,
bool  replace = true 
)

Adds to the text item specified by key the data value. If replace is true, then all of the other values on the same key will be removed first. If a binary item exists for key it will be removed first.

◆ album()

String TagLib::APE::Tag::album ( ) const
overridevirtual

Returns the album name; if no album name is present in the tag an empty string will be returned.

Implements TagLib::Tag.

◆ artist()

String TagLib::APE::Tag::artist ( ) const
overridevirtual

Returns the artist name; if no artist name is present in the tag an empty string will be returned.

Implements TagLib::Tag.

◆ checkKey()

static bool TagLib::APE::Tag::checkKey ( const String )
static

Check if the given String is a valid APE tag key.

◆ comment()

String TagLib::APE::Tag::comment ( ) const
overridevirtual

Returns the track comment; if no comment is present in the tag an empty string will be returned.

Implements TagLib::Tag.

◆ complexProperties()

List< VariantMap > TagLib::APE::Tag::complexProperties ( const String key) const
overridevirtual

Get the complex properties for a given key. In order to be flexible for different metadata formats, the properties are represented as variant maps. Despite this dynamic nature, some degree of standardization should be achieved between formats:

  • PICTURE
    • data: ByteVector with picture data
    • description: String with description
    • pictureType: String with type as specified for ID3v2, e.g. "Front Cover", "Back Cover", "Band"
    • mimeType: String with image format, e.g. "image/jpeg"
    • optionally more information found in the tag, such as "width", "height", "numColors", "colorDepth" int values in FLAC pictures
  • GENERALOBJECT
    • data: ByteVector with object data
    • description: String with description
    • fileName: String with file name
    • mimeType: String with MIME type
    • this is currently only implemented for ID3v2 GEOB frames

Reimplemented from TagLib::Tag.

◆ complexPropertyKeys()

StringList TagLib::APE::Tag::complexPropertyKeys ( ) const
overridevirtual

Get the keys of complex properties, i.e. properties which cannot be represented simply by a string. Because such properties might be expensive to fetch, there are separate operations to get the available keys - which is expected to be cheap - and getting and setting the property values. The default implementation returns only an empty list. Reimplementations should provide "PICTURE" if embedded cover art is present, and optionally support other properties.

Reimplemented from TagLib::Tag.

◆ fileIdentifier()

static ByteVector TagLib::APE::Tag::fileIdentifier ( )
static

Returns the string "APETAGEX" suitable for usage in locating the tag in a file.

◆ footer()

Footer * TagLib::APE::Tag::footer ( ) const

Returns a pointer to the tag's footer.

◆ genre()

String TagLib::APE::Tag::genre ( ) const
overridevirtual

Returns the genre name; if no genre is present in the tag an empty string will be returned.

Implements TagLib::Tag.

◆ isEmpty()

bool TagLib::APE::Tag::isEmpty ( ) const
overridevirtual

Returns true if the tag does not contain any data.

Reimplemented from TagLib::Tag.

◆ itemListMap()

const ItemListMap & TagLib::APE::Tag::itemListMap ( ) const

Returns a reference to the item list map. This is an ItemListMap of all of the items in the tag.

This is the most powerful structure for accessing the items of the tag.

APE tags are case-insensitive, all keys in this map have been converted to upper case.

Warning
You should not modify this data structure directly, instead use setItem() and removeItem().

◆ operator=()

Tag & TagLib::APE::Tag::operator= ( const Tag )
delete

◆ parse()

void TagLib::APE::Tag::parse ( const ByteVector data)
protected

Parses the body of the tag in data.

◆ properties()

PropertyMap TagLib::APE::Tag::properties ( ) const
overridevirtual

Implements the unified tag dictionary interface – export function. APE tags are perfectly compatible with the dictionary interface because they support both arbitrary tag names and multiple values. Currently only APE items of type Text are handled by the dictionary interface; all Binary and Locator items will be put into the unsupportedData list and can be deleted on request using removeUnsupportedProperties(). The same happens to Text items if their key is invalid for PropertyMap (which should actually never happen).

The only conversion done by this export function is to rename the APE tags TRACK to TRACKNUMBER, YEAR to DATE, and ALBUM ARTIST to ALBUMARTIST, respectively, (and a few other keys, see Mapping of Properties to Various Formats) in order to be compliant with the names used in other formats.

Reimplemented from TagLib::Tag.

◆ read()

void TagLib::APE::Tag::read ( )
protected

Reads from the file specified in the constructor.

◆ removeItem()

void TagLib::APE::Tag::removeItem ( const String key)

Removes the key item from the tag

◆ removeUnsupportedProperties()

void TagLib::APE::Tag::removeUnsupportedProperties ( const StringList properties)
overridevirtual

Removes unsupported properties, or a subset of them, from the tag. The parameter properties must contain only entries from properties().unsupportedData().

Reimplemented from TagLib::Tag.

◆ render()

ByteVector TagLib::APE::Tag::render ( ) const

Renders the in memory values to a ByteVector suitable for writing to the file.

◆ setAlbum()

void TagLib::APE::Tag::setAlbum ( const String s)
overridevirtual

Sets the album to s. If s is an empty string then this value will be cleared.

Implements TagLib::Tag.

◆ setArtist()

void TagLib::APE::Tag::setArtist ( const String s)
overridevirtual

Sets the artist to s. If s is an empty string then this value will be cleared.

Implements TagLib::Tag.

◆ setComment()

void TagLib::APE::Tag::setComment ( const String s)
overridevirtual

Sets the comment to s. If s is an empty string then this value will be cleared.

Implements TagLib::Tag.

◆ setComplexProperties()

bool TagLib::APE::Tag::setComplexProperties ( const String key,
const List< VariantMap > &  value 
)
overridevirtual

Set all complex properties for a given key using variant maps as value with the same format as returned by complexProperties(). An empty list as value removes all complex properties for key.

Reimplemented from TagLib::Tag.

◆ setData()

void TagLib::APE::Tag::setData ( const String key,
const ByteVector value 
)

Set the binary data for the key specified by item to value This will convert the item to type Binary if it isn't already and all of the other values on the same key will be removed.

◆ setGenre()

void TagLib::APE::Tag::setGenre ( const String s)
overridevirtual

Sets the genre to s. If s is an empty string 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.

◆ setItem()

void TagLib::APE::Tag::setItem ( const String key,
const Item item 
)

Sets the key item to the value of item. If an item with the key is already present, it will be replaced.

◆ setProperties()

PropertyMap TagLib::APE::Tag::setProperties ( const PropertyMap )
overridevirtual

Implements the unified tag dictionary interface – import function. The same comments as for the export function apply; additionally note that the APE tag specification requires keys to have between 2 and 16 printable ASCII characters with the exception of the fixed strings "ID3", "TAG", "OGGS", and "MP+".

Reimplemented from TagLib::Tag.

◆ setTitle()

void TagLib::APE::Tag::setTitle ( const String s)
overridevirtual

Sets the title to s. If s is an empty string then this value will be cleared.

Implements TagLib::Tag.

◆ setTrack()

void TagLib::APE::Tag::setTrack ( unsigned int  i)
overridevirtual

Sets the track to i. If s is 0 then this value will be cleared.

Implements TagLib::Tag.

◆ setYear()

void TagLib::APE::Tag::setYear ( unsigned int  i)
overridevirtual

Sets the year to i. If s is 0 then this value will be cleared.

Implements TagLib::Tag.

◆ title()

String TagLib::APE::Tag::title ( ) const
overridevirtual

Returns the track name; if no track name is present in the tag an empty string will be returned.

Implements TagLib::Tag.

◆ track()

unsigned int TagLib::APE::Tag::track ( ) const
overridevirtual

Returns the track number; if there is no track number set, this will return 0.

Implements TagLib::Tag.

◆ year()

unsigned int TagLib::APE::Tag::year ( ) const
overridevirtual

Returns the year; if there is no year set, this will return 0.

Implements TagLib::Tag.


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