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

The Mp4TagField class is used by Mp4Tag to store the fields. More...

#include <mp4tagfield.h>

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

Public Member Functions

 Mp4TagField ()
 Constructs a new Mp4TagField. More...
 
 Mp4TagField (IdentifierType id, const TagValue &value)
 Constructs a new Mp4TagField with the specified id and value. More...
 
 Mp4TagField (const std::string &mean, const std::string &name, const TagValue &value)
 Constructs a new Mp4TagField with the specified mean, name and value. More...
 
void reparse (Mp4Atom &ilstChild, Diagnostics &diag)
 Parses field information from the specified Mp4Atom. More...
 
Mp4TagFieldMaker prepareMaking (Diagnostics &diag)
 Prepares making. More...
 
void make (std::ostream &stream, Diagnostics &diag)
 Saves the field to the specified stream. More...
 
bool isAdditionalTypeInfoUsed () const
 Returns whether the additional type info is used. More...
 
const std::string & name () const
 Returns the "name" for "extended" fields. More...
 
void setName (const std::string &name)
 Sets the "name" for the "extended" field. More...
 
const std::string & mean () const
 Returns the "mean" for "extended" fields. More...
 
void setMean (const std::string &mean)
 Sets the "mean" for the "extended" field. More...
 
std::uint32_t parsedRawDataType () const
 Returns the raw data type which has been determined when parsing. More...
 
std::uint16_t countryIndicator () const
 Returns the country indicator. More...
 
std::uint16_t languageIndicator () const
 Returns the language indicator. More...
 
bool supportsNestedFields () const
 Returns whether nested fields are supported. More...
 
std::vector< std::uint32_t > expectedRawDataTypes () const
 Returns the expected raw data types for the ID of the field. More...
 
std::uint32_t appropriateRawDataType () const
 Returns an appropriate raw data type. More...
 
- Public Member Functions inherited from TagParser::TagField< Mp4TagField >
 TagField ()
 Constructs an empty TagField. More...
 
 TagField (const IdentifierType &id, const TagValue &value)
 Constructs a new TagField with the specified id and value. More...
 
 ~TagField ()
 Destroys the TagField. More...
 
const IdentifierTypeid () const
 Returns the id of the current TagField. More...
 
std::string idToString () const
 
void setId (const IdentifierType &id)
 Sets the id of the current Tag Field. More...
 
void clearId ()
 Clears the id of the current TagField. More...
 
TagValuevalue ()
 Returns the value of the current TagField. More...
 
const TagValuevalue () const
 Returns the value of the current TagField. More...
 
void setValue (const TagValue &value)
 Sets the value of the current TagField. More...
 
void clearValue ()
 Clears the value of the current TagField. More...
 
const TypeInfoTypetypeInfo () const
 Returns the type info of the current TagField. More...
 
void setTypeInfo (const TypeInfoType &typeInfo)
 Sets the type info of the current TagField. More...
 
void removeTypeInfo ()
 Removes the type info from the current TagField. More...
 
bool isTypeInfoAssigned () const
 Returns an indication whether a type info is assigned. More...
 
bool isDefault () const
 Returns an indication whether the field is labeled as default. More...
 
void setDefault (bool isDefault)
 Sets whether the field is labeled as default. More...
 
void clear ()
 Clears id, value, type info, sets default flag to false and resets further implementation specific values. More...
 
bool isAdditionalTypeInfoUsed () const
 Returns an indication whether the additional type info is used. More...
 
const std::vector< Mp4TagField > & nestedFields () const
 Returns the nested fields. More...
 
std::vector< Mp4TagField > & nestedFields ()
 Returns the nested fields. More...
 
bool supportsNestedFields () const
 Returns whether nested fields are supported by the implementation. More...
 

Static Public Member Functions

static IdentifierType fieldIdFromString (const char *idString, std::size_t idStringSize=std::string::npos)
 Converts the specified ID string representation to an actual ID. More...
 
static std::string fieldIdToString (IdentifierType id)
 Returns the string representation for the specified id. More...
 

Friends

class TagField< Mp4TagField >
 

Additional Inherited Members

- Public Types inherited from TagParser::TagField< Mp4TagField >
using IdentifierType = typename TagFieldTraits< Mp4TagField >::IdentifierType
 
using TypeInfoType = typename TagFieldTraits< Mp4TagField >::TypeInfoType
 

Detailed Description

The Mp4TagField class is used by Mp4Tag to store the fields.

Definition at line 98 of file mp4tagfield.h.

Constructor & Destructor Documentation

◆ Mp4TagField() [1/3]

TagParser::Mp4TagField::Mp4TagField ( )

Constructs a new Mp4TagField.

Definition at line 29 of file mp4tagfield.cpp.

◆ Mp4TagField() [2/3]

TagParser::Mp4TagField::Mp4TagField ( IdentifierType  id,
const TagValue value 
)

Constructs a new Mp4TagField with the specified id and value.

