Tag Parser: TagParser::VorbisComment Class Reference

Tag Parser 12.5.3 C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags

Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Member Functions | Friends | List of all members
TagParser::VorbisComment Class Reference

Implementation of TagParser::Tag for Vorbis comments. More...

`#include <vorbiscomment.h>`

Inheritance diagram for TagParser::VorbisComment:
[legend]
Collaboration diagram for TagParser::VorbisComment:
[legend]

## Public Member Functions
| VorbisComment ()
| Constructs a new Vorbis comment.
bool | canEncodingBeUsed (TagTextEncoding encoding) const override
| Returns an indication whether the specified encoding can be used to provide string values for the tag.
const TagValue & | value (KnownField field) const override
| Returns the value of the specified field.
bool | setValue (KnownField field, const TagValue &value) override
| Assigns the given value to the specified field.
void | parse (OggIterator &iterator, VorbisCommentFlags flags, Diagnostics &diag)
| Parses tag information using the specified Ogg iterator.
void | parse (OggIterator &iterator, VorbisCommentFlags flags, std::uint64_t &padding, Diagnostics &diag)
| Parses tag information using the specified Ogg iterator.
void | parse (std::istream &stream, std::uint64_t maxSize, VorbisCommentFlags flags, Diagnostics &diag)
| Parses tag information using the specified Ogg iterator.
void | make (std::ostream &stream, VorbisCommentFlags flags, Diagnostics &diag)
| Writes tag information to the specified stream.
const TagValue & | vendor () const
| Returns the vendor.
void | setVendor (const TagValue &vendor)
| Sets the vendor.
bool | supportsMultipleValues (KnownField) const override
| Allows multiple values for all fields.
Public Member Functions inherited from TagParser::FieldMapBasedTag< VorbisComment >
virtual TagDataType | proposedDataType (KnownField field) const
| Returns the proposed data type for the specified field as TagDataType.
| FieldMapBasedTag ()
| Constructs a new FieldMapBasedTag.
TagType | type () const
| Returns the type of the tag as TagParser::TagType.
std::string_view | typeName () const
| Returns the type name of the tag.
TagTextEncoding | proposedTextEncoding () const
| Returns the proposed text encoding.
const TagValue & | value (const IdentifierType &id) const
| Returns the value of the field with the specified id.
std::vector< const TagValue * > | values (const IdentifierType &id) const
| Returns the values of the field with the specified id.
bool | setValue (const IdentifierType &id, const TagValue &value)
| Assigns the given value to the field with the specified id.
bool | setValues (const IdentifierType &id, const std::vector< TagValue > &values)
| Assigns the given values to the field with the specified id.
bool | hasField (KnownField field) const
| Returns an indication whether the specified field is present.
void | removeAllFields ()
| Removes all fields from the tag.
const std::multimap< IdentifierType, FieldType, Compare > & | fields () const
| Returns the fields of the tag by providing direct access to the field map of the tag.
std::size_t | fieldCount () const
| Returns the number of present fields.
IdentifierType | fieldId (KnownField value) const
| Returns the ID for the specified field.
KnownField | knownField (const IdentifierType &id) const
| Returns the field for the specified ID.
bool | supportsField (KnownField field) const
| Returns an indication whether the specified field is supported by the tag.
std::size_t | insertFields (const FieldMapBasedTag< VorbisComment > &from, bool overwrite)
| Inserts all fields from another tag of the same field type and compare function.
std::size_t | insertValues (const Tag &from, bool overwrite)
| Inserts all compatible values from another Tag.
void | ensureTextValuesAreProperlyEncoded ()
| Ensures the encoding of all assigned text values is supported by the tag by converting the character set if necessary.
Public Member Functions inherited from TagParser::Tag
virtual | ~Tag ()
| Destroys the Tag.
std::string | toString () const
| Returns a string representation of the tag.
virtual std::vector< const TagValue * > | values (KnownField field) const
| Returns the values of the specified field.
virtual bool | setValues (KnownField field, const std::vector< TagValue > &values)
| Assigns the given values to the specified field.
const std::string & | version () const
| Returns the version of the tag.
std::uint64_t | size () const
| Returns the size the tag within the file it is parsed from in bytes.
virtual bool | supportsTarget () const
| Returns an indication whether a target is supported by the tag.
const TagTarget & | target () const
TagTarget & | target ()
| Returns the target of tag.
void | setTarget (const TagTarget &target)
| Sets the target of tag.
virtual TagTargetLevel | targetLevel () const
| Returns the name of the current tag target level.
std::string_view | targetLevelName () const
| Returns the name of the current target level.
bool | isTargetingLevel (TagTargetLevel tagTargetLevel) const
| Returns whether the tag is targeting the specified tagTargetLevel.
std::string | targetString () const
| Returns the string representation for the assigned tag target.
virtual bool | supportsDescription (KnownField field) const
| Returns an indications whether the specified field supports descriptions.
virtual bool | supportsMimeType (KnownField field) const
| Returns an indications whether the specified field supports mime types.

