Tag Parser: id3/id3v1tag.h Source File

Tag Parser 12.5.3 C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags

Loading...
Searching...
No Matches
id3v1tag.h
Go to the documentation of this file.
1#ifndef TAG_PARSER_ID3V1TAG_H
2#define TAG_PARSER_ID3V1TAG_H
3
4#include "../tag.h"
5
6namespace TagParser {
7
8class Diagnostics;
9
10 class TAG_PARSER_EXPORT Id3v1Tag final : public Tag {
11public:
12 Id3v1Tag();
13
14 static constexpr TagType tagType = TagType::Id3v1Tag;
15 static constexpr std::string_view tagName = "ID3v1 tag";
16 TagType type() const override;
17 std::string_view typeName() const override;
18 bool canEncodingBeUsed(TagTextEncoding encoding) const override;
19 const TagValue &value(KnownField value) const override;
20 bool setValue(KnownField field, const TagValue &value) override;
21 bool setValueConsideringTypeInfo(KnownField field, const TagValue &value, const std::string &typeInfo);
22 bool hasField(KnownField field) const override;
23 void removeAllFields() override;
24 std::size_t fieldCount() const override;
25 bool supportsField(KnownField field) const override;
26 void ensureTextValuesAreProperlyEncoded() override;
27
28 void parse(std::istream &sourceStream, Diagnostics &diag);
29 void make(std::ostream &targetStream, Diagnostics &diag);
30
31private:
32 void readValue(TagValue &value, std::size_t maxLength, const char *buffer);
33 void writeValue(const TagValue &value, std::size_t length, char *buffer, std::ostream &targetStream, Diagnostics &diag);
34
35 TagValue m_title;
36 TagValue m_artist;
37 TagValue m_album;
38 TagValue m_year;
39 TagValue m_comment;
40 TagValue m_trackPos;
41 TagValue m_genre;
42};
43
44} // namespace TagParser
45
46#endif // TAG_PARSER_ID3V1TAG_H
TagParser::Diagnostics
The Diagnostics class is a container for DiagMessage.
Definition diagnostics.h:156
TagParser::Id3v1Tag::Id3v1Tag
Id3v1Tag()
Constructs a new tag.
Definition id3v1tag.cpp:25
TagParser::Id3v1Tag::make
void make(std::ostream &targetStream, Diagnostics &diag)
Writes tag information to the specified stream.
Definition id3v1tag.cpp:93
TagParser::Id3v1Tag::ensureTextValuesAreProperlyEncoded
void ensureTextValuesAreProperlyEncoded() override
Ensures the encoding of all assigned text values is supported by the tag by converting the character ...
Definition id3v1tag.cpp:260
TagParser::Id3v1Tag::fieldCount
std::size_t fieldCount() const override
Returns the number of present fields.
Definition id3v1tag.cpp:233
TagParser::Id3v1Tag::canEncodingBeUsed
bool canEncodingBeUsed(TagTextEncoding encoding) const override
Returns only true for TagTextEncoding::Latin1.
Definition id3v1tag.cpp:47
TagParser::Id3v1Tag::hasField
bool hasField(KnownField field) const override
Returns an indication whether the specified field is present.
Definition id3v1tag.cpp:201
TagParser::Id3v1Tag::value
const TagValue & value(KnownField value) const override
Returns the value of the specified field.
Definition id3v1tag.cpp:144
TagParser::Id3v1Tag::supportsField
bool supportsField(KnownField field) const override
Returns an indication whether the specified field is supported by the tag.
Definition id3v1tag.cpp:244
TagParser::Id3v1Tag::removeAllFields
void removeAllFields() override
Removes all fields from the tag.
Definition id3v1tag.cpp:222
TagParser::Id3v1Tag::tagType
static constexpr TagType tagType
Definition id3v1tag.h:14
TagParser::Id3v1Tag::setValueConsideringTypeInfo
bool setValueConsideringTypeInfo(KnownField field, const TagValue &value, const std::string &typeInfo)
Definition id3v1tag.cpp:196
TagParser::Id3v1Tag::tagName
static constexpr std::string_view tagName
Definition id3v1tag.h:15
TagParser::Id3v1Tag::type
TagType type() const override
Returns the type of the tag as TagParser::TagType.
Definition id3v1tag.cpp:29
TagParser::Id3v1Tag::typeName
std::string_view typeName() const override
Returns the type name of the tag.
Definition id3v1tag.cpp:34
TagParser::Id3v1Tag::setValue
bool setValue(KnownField field, const TagValue &value) override
Assigns the given value to the specified field.
Definition id3v1tag.cpp:166
TagParser::Id3v1Tag::parse
void parse(std::istream &sourceStream, Diagnostics &diag)
Parses tag information from the specified stream.
Definition id3v1tag.cpp:58
TagParser::TagValue
The TagValue class wraps values of different types.
Definition tagvalue.h:147
TagParser::Tag::Tag
Tag()
Constructs a new Tag.
Definition tag.cpp:24
TAG_PARSER_EXPORT
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Definition global.h:14
TagParser
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10
TagParser::KnownField
KnownField
Specifies the field.
Definition tag.h:37
TagParser::TagTextEncoding
TagTextEncoding
Specifies the text encoding.
Definition tagvalue.h:29
TagParser::TagType
TagType
Specifies the tag type.
Definition tagtype.h:11
TagParser::TagType::Id3v1Tag
@ Id3v1Tag
Definition tagtype.h:13
tag.h