TagLib::Ogg::XiphComment Class Reference

Ogg Vorbis comment implementation. More...

`#include <xiphcomment.h>`

Inheritance diagram for TagLib::Ogg::XiphComment:
[legend]
Collaboration diagram for TagLib::Ogg::XiphComment:
[legend]

## Public Member Functions

| XiphComment ()
| XiphComment (const ByteVector &data)
| ~XiphComment () override
| XiphComment (const XiphComment &)=delete
XiphComment & | operator= (const XiphComment &)=delete
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
bool | isEmpty () const override
unsigned int | fieldCount () const
const FieldListMap & | fieldListMap () const
PropertyMap | properties () const override
PropertyMap | setProperties (const PropertyMap &) override
StringList | complexPropertyKeys () const override
List< VariantMap > | complexProperties (const String &key) const override
bool | setComplexProperties (const String &key, const List< VariantMap > &value) override
String | vendorID () const
void | addField (const String &key, const String &value, bool replace=true)
void | removeFields (const String &key)
void | removeFields (const String &key, const String &value)
void | removeAllFields ()
bool | contains (const String &key) const
ByteVector | render (bool addFramingBit=true) const
List< FLAC::Picture * > | pictureList ()
void | removePicture (FLAC::Picture *picture, bool del=true)
void | removeAllPictures ()
void | addPicture (FLAC::Picture *picture)
Public Member Functions inherited from TagLib::Tag
virtual | ~Tag ()
| Tag (const Tag &)=delete
Tag & | operator= (const Tag &)=delete
virtual void | removeUnsupportedProperties (const StringList &properties)

## Static Public Member Functions

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 | parse (const ByteVector &data)
Protected Member Functions inherited from TagLib::Tag
| Tag ()

## Detailed Description

Ogg Vorbis comment implementation.

This class is an implementation of the Ogg Vorbis comment specification, to be found in section 5 of the Ogg Vorbis specification. Because this format is also used in other (currently unsupported) Xiph.org formats, it has been made part of a generic implementation rather than being limited to strictly Vorbis.

Vorbis comments are a simple vector of keys and values, called fields. Multiple values for a given key are supported.

See also
  fieldListMap()

## Constructor & Destructor Documentation

## XiphComment() [1/3]

TagLib::Ogg::XiphComment::XiphComment | ( |  | ) |

Constructs an empty Vorbis comment.

Referenced by operator=(), and XiphComment().

## XiphComment() [2/3]

TagLib::Ogg::XiphComment::XiphComment | ( | const ByteVector & | data | ) |

Constructs a Vorbis comment from data.

## ~XiphComment()

TagLib::Ogg::XiphComment::~XiphComment | ( |  | ) |

override

Destroys this instance of the XiphComment.

## XiphComment() [3/3]

TagLib::Ogg::XiphComment::XiphComment | ( | const XiphComment & |  | ) |

delete

References XiphComment().

## Member Function Documentation

## addField()

void TagLib::Ogg::XiphComment::addField | ( | const String & | key,
|  | const String & | value,
|  | bool | replace = true )

Add the field specified by key with the data value. If replace is `true`, then all of the other fields with the same key will be removed first.

If the field value is empty, the field will be removed.

## addPicture()

void TagLib::Ogg::XiphComment::addPicture | ( | FLAC::Picture * | picture | ) |

Add a new picture to the comment block. The comment block takes ownership of the picture and will handle freeing its memory.

Note
  The file will be saved only after calling save().

## album()

String TagLib::Ogg::XiphComment::album | ( |  | ) | const

override virtual

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::Ogg::XiphComment::artist | ( |  | ) | const

override virtual

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

Implements TagLib::Tag.

## checkKey()

bool TagLib::Ogg::XiphComment::checkKey | ( | const String & |  | ) |

static

Check if the given String is a valid Xiph comment key.

## comment()

String TagLib::Ogg::XiphComment::comment | ( |  | ) | const

override virtual

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::Ogg::XiphComment::complexProperties | ( | const String & | key | ) | const

override virtual

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::Ogg::XiphComment::complexPropertyKeys | ( |  | ) | const

override virtual

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.

## contains()

bool TagLib::Ogg::XiphComment::contains | ( | const String & | key | ) | const

Returns `true` if the field is contained within the comment.

Note
  This is safer than checking for membership in the FieldListMap.

## fieldCount()

unsigned int TagLib::Ogg::XiphComment::fieldCount | ( |  | ) | const

Returns the number of fields present in the comment.

## fieldListMap()

const FieldListMap & TagLib::Ogg::XiphComment::fieldListMap | ( |  | ) | const

Returns a reference to the map of field lists. Because Xiph comments support multiple fields with the same key, a pure Map would not work. As such this is a Map of string lists, keyed on the comment field name.

The standard set of Xiph/Vorbis fields (which may or may not be contained in any specific comment) is:

- TITLE
- VERSION
- ALBUM
- ARTIST
- PERFORMER
- COPYRIGHT
- ORGANIZATION
- DESCRIPTION
- GENRE
- DATE
- LOCATION
- CONTACT
- ISRC