## Static Public Attributes
static constexpr TagType | tagType = TagType::VorbisComment
static constexpr std::string_view | tagName = "Vorbis comment"
static constexpr TagTextEncoding | defaultTextEncoding = TagTextEncoding::Utf8

## Protected Member Functions
IdentifierType | internallyGetFieldId (KnownField field) const
KnownField | internallyGetKnownField (const IdentifierType &id) const
Protected Member Functions inherited from TagParser::FieldMapBasedTag< VorbisComment >
const TagValue & | internallyGetValue (const IdentifierType &id) const
| Default implementation for value().
void | internallyGetValuesFromField (const FieldType &field, std::vector< const TagValue * > &values) const
| Default way to gather values from a field in internallyGetValues().
std::vector< const TagValue * > | internallyGetValues (const IdentifierType &id) const
| Default implementation for values().
bool | internallySetValue (const IdentifierType &id, const TagValue &value)
| Default implementation for setValue().
bool | internallySetValues (const IdentifierType &id, const std::vector< TagValue > &values)
| Default implementation for setValues().
bool | internallyHasField (const IdentifierType &id) const
| Default implementation for hasField().
TagDataType | internallyGetProposedDataType (const IdentifierType &id) const
| Default implementation for proposedDataType().
Protected Member Functions inherited from TagParser::Tag
| Tag ()
| Constructs a new Tag.

## Friends
class | FieldMapBasedTag< VorbisComment >
class | ::OverallTests

## Additional Inherited Members
Public Types inherited from TagParser::FieldMapBasedTag< VorbisComment >
using | FieldType
using | IdentifierType
using | Compare
Protected Types inherited from TagParser::FieldMapBasedTag< VorbisComment >
using | CRTPBase
Protected Attributes inherited from TagParser::Tag
std::string | m_version
std::uint64_t | m_size
std::unique_ptr< TagPrivate > | m_p
TagTarget | m_target

## Detailed Description

Implementation of TagParser::Tag for Vorbis comments.

Definition at line 27 of file vorbiscomment.h.

## Constructor & Destructor Documentation

## ◆ VorbisComment()

TagParser::VorbisComment::VorbisComment | ( |  | ) |
| inline

Constructs a new Vorbis comment.

Definition at line 70 of file vorbiscomment.h.

## Member Function Documentation

## ◆ canEncodingBeUsed()

bool TagParser::VorbisComment::canEncodingBeUsed | ( | TagTextEncoding | encoding | ) | const
| inlineoverridevirtual

Returns an indication whether the specified encoding can be used to provide string values for the tag.

Only the proposedTextEncoding() is accepted by default. This might be overwritten when subclassing.

The tag class and its subclasses do not perform any conversions. You have to provide all string values using an encoding which is appropriate for the specific tag type. This method is meant to determine if a particular encoding can be used.

See also
  canEncodingBeUsed()

Reimplemented from TagParser::Tag.

Definition at line 74 of file vorbiscomment.h.

## ◆ internallyGetFieldId()

VorbisComment::IdentifierType TagParser::VorbisComment::internallyGetFieldId | ( | KnownField | field | ) | const
| protected

Definition at line 48 of file vorbiscomment.cpp.

## ◆ internallyGetKnownField()

KnownField TagParser::VorbisComment::internallyGetKnownField | ( | const IdentifierType & | id | ) | const
| protected

Definition at line 123 of file vorbiscomment.cpp.

## ◆ make()

void TagParser::VorbisComment::make | ( | std::ostream & | stream,
|  | VorbisCommentFlags | flags,
|  | Diagnostics & | diag )

Writes tag information to the specified stream.

Exceptions

  Throws | std::ios_base::failure when an IO error occurs.
  Throws | TagParser::Failure or a derived exception when a making error occurs.