Definition at line 39 of file mp4tagfield.cpp.

◆ Mp4TagField() [3/3]

TagParser::Mp4TagField::Mp4TagField ( const std::string &  mean,
const std::string &  name,
const TagValue value 
)

Constructs a new Mp4TagField with the specified mean, name and value.

The ID will be set to Mp4TagAtomIds::Extended indicating an tag field using the reverse DNS style.

See also
The last paragraph of Known iTunes Metadata Atoms gives additional information about this form of MP4 tag fields.

Definition at line 56 of file mp4tagfield.cpp.

Member Function Documentation

◆ appropriateRawDataType()

std::uint32_t TagParser::Mp4TagField::appropriateRawDataType ( ) const

Returns an appropriate raw data type.

Returns the type info if assigned; otherwise returns a raw data type considered as appropriate for the ID of the field. The latter is supposed to work for all supported tag fields IDs (those where a conversion to KnownField via Mp4Tag exists).

Definition at line 357 of file mp4tagfield.cpp.

◆ countryIndicator()

std::uint16_t TagParser::Mp4TagField::countryIndicator ( ) const
inline

Returns the country indicator.

Definition at line 185 of file mp4tagfield.h.

◆ expectedRawDataTypes()

std::vector< std::uint32_t > TagParser::Mp4TagField::expectedRawDataTypes ( ) const

Returns the expected raw data types for the ID of the field.

Definition at line 298 of file mp4tagfield.cpp.

◆ fieldIdFromString()

Mp4TagField::IdentifierType TagParser::Mp4TagField::fieldIdFromString ( const char *  idString,
std::size_t  idStringSize = std::string::npos 
)
inlinestatic

Converts the specified ID string representation to an actual ID.

Remarks
The specified idString is assumed to be UTF-8 encoded. In order to get the ©-sign correctly, it is converted to Latin-1.

Definition at line 211 of file mp4tagfield.h.

◆ fieldIdToString()

std::string TagParser::Mp4TagField::fieldIdToString ( IdentifierType  id)
inlinestatic

Returns the string representation for the specified id.

Remarks
The specified id is considered Latin-1 encoded. In order to get the ©-sign correctly, it is converted to UTF-8.

Definition at line 227 of file mp4tagfield.h.

◆ isAdditionalTypeInfoUsed()

bool TagParser::Mp4TagField::isAdditionalTypeInfoUsed ( ) const
inline

Returns whether the additional type info is used.

Definition at line 137 of file mp4tagfield.h.

◆ languageIndicator()

std::uint16_t TagParser::Mp4TagField::languageIndicator ( ) const
inline

Returns the language indicator.

Definition at line 193 of file mp4tagfield.h.

◆ make()

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

Saves the field to the specified stream.

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

Definition at line 290 of file mp4tagfield.cpp.

◆ mean()

const std::string & TagParser::Mp4TagField::mean ( ) const
inline

Returns the "mean" for "extended" fields.

Definition at line 161 of file mp4tagfield.h.

◆ name()

const std::string & TagParser::Mp4TagField::name ( ) const
inline

Returns the "name" for "extended" fields.

Definition at line 145 of file mp4tagfield.h.

◆ parsedRawDataType()

std::uint32_t TagParser::Mp4TagField::parsedRawDataType ( ) const
inline

Returns the raw data type which has been determined when parsing.

Definition at line 177 of file mp4tagfield.h.

◆ prepareMaking()

Mp4TagFieldMaker TagParser::Mp4TagField::prepareMaking ( Diagnostics diag)

Prepares making.

Returns
Returns a Mp4TagFieldMaker object which can be used to actually make the field.
Remarks
The field must NOT be mutated after making is prepared when it is intended to actually make the field using the make method of the returned object.
Exceptions
ThrowsTagParser::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 field before making it.

Definition at line 278 of file mp4tagfield.cpp.

◆ reparse()

void TagParser::Mp4TagField::reparse ( Mp4Atom ilstChild,
Diagnostics diag 
)

Parses field information from the specified Mp4Atom.

The specified atom should be a child atom of the "ilst" atom. Each child of the "ilst" atom holds one field of the Mp4Tag.

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

Definition at line 73 of file mp4tagfield.cpp.

◆ setMean()

void TagParser::Mp4TagField::setMean ( const std::string &  mean)
inline

Sets the "mean" for the "extended" field.

Definition at line 169 of file mp4tagfield.h.

◆ setName()

void TagParser::Mp4TagField::setName ( const std::string &  name)
inline

Sets the "name" for the "extended" field.

Definition at line 153 of file mp4tagfield.h.

◆ supportsNestedFields()

bool TagParser::Mp4TagField::supportsNestedFields ( ) const
inline

Returns whether nested fields are supported.

Definition at line 201 of file mp4tagfield.h.

Friends And Related Function Documentation

◆ TagField< Mp4TagField >

friend class TagField< Mp4TagField >
friend

Definition at line 79 of file mp4tagfield.h.


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