For a more detailed description of these fields, please see the Ogg Vorbis specification, section 5.2.2.1.

Note
  The Ogg Vorbis comment specification does allow these key values to be either upper or lower case. However, it is conventional for them to be upper case. As such, TagLib, when parsing a Xiph/Vorbis comment, converts all fields to uppercase. When you are using this data structure, you will need to specify the field name in upper case.

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

## genre()

String TagLib::Ogg::XiphComment::genre | ( |  | ) | const

override virtual

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

Implements TagLib::Tag.

## isEmpty()

bool TagLib::Ogg::XiphComment::isEmpty | ( |  | ) | const

override virtual

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.

## operator=()

XiphComment & TagLib::Ogg::XiphComment::operator= | ( | const XiphComment & |  | ) |

delete

References XiphComment().

## parse()

void TagLib::Ogg::XiphComment::parse | ( | const ByteVector & | data | ) |

protected

Reads the tag from the file specified in the constructor and fills the FieldListMap.

References TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE.

## pictureList()

List< FLAC::Picture * > TagLib::Ogg::XiphComment::pictureList | ( |  | ) |

Returns a list of pictures attached to the xiph comment.

## properties()

PropertyMap TagLib::Ogg::XiphComment::properties | ( |  | ) | const

override virtual

Implements the unified property interface – export function. The result is a one-to-one match of the Xiph comment, since it is completely compatible with the property interface (in fact, a Xiph comment is nothing more than a map from tag names to list of values, as is the dict interface).

Reimplemented from TagLib::Tag.

## removeAllFields()

void TagLib::Ogg::XiphComment::removeAllFields | ( |  | ) |

Remove all the fields in the comment.

See also
  removeFields()

## removeAllPictures()

void TagLib::Ogg::XiphComment::removeAllPictures | ( |  | ) |

Remove all pictures.

## removeFields() [1/2]

void TagLib::Ogg::XiphComment::removeFields | ( | const String & | key | ) |

Remove all the fields specified by key.

See also
  removeAllFields()

## removeFields() [2/2]

void TagLib::Ogg::XiphComment::removeFields | ( | const String & | key,
|  | const String & | value )

Remove all the fields specified by key with the data value.

See also
  removeAllFields()

## removePicture()

void TagLib::Ogg::XiphComment::removePicture | ( | FLAC::Picture * | picture,
|  | bool | del = true )

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

## render()

ByteVector TagLib::Ogg::XiphComment::render | ( | bool | addFramingBit = true | ) | const

Renders the comment to a ByteVector suitable for inserting into a file.

If addFramingBit is `true` the standard Vorbis comment framing bit will be appended. However some formats (notably FLAC) do not work with this in place.

## setAlbum()

void TagLib::Ogg::XiphComment::setAlbum | ( | const String & | s | ) |

override virtual

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

Implements TagLib::Tag.

## setArtist()

void TagLib::Ogg::XiphComment::setArtist | ( | const String & | s | ) |

override virtual

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

Implements TagLib::Tag.

## setComment()

void TagLib::Ogg::XiphComment::setComment | ( | const String & | s | ) |

override virtual

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

Implements TagLib::Tag.

## setComplexProperties()

bool TagLib::Ogg::XiphComment::setComplexProperties | ( | const String & | key,
|  | const List< VariantMap > & | value )

override virtual

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.

## setGenre()

void TagLib::Ogg::XiphComment::setGenre | ( | const String & | s | ) |

override virtual

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.

## setProperties()

PropertyMap TagLib::Ogg::XiphComment::setProperties | ( | const PropertyMap & |  | ) |

override virtual

Implements the unified property interface – import function. The tags from the given map will be stored one-to-one in the file, except for invalid keys (less than one character, non-ASCII, or containing '=' or '~') in which case the according values will be contained in the returned PropertyMap.

Reimplemented from TagLib::Tag.

## setTitle()

void TagLib::Ogg::XiphComment::setTitle | ( | const String & | s | ) |

override virtual

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

Implements TagLib::Tag.

## setTrack()

void TagLib::Ogg::XiphComment::setTrack | ( | unsigned int | i | ) |

override virtual

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

Implements TagLib::Tag.

## setYear()

void TagLib::Ogg::XiphComment::setYear | ( | unsigned int | i | ) |

override virtual

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

Implements TagLib::Tag.

## title()

String TagLib::Ogg::XiphComment::title | ( |  | ) | const

override virtual

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::Ogg::XiphComment::track | ( |  | ) | const

override virtual

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

Implements TagLib::Tag.

## vendorID()

String TagLib::Ogg::XiphComment::vendorID | ( |  | ) | const

Returns the vendor ID of the Ogg Vorbis encoder. libvorbis 1.0 as the most common case always returns "Xiph.Org libVorbis I 20020717".

## year()

unsigned int TagLib::Ogg::XiphComment::year | ( |  | ) | const

override virtual

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:

- xiphcomment.h