Definition at line 388 of file vorbiscomment.cpp.

## ◆ parse() [1/3]

void TagParser::VorbisComment::parse | ( | OggIterator & | iterator,
|  | VorbisCommentFlags | flags,
|  | Diagnostics & | diag )

Parses tag information using the specified Ogg iterator.

Exceptions

  Throws | std::ios_base::failure when an IO error occurs.
  Throws | TagParser::Failure or a derived exception when a parsing error occurs.

Definition at line 334 of file vorbiscomment.cpp.

## ◆ parse() [2/3]

void TagParser::VorbisComment::parse | ( | OggIterator & | iterator,
|  | VorbisCommentFlags | flags,
|  | std::uint64_t & | padding,
|  | Diagnostics & | diag )

Parses tag information using the specified Ogg iterator.

Exceptions

  Throws | std::ios_base::failure when an IO error occurs.
  Throws | TagParser::Failure or a derived exception when a parsing error occurs.

Definition at line 347 of file vorbiscomment.cpp.

## ◆ parse() [3/3]

void TagParser::VorbisComment::parse | ( | std::istream & | stream,
|  | std::uint64_t | maxSize,
|  | VorbisCommentFlags | flags,
|  | Diagnostics & | diag )

Parses tag information using the specified Ogg iterator.

Exceptions

  Throws | std::ios_base::failure when an IO error occurs.
  Throws | TagParser::Failure or a derived exception when a parsing error occurs.

Definition at line 359 of file vorbiscomment.cpp.

## ◆ setValue()

bool TagParser::VorbisComment::setValue | ( | KnownField | field,
|  | const TagValue & | value )
| overridevirtual

Assigns the given value to the specified field.

Remarks
  - If an empty value is given, the field will be be removed.
  - Some tags support more than just one value per field. This method will only alter the first value.

See also
  value(), hasField()

Implements TagParser::Tag.

Definition at line 37 of file vorbiscomment.cpp.

## ◆ setVendor()

void TagParser::VorbisComment::setVendor | ( | const TagValue & | vendor | ) |
| inline

Sets the vendor.

Remarks
  Also accessible via setValue(KnownField::Vendor, vendor).

Definition at line 92 of file vorbiscomment.h.

## ◆ supportsMultipleValues()

bool TagParser::VorbisComment::supportsMultipleValues | ( | KnownField |  | ) | const
| inlineoverridevirtual

Allows multiple values for all fields.

Remarks
  "Field names are not required to be unique (occur once) within a comment header."

Reimplemented from TagParser::Tag.

Definition at line 101 of file vorbiscomment.h.

## ◆ value()

const TagValue & TagParser::VorbisComment::value | ( | KnownField | field | ) | const
| overridevirtual

Returns the value of the specified field.

Remarks
  - If the specified field is not present an empty TagValue will be returned.
  - Some tags support more than just one value per field. If there are multiple values this method just returns the first one.

See also
  setValue(), hasField()

Implements TagParser::Tag.

Definition at line 27 of file vorbiscomment.cpp.

## ◆ vendor()

const TagValue & TagParser::VorbisComment::vendor | ( |  | ) | const
| inline

Returns the vendor.

Remarks
  Also accessible via value(KnownField::Vendor).

Definition at line 83 of file vorbiscomment.h.

## Friends And Related Symbol Documentation

## ◆ ::OverallTests

friend class ::OverallTests
| friend

Definition at line 29 of file vorbiscomment.h.

## ◆ FieldMapBasedTag< VorbisComment >

friend class FieldMapBasedTag< VorbisComment >
| friend

Definition at line 101 of file vorbiscomment.h.

## Member Data Documentation

## ◆ defaultTextEncoding

TagTextEncoding TagParser::VorbisComment::defaultTextEncoding = TagTextEncoding::Utf8
| staticconstexpr

Definition at line 36 of file vorbiscomment.h.

## ◆ tagName

std::string_view TagParser::VorbisComment::tagName = "Vorbis comment"
| staticconstexpr

Definition at line 35 of file vorbiscomment.h.

## ◆ tagType

TagType TagParser::VorbisComment::tagType = TagType::VorbisComment
| staticconstexpr

Definition at line 34 of file vorbiscomment.h.

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

- vorbis/vorbiscomment.h
- vorbis/vorbiscomment.cpp