Tag Parser 12.4.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
|
The Tag class is used to store, read and write tag information. More...
#include <tag.h>
Public Member Functions | |
virtual | ~Tag () |
Destroys the Tag. | |
virtual TagType | type () const |
Returns the type of the tag as TagParser::TagType. | |
virtual std::string_view | typeName () const |
Returns the type name of the tag as C-style string. | |
std::string | toString () const |
Returns a string representation of the tag. | |
virtual TagTextEncoding | proposedTextEncoding () const |
Returns the proposed text encoding. | |
virtual bool | canEncodingBeUsed (TagTextEncoding encoding) const |
Returns an indication whether the specified encoding can be used to provide string values for the tag. | |
virtual const TagValue & | value (KnownField field) const =0 |
Returns the value of the specified field. | |
virtual std::vector< const TagValue * > | values (KnownField field) const |
Returns the values of the specified field. | |
virtual bool | setValue (KnownField field, const TagValue &value)=0 |
Assigns the given value to the specified field. | |
virtual bool | setValues (KnownField field, const std::vector< TagValue > &values) |
Assigns the given values to the specified field. | |
virtual bool | hasField (KnownField field) const =0 |
Returns an indication whether the specified field is present. | |
virtual void | removeAllFields ()=0 |
Removes all fields from the tag. | |
const std::string & | version () const |
Returns the version of the tag as std::string. | |
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 std::size_t | fieldCount () const =0 |
Returns the number of present fields. | |
virtual bool | supportsField (KnownField field) const =0 |
Returns an indication whether the specified field is supported by the tag. | |
virtual TagDataType | proposedDataType (KnownField field) const |
Returns the proposed data type for the specified field as TagDataType. | |
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. | |
virtual bool | supportsMultipleValues (KnownField field) const |
Returns an indications whether the specified field supports multiple values. | |
virtual std::size_t | insertValues (const Tag &from, bool overwrite) |
Inserts all compatible values from another Tag. | |
virtual void | ensureTextValuesAreProperlyEncoded ()=0 |
Ensures the encoding of all assigned text values is supported by the tag by converting the character set if necessary. | |
Protected Member Functions | |
Tag () | |
Constructs a new Tag. | |
Protected Attributes | |
std::string | m_version |
std::uint64_t | m_size |
std::unique_ptr< TagPrivate > | m_p |
TagTarget | m_target |
The Tag class is used to store, read and write tag information.
The Tag class only provides the interface and common functionality. It is meant to be subclassed.This interface does not include parse/make methods to read/write a tag from/to a stream because the availability and signature of these methods may differ between the individual implementations (eg. an Mp4Tag is read from the "meta" Mp4Atom).
|
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.
Reimplemented in TagParser::Id3v1Tag, TagParser::Id3v2Tag, TagParser::MatroskaTag, TagParser::Mp4Tag, and TagParser::VorbisComment.
|
pure virtual |
Ensures the encoding of all assigned text values is supported by the tag by converting the character set if necessary.
Implemented in TagParser::FieldMapBasedTag< ImplementationType >, TagParser::FieldMapBasedTag< Id3v2Tag >, TagParser::FieldMapBasedTag< MatroskaTag >, TagParser::FieldMapBasedTag< Mp4Tag >, TagParser::FieldMapBasedTag< VorbisComment >, TagParser::Id3v1Tag, and TagParser::Id3v2Tag.
|
pure virtual |
Returns the number of present fields.
Implemented in TagParser::FieldMapBasedTag< ImplementationType >, TagParser::FieldMapBasedTag< Id3v2Tag >, TagParser::FieldMapBasedTag< MatroskaTag >, TagParser::FieldMapBasedTag< Mp4Tag >, TagParser::FieldMapBasedTag< VorbisComment >, and TagParser::Id3v1Tag.
|
pure virtual |
Returns an indication whether the specified field is present.
Implemented in TagParser::FieldMapBasedTag< ImplementationType >, TagParser::FieldMapBasedTag< Id3v2Tag >, TagParser::FieldMapBasedTag< MatroskaTag >, TagParser::FieldMapBasedTag< Mp4Tag >, TagParser::FieldMapBasedTag< VorbisComment >, TagParser::Id3v1Tag, and TagParser::Mp4Tag.
|
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 in TagParser::FieldMapBasedTag< ImplementationType >, TagParser::FieldMapBasedTag< Id3v2Tag >, TagParser::FieldMapBasedTag< MatroskaTag >, TagParser::FieldMapBasedTag< Mp4Tag >, and TagParser::FieldMapBasedTag< VorbisComment >.
|
inline |
|
inlinevirtual |
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.
Reimplemented in TagParser::FieldMapBasedTag< ImplementationType >, TagParser::FieldMapBasedTag< Id3v2Tag >, TagParser::FieldMapBasedTag< MatroskaTag >, TagParser::FieldMapBasedTag< Mp4Tag >, and TagParser::FieldMapBasedTag< VorbisComment >.
|
inlinevirtual |
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 in TagParser::FieldMapBasedTag< ImplementationType >, TagParser::FieldMapBasedTag< Id3v2Tag >, TagParser::FieldMapBasedTag< MatroskaTag >, TagParser::FieldMapBasedTag< Mp4Tag >, TagParser::FieldMapBasedTag< VorbisComment >, and TagParser::Id3v2Tag.
|
pure virtual |
Removes all fields from the tag.
Implemented in TagParser::FieldMapBasedTag< ImplementationType >, TagParser::FieldMapBasedTag< Id3v2Tag >, TagParser::FieldMapBasedTag< MatroskaTag >, TagParser::FieldMapBasedTag< Mp4Tag >, TagParser::FieldMapBasedTag< VorbisComment >, and TagParser::Id3v1Tag.
|
inline |
Sets the target of tag.
Most tag types don't support this feature so setting the target has no effect when saving the file.
|
pure virtual |
Assigns the given value to the specified field.
Implemented in TagParser::FieldMapBasedTag< ImplementationType >, TagParser::FieldMapBasedTag< Id3v2Tag >, TagParser::FieldMapBasedTag< MatroskaTag >, TagParser::FieldMapBasedTag< Mp4Tag >, TagParser::FieldMapBasedTag< VorbisComment >, TagParser::Id3v1Tag, TagParser::Mp4Tag, and TagParser::VorbisComment.
|
virtual |
Assigns the given values to the specified field.
Reimplemented in TagParser::FieldMapBasedTag< ImplementationType >, TagParser::FieldMapBasedTag< Id3v2Tag >, TagParser::FieldMapBasedTag< MatroskaTag >, TagParser::FieldMapBasedTag< Mp4Tag >, TagParser::FieldMapBasedTag< VorbisComment >, and TagParser::Mp4Tag.
|
inline |
Returns the size the tag within the file it is parsed from in bytes.
|
inlinevirtual |
Returns an indications whether the specified field supports descriptions.
Reimplemented in TagParser::Id3v2Tag.
|
pure virtual |
Returns an indication whether the specified field is supported by the tag.
Implemented in TagParser::FieldMapBasedTag< ImplementationType >, TagParser::FieldMapBasedTag< Id3v2Tag >, TagParser::FieldMapBasedTag< MatroskaTag >, TagParser::FieldMapBasedTag< Mp4Tag >, TagParser::FieldMapBasedTag< VorbisComment >, TagParser::Id3v1Tag, and TagParser::Mp4Tag.
|
inlinevirtual |
Returns an indications whether the specified field supports mime types.
Reimplemented in TagParser::Id3v2Tag.
|
inlinevirtual |
Returns an indications whether the specified field supports multiple values.
Reimplemented in TagParser::Id3v2Tag, TagParser::MatroskaTag, TagParser::Mp4Tag, and TagParser::VorbisComment.
|
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 in TagParser::MatroskaTag, and TagParser::OggVorbisComment.
|
inline |
Returns the target of tag.
|
inlinevirtual |
Returns the name of the current tag target level.
Reimplemented in TagParser::MatroskaTag.
|
inline |
|
inline |
string TagParser::Tag::toString | ( | ) | const |
|
inlinevirtual |
Returns the type of the tag as TagParser::TagType.
This is TagType::Unspecified by default and might be overwritten when subclassing.
Reimplemented in TagParser::FieldMapBasedTag< ImplementationType >, TagParser::FieldMapBasedTag< Id3v2Tag >, TagParser::FieldMapBasedTag< MatroskaTag >, TagParser::FieldMapBasedTag< Mp4Tag >, TagParser::FieldMapBasedTag< VorbisComment >, TagParser::Id3v1Tag, and TagParser::OggVorbisComment.
|
inlinevirtual |
Returns the type name of the tag as C-style string.
This is "unspecified" by default and might be overwritten when subclassing.
Reimplemented in TagParser::FieldMapBasedTag< ImplementationType >, TagParser::FieldMapBasedTag< Id3v2Tag >, TagParser::FieldMapBasedTag< MatroskaTag >, TagParser::FieldMapBasedTag< Mp4Tag >, TagParser::FieldMapBasedTag< VorbisComment >, TagParser::Id3v1Tag, and TagParser::OggVorbisComment.
|
pure virtual |
Returns the value of the specified field.
Implemented in TagParser::FieldMapBasedTag< ImplementationType >, TagParser::FieldMapBasedTag< Id3v2Tag >, TagParser::FieldMapBasedTag< MatroskaTag >, TagParser::FieldMapBasedTag< Mp4Tag >, TagParser::FieldMapBasedTag< VorbisComment >, TagParser::Id3v1Tag, TagParser::Mp4Tag, and TagParser::VorbisComment.
|
virtual |
Returns the values of the specified field.
Reimplemented in TagParser::FieldMapBasedTag< ImplementationType >, TagParser::FieldMapBasedTag< Id3v2Tag >, TagParser::FieldMapBasedTag< MatroskaTag >, TagParser::FieldMapBasedTag< Mp4Tag >, TagParser::FieldMapBasedTag< VorbisComment >, and TagParser::Mp4Tag.
|
inline |
|
protected |