Tag Parser 12.4.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
|
Implementation of TagParser::Tag for ID3v1 tags. More...
#include <id3v1tag.h>
Public Member Functions | |
Id3v1Tag () | |
Constructs a new tag. | |
TagType | type () const override |
Returns the type of the tag as TagParser::TagType. | |
std::string_view | typeName () const override |
Returns the type name of the tag as C-style string. | |
bool | canEncodingBeUsed (TagTextEncoding encoding) const override |
Returns only true for TagTextEncoding::Latin1. | |
const TagValue & | value (KnownField value) 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. | |
bool | setValueConsideringTypeInfo (KnownField field, const TagValue &value, const std::string &typeInfo) |
bool | hasField (KnownField field) const override |
Returns an indication whether the specified field is present. | |
void | removeAllFields () override |
Removes all fields from the tag. | |
std::size_t | fieldCount () const override |
Returns the number of present fields. | |
bool | supportsField (KnownField field) const override |
Returns an indication whether the specified field is supported by the tag. | |
void | ensureTextValuesAreProperlyEncoded () override |
Ensures the encoding of all assigned text values is supported by the tag by converting the character set if necessary. | |
void | parse (std::istream &sourceStream, Diagnostics &diag) |
Parses tag information from the specified stream. | |
void | make (std::ostream &targetStream, Diagnostics &diag) |
Writes tag information to the specified stream. | |
Public Member Functions inherited from TagParser::Tag | |
virtual | ~Tag () |
Destroys the Tag. | |
std::string | toString () const |
Returns a string representation of the tag. | |
virtual TagTextEncoding | proposedTextEncoding () const |
Returns the proposed text encoding. | |
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 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 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. | |
Static Public Attributes | |
static constexpr TagType | tagType = TagType::Id3v1Tag |
static constexpr std::string_view | tagName = "ID3v1 tag" |
Additional Inherited Members | |
Protected Member Functions inherited from TagParser::Tag | |
Tag () | |
Constructs a new Tag. | |
Protected Attributes inherited from TagParser::Tag | |
std::string | m_version |
std::uint64_t | m_size |
std::unique_ptr< TagPrivate > | m_p |
TagTarget | m_target |
Implementation of TagParser::Tag for ID3v1 tags.
TagParser::Id3v1Tag::Id3v1Tag | ( | ) |
Constructs a new tag.
Definition at line 25 of file id3v1tag.cpp.
|
overridevirtual |
Returns only true for TagTextEncoding::Latin1.
Reimplemented from TagParser::Tag.
Definition at line 47 of file id3v1tag.cpp.
|
overridevirtual |
Ensures the encoding of all assigned text values is supported by the tag by converting the character set if necessary.
Implements TagParser::Tag.
Definition at line 260 of file id3v1tag.cpp.
|
overridevirtual |
Returns the number of present fields.
Implements TagParser::Tag.
Definition at line 233 of file id3v1tag.cpp.
|
overridevirtual |
Returns an indication whether the specified field is present.
Implements TagParser::Tag.
Definition at line 201 of file id3v1tag.cpp.
void TagParser::Id3v1Tag::make | ( | std::ostream & | targetStream, |
Diagnostics & | diag ) |
Writes tag information to the specified stream.
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 93 of file id3v1tag.cpp.
void TagParser::Id3v1Tag::parse | ( | std::istream & | stream, |
Diagnostics & | diag ) |
Parses tag information from the specified stream.
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 58 of file id3v1tag.cpp.
|
overridevirtual |
Removes all fields from the tag.
Implements TagParser::Tag.
Definition at line 222 of file id3v1tag.cpp.
|
overridevirtual |
Assigns the given value to the specified field.
Implements TagParser::Tag.
Definition at line 166 of file id3v1tag.cpp.
bool TagParser::Id3v1Tag::setValueConsideringTypeInfo | ( | KnownField | field, |
const TagValue & | value, | ||
const std::string & | typeInfo ) |
Definition at line 196 of file id3v1tag.cpp.
|
overridevirtual |
Returns an indication whether the specified field is supported by the tag.
Implements TagParser::Tag.
Definition at line 244 of file id3v1tag.cpp.
|
overridevirtual |
Returns the type of the tag as TagParser::TagType.
This is TagType::Unspecified by default and might be overwritten when subclassing.
Reimplemented from TagParser::Tag.
Definition at line 29 of file id3v1tag.cpp.
|
overridevirtual |
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 34 of file id3v1tag.cpp.
|
overridevirtual |
Returns the value of the specified field.
Implements TagParser::Tag.
Definition at line 144 of file id3v1tag.cpp.
|
staticconstexpr |
Definition at line 15 of file id3v1tag.h.
|
staticconstexpr |
Definition at line 14 of file id3v1tag.h.