Tag Parser  7.0.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
Public Member Functions | Static Public Attributes | Protected Member Functions | Friends | List of all members
TagParser::MatroskaTag Class Reference

#include <matroskatag.h>

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

Public Member Functions

 MatroskaTag ()
 Constructs a new tag. More...
 
bool canEncodingBeUsed (TagTextEncoding encoding) const
 Returns an indication whether the specified encoding can be used to provide string values for the tag. More...
 
bool supportsTarget () const
 Returns an indication whether a target is supported by the tag. More...
 
TagTargetLevel targetLevel () const
 Returns the name of the current tag target level. More...
 
void parse (EbmlElement &tagElement, Diagnostics &diag)
 Parses tag information from the specified tagElement. More...
 
MatroskaTagMaker prepareMaking (Diagnostics &diag)
 Prepares making. More...
 
void make (std::ostream &stream, Diagnostics &diag)
 Writes tag information to the specified stream (makes a "Tag"-element). More...
 
- Public Member Functions inherited from TagParser::FieldMapBasedTag< MatroskaTag >
 FieldMapBasedTag ()
 Constructs a new FieldMapBasedTag. More...
 
TagType type () const
 Returns the type of the tag as Media::TagType. More...
 
const char * typeName () const
 Returns the type name of the tag as C-style string. More...
 
TagTextEncoding proposedTextEncoding () const
 Returns the proposed text encoding. More...
 
const TagValuevalue (const IdentifierType &id) const
 Returns the value of the field with the specified id. More...
 
const TagValuevalue (KnownField field) const
 Returns the value of the specified field. More...
 
std::vector< const TagValue *> values (const IdentifierType &id) const
 Returns the values of the field with the specified id. More...
 
std::vector< const TagValue *> values (KnownField field) const
 Returns the values of the specified field. More...
 
bool setValue (const IdentifierType &id, const TagValue &value)
 Assigns the given value to the field with the specified id. More...
 
bool setValue (KnownField field, const TagValue &value)
 Assigns the given value to the specified field. More...
 
bool setValues (const IdentifierType &id, const std::vector< TagValue > &values)
 Assigns the given values to the field with the specified id. More...
 
bool setValues (KnownField field, const std::vector< TagValue > &values)
 Assigns the given values to the field with the specified id. More...
 
bool hasField (KnownField field) const
 Returns an indication whether the specified field is present. More...
 
bool hasField (const IdentifierType &id) const
 Returns an indication whether the field with the specified id is present. More...
 
void removeAllFields ()
 Removes all fields from the tag. More...
 
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. More...
 
std::multimap< IdentifierType, FieldType, Compare > & fields ()
 Returns the fields of the tag by providing direct access to the field map of the tag. More...
 
unsigned int fieldCount () const
 Returns the number of present fields. More...
 
IdentifierType fieldId (KnownField value) const
 Returns the ID for the specified field. More...
 
KnownField knownField (const IdentifierType &id) const
 Returns the field for the specified ID. More...
 
bool supportsField (KnownField field) const
 Returns an indication whether the specified field is supported by the tag. More...
 
TagDataType proposedDataType (const IdentifierType &id) const
 Returns the proposed data type for the field with the specified id. More...
 
virtual TagDataType proposedDataType (KnownField field) const
 Returns the proposed data type for the specified field as TagDataType. More...
 
int insertFields (const FieldMapBasedTag< MatroskaTag > &from, bool overwrite)
 Inserts all fields from another tag of the same field type and compare function. More...
 
unsigned int insertValues (const Tag &from, bool overwrite)
 Inserts all compatible values from another Tag. More...
 
void ensureTextValuesAreProperlyEncoded ()
 Ensures the encoding of all assigned text values is supported by the tag by converting the character set if neccessary. More...
 
- Public Member Functions inherited from TagParser::Tag
virtual ~Tag ()
 Destroys the Tag. More...
 
std::string toString () const
 Returns a string representation of the tag. More...
 
const std::string & version () const
 Returns the version of the tag as std::string. More...
 
uint32 size () const
 Returns the size of the tag in bytes. More...
 
const TagTargettarget () const
 Returns the target of tag. More...
 
void setTarget (const TagTarget &target)
 Sets the target of tag. More...
 
const char * targetLevelName () const
 Returns the name of the current target level. More...
 
bool isTargetingLevel (TagTargetLevel tagTargetLevel) const
 Returns whether the tag is targeting the specified tagTargetLevel. More...
 
std::string targetString () const
 Returns the string representation for the assigned tag target. More...
 
virtual TagDataType proposedDataType (KnownField field) const
 Returns the proposed data type for the specified field as TagDataType. More...
 
virtual bool supportsDescription (KnownField field) const
 Returns an indications whether the specified field supports descriptions. More...
 
virtual bool supportsMimeType (KnownField field) const
 Returns an indications whether the specified field supports mime types. More...
 

Static Public Attributes

static constexpr TagType tagType = TagType::MatroskaTag
 
static constexpr const char * tagName = "Matroska tag"
 
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< MatroskaTag >
const TagValueinternallyGetValue (const IdentifierType &id) const
 Default implementation for value(). More...
 
bool internallySetValue (const IdentifierType &id, const TagValue &value)
 Default implementation for setValue(). More...
 
bool internallyHasField (const IdentifierType &id) const
 Default implementation for hasField(). More...
 
TagDataType internallyGetProposedDataType (const IdentifierType &id) const
 Default implementation for proposedDataType(). More...
 
- Protected Member Functions inherited from TagParser::Tag
 Tag ()
 Constructs a new Tag. More...
 

Friends

class FieldMapBasedTag< MatroskaTag >
 

Additional Inherited Members

- Public Types inherited from TagParser::FieldMapBasedTag< MatroskaTag >
typedef FieldMapBasedTagTraits< MatroskaTag >::FieldType FieldType
 
typedef FieldMapBasedTagTraits< MatroskaTag >::FieldType::IdentifierType IdentifierType
 
typedef FieldMapBasedTagTraits< MatroskaTag >::Compare Compare
 
- Protected Attributes inherited from TagParser::Tag
std::string m_version
 
uint32 m_size
 
TagTarget m_target
 

Detailed Description

Definition at line 58 of file matroskatag.h.

Constructor & Destructor Documentation

◆ MatroskaTag()

TagParser::MatroskaTag::MatroskaTag ( )
inline

Constructs a new tag.

Definition at line 86 of file matroskatag.h.

Member Function Documentation

◆ canEncodingBeUsed()

bool TagParser::MatroskaTag::canEncodingBeUsed ( TagTextEncoding  encoding) const
inlinevirtual

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 100 of file matroskatag.h.

◆ internallyGetFieldId()

MatroskaTag::IdentifierType TagParser::MatroskaTag::internallyGetFieldId ( KnownField  field) const
protected

Definition at line 20 of file matroskatag.cpp.

◆ internallyGetKnownField()

KnownField TagParser::MatroskaTag::internallyGetKnownField ( const IdentifierType id) const
protected

Definition at line 73 of file matroskatag.cpp.

◆ make()

void TagParser::MatroskaTag::make ( std::ostream &  stream,
Diagnostics diag 
)

Writes tag information to the specified stream (makes a "Tag"-element).

Exceptions
Throwsstd::ios_base::failure when an IO error occurs.
ThrowsMedia::Failure or a derived exception when a making error occurs.
See also
prepareMaking()
Todo:
Make inline in next major release.

Definition at line 160 of file matroskatag.cpp.

◆ parse()

void TagParser::MatroskaTag::parse ( EbmlElement tagElement,
Diagnostics diag 
)

Parses tag information from the specified tagElement.

Exceptions
Throwsstd::ios_base::failure when an IO error occurs.
ThrowsMedia::Failure or a derived exception when a parsing error occurs.

Definition at line 113 of file matroskatag.cpp.

◆ prepareMaking()

MatroskaTagMaker TagParser::MatroskaTag::prepareMaking ( Diagnostics diag)

Prepares making.

Returns
Returns a MatroskaTagMaker object which can be used to actually make the tag.
Remarks
The tag must NOT be mutated after making is prepared when it is intended to actually make the tag using the make() method of the returned object.
Exceptions
ThrowsMedia::Failure or a derived exception when a making error occurs.

This method might be useful when it is necessary to know the size of the tag before making it.

See also
make()
Todo:
Make inline in next major release.

Definition at line 147 of file matroskatag.cpp.

◆ supportsTarget()

bool TagParser::MatroskaTag::supportsTarget ( ) const
inlinevirtual

Returns an indication whether a target is supported by the tag.

If no target is supported, setting a target using setTarget() has no effect when saving the tag.

Most tag types don't support this feature so the default implementation returns always false. This might be overwritten when subclassing.

Reimplemented from TagParser::Tag.

Definition at line 90 of file matroskatag.h.

◆ targetLevel()

TagTargetLevel TagParser::MatroskaTag::targetLevel ( ) const
inlinevirtual

Returns the name of the current tag target level.

Remarks
Returns TagTargetLevel::Unspecified if target levels are not supported by the tag.

Reimplemented from TagParser::Tag.

Definition at line 95 of file matroskatag.h.

Friends And Related Function Documentation

◆ FieldMapBasedTag< MatroskaTag >

friend class FieldMapBasedTag< MatroskaTag >
friend

Definition at line 59 of file matroskatag.h.

Member Data Documentation

◆ defaultTextEncoding

constexpr TagTextEncoding TagParser::MatroskaTag::defaultTextEncoding = TagTextEncoding::Utf8
static

Definition at line 66 of file matroskatag.h.

◆ tagName

constexpr const char* TagParser::MatroskaTag::tagName = "Matroska tag"
static

Definition at line 65 of file matroskatag.h.

◆ tagType

constexpr TagType TagParser::MatroskaTag::tagType = TagType::MatroskaTag
static

Definition at line 64 of file matroskatag.h.


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