Tag Parser
7.0.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
|
#include <fieldbasedtag.h>
Public Types | |
typedef FieldMapBasedTagTraits< ImplementationType >::FieldType | FieldType |
typedef FieldMapBasedTagTraits< ImplementationType >::FieldType::IdentifierType | IdentifierType |
typedef FieldMapBasedTagTraits< ImplementationType >::Compare | Compare |
Public Member Functions | |
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 TagValue & | value (const IdentifierType &id) const |
Returns the value of the field with the specified id. More... | |
const TagValue & | value (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... | |
int | insertFields (const FieldMapBasedTag< ImplementationType > &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... | |
virtual TagDataType | proposedDataType (KnownField field) const |
Returns the proposed data type for the specified field as TagDataType. More... | |
![]() | |
virtual | ~Tag () |
Destroys the Tag. More... | |
std::string | toString () const |
Returns a string representation of the tag. More... | |
virtual bool | canEncodingBeUsed (TagTextEncoding encoding) const |
Returns an indication whether the specified encoding can be used to provide string values for 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... | |
virtual bool | supportsTarget () const |
Returns an indication whether a target is supported by the tag. More... | |
const TagTarget & | target () const |
Returns the target of tag. More... | |
void | setTarget (const TagTarget &target) |
Sets the target of tag. More... | |
virtual TagTargetLevel | targetLevel () const |
Returns the name of the current tag target level. 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... | |
Protected Member Functions | |
const TagValue & | internallyGetValue (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... | |
![]() | |
Tag () | |
Constructs a new Tag. More... | |
Friends | |
class | FieldMapBasedTagTraits< ImplementationType > |
Additional Inherited Members | |
![]() | |
std::string | m_version |
uint32 | m_size |
TagTarget | m_target |
Definition at line 31 of file fieldbasedtag.h.
typedef FieldMapBasedTagTraits<ImplementationType>::Compare TagParser::FieldMapBasedTag< ImplementationType >::Compare |
Definition at line 37 of file fieldbasedtag.h.
typedef FieldMapBasedTagTraits<ImplementationType>::FieldType TagParser::FieldMapBasedTag< ImplementationType >::FieldType |
Definition at line 35 of file fieldbasedtag.h.
typedef FieldMapBasedTagTraits<ImplementationType>::FieldType::IdentifierType TagParser::FieldMapBasedTag< ImplementationType >::IdentifierType |
Definition at line 36 of file fieldbasedtag.h.
TagParser::FieldMapBasedTag< ImplementationType >::FieldMapBasedTag | ( | ) |
Constructs a new FieldMapBasedTag.
Definition at line 96 of file fieldbasedtag.h.
|
virtual |
Ensures the encoding of all assigned text values is supported by the tag by converting the character set if neccessary.
Implements TagParser::Tag.
Definition at line 382 of file fieldbasedtag.h.
|
virtual |
Returns the number of present fields.
Implements TagParser::Tag.
Definition at line 281 of file fieldbasedtag.h.
|
inline |
Returns the ID for the specified field.
Returns the field ID for the specified value.
Needs to be implemented when subclassing.
Definition at line 297 of file fieldbasedtag.h.
|
inline |
Returns the fields of the tag by providing direct access to the field map of the tag.
Definition at line 268 of file fieldbasedtag.h.
|
inline |
Returns the fields of the tag by providing direct access to the field map of the tag.
Definition at line 276 of file fieldbasedtag.h.
|
inlinevirtual |
Returns an indication whether the specified field is present.
Implements TagParser::Tag.
Definition at line 232 of file fieldbasedtag.h.
|
inline |
Returns an indication whether the field with the specified id is present.
Definition at line 254 of file fieldbasedtag.h.
int TagParser::FieldMapBasedTag< ImplementationType >::insertFields | ( | const FieldMapBasedTag< ImplementationType > & | from, |
bool | overwrite | ||
) |
Inserts all fields from another tag of the same field type and compare function.
from | Specifies the tag the fields should be inserted from. |
overwrite | Indicates whether existing fields should be overwritten. |
Definition at line 342 of file fieldbasedtag.h.
|
virtual |
Inserts all compatible values from another Tag.
from | Specifies the Tag the values should be inserted from. |
overwrite | Indicates whether existing values should be overwritten. |
Reimplemented from TagParser::Tag.
Definition at line 372 of file fieldbasedtag.h.
|
inlineprotected |
Default implementation for proposedDataType().
Definition at line 322 of file fieldbasedtag.h.
|
protected |
Default implementation for value().
Definition at line 119 of file fieldbasedtag.h.
|
protected |
Default implementation for hasField().
Definition at line 241 of file fieldbasedtag.h.
|
protected |
Default implementation for setValue().
Definition at line 169 of file fieldbasedtag.h.
|
inline |
Returns the field for the specified ID.
Returns the KnownField for the specified id.
Needs to be implemented when subclassing.
Definition at line 306 of file fieldbasedtag.h.
|
inline |
Returns the proposed data type for the specified field as TagDataType.
Most values need to be provided as string (see proposedTextEncoding() and canEncodingBeUsed()). Other values need to be provided as integer or an other TagDataType. This method helps to determine which type is required for a particular field. The tag class and its subclasses try to convert the provided values. Nevertheless it is recommend to use the proposed data types to avoid conversion failures.
The default implementation returns a data type which is most commonly used for the specified field. The default implementation might be overwritten when subclassing.
|
inline |
Returns the proposed data type for the field with the specified id.
Definition at line 330 of file fieldbasedtag.h.
|
virtual |
Returns the proposed text encoding.
This is TagTextEncoding::Latin1 by default an 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 returns such an encoding.
Reimplemented from TagParser::Tag.
Definition at line 110 of file fieldbasedtag.h.
|
inlinevirtual |
Removes all fields from the tag.
Implements TagParser::Tag.
Definition at line 259 of file fieldbasedtag.h.
bool TagParser::FieldMapBasedTag< ImplementationType >::setValue | ( | const IdentifierType & | id, |
const TagValue & | value | ||
) |
Assigns the given value to the field with the specified id.
Definition at line 186 of file fieldbasedtag.h.
|
inlinevirtual |
Assigns the given value to the specified field.
Implements TagParser::Tag.
Definition at line 160 of file fieldbasedtag.h.
bool TagParser::FieldMapBasedTag< ImplementationType >::setValues | ( | const IdentifierType & | id, |
const std::vector< TagValue > & | values | ||
) |
Assigns the given values to the field with the specified id.
Definition at line 198 of file fieldbasedtag.h.
|
virtual |
Assigns the given values to the field with the specified id.
Reimplemented from TagParser::Tag.
Definition at line 227 of file fieldbasedtag.h.
|
inlinevirtual |
Returns an indication whether the specified field is supported by the tag.
Implements TagParser::Tag.
Definition at line 311 of file fieldbasedtag.h.
|
virtual |
Returns the type of the tag as Media::TagType.
This is TagType::Unspecified by default and might be overwritten when subclassing.
Reimplemented from TagParser::Tag.
Definition at line 100 of file fieldbasedtag.h.
|
virtual |
Returns the type name of the tag as C-style string.
This is "unspecified" by default and might be overwritten when subclassing.
Reimplemented from TagParser::Tag.
Definition at line 105 of file fieldbasedtag.h.
|
inline |
Returns the value of the field with the specified id.
Definition at line 129 of file fieldbasedtag.h.
|
inlinevirtual |
Returns the value of the specified field.
Implements TagParser::Tag.
Definition at line 134 of file fieldbasedtag.h.
|
inline |
Returns the values of the field with the specified id.
Definition at line 143 of file fieldbasedtag.h.
|
inlinevirtual |
Returns the values of the specified field.
Reimplemented from TagParser::Tag.
Definition at line 155 of file fieldbasedtag.h.
|
friend |
Definition at line 32 of file fieldbasedtag.h.