Tag Parser 12.4.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
Loading...
Searching...
No Matches
matroskatagfield.h
Go to the documentation of this file.
1#ifndef TAG_PARSER_MATROSKATAGFIELD_H
2#define TAG_PARSER_MATROSKATAGFIELD_H
3
5
6namespace TagParser {
7
8class EbmlElement;
9class MatroskaTagField;
10class Diagnostics;
11
16public:
17 using IdentifierType = std::string;
18 using TypeInfoType = std::string;
19 static bool supportsNestedFields();
20};
21
26{
27 return true;
28}
29
30class TAG_PARSER_EXPORT MatroskaTagFieldMaker {
31 friend class MatroskaTagField;
32
33public:
34 void make(std::ostream &stream) const;
35 const MatroskaTagField &field() const;
36 std::uint64_t requiredSize() const;
37
38private:
40
41 MatroskaTagField &m_field;
42 std::string m_stringValue;
43 const std::string &m_language;
44 const std::string &m_languageIETF;
45 std::uint64_t m_simpleTagSize;
46 std::uint64_t m_totalSize;
47 std::vector<MatroskaTagFieldMaker> m_nestedMaker;
48 bool m_isBinary;
49};
50
55{
56 return m_field;
57}
58
62inline std::uint64_t MatroskaTagFieldMaker::requiredSize() const
63{
64 return m_totalSize;
65}
66
67class TAG_PARSER_EXPORT MatroskaTagField : public TagField<MatroskaTagField> {
68 friend class TagField<MatroskaTagField>;
69
70public:
72 MatroskaTagField(const std::string &id, const TagValue &value);
73
74 void reparse(EbmlElement &simpleTagElement, Diagnostics &diag, bool parseNestedFields = true);
75 MatroskaTagFieldMaker prepareMaking(Diagnostics &diag);
76 void make(std::ostream &stream, Diagnostics &diag);
77 bool isAdditionalTypeInfoUsed() const;
78 bool supportsNestedFields() const;
79
80 static typename std::string fieldIdFromString(std::string_view idString);
81 static std::string fieldIdToString(const std::string &id);
82 static void normalizeId(std::string &id);
83};
84
89{
90 return false;
91}
92
97{
98 return true;
99}
100
105inline std::string MatroskaTagField::fieldIdFromString(std::string_view idString)
106{
107 return std::string(idString);
108}
109
114inline std::string MatroskaTagField::fieldIdToString(const std::string &id)
115{
116 return id;
117}
118
119} // namespace TagParser
120
121#endif // TAG_PARSER_MATROSKATAGFIELD_H
The Diagnostics class is a container for DiagMessage.
The EbmlElement class helps to parse EBML files such as Matroska files.
The MatroskaTagFieldMaker class helps making tag fields.
const MatroskaTagField & field() const
Returns the associated field.
std::uint64_t requiredSize() const
Returns number of bytes which will be written when making the field.
The MatroskaTagField class is used by MatroskaTag to store the fields.
static std::string fieldIdToString(const std::string &id)
Returns the string representation for the specified id.
static std::string fieldIdFromString(std::string_view idString)
Converts the specified ID string representation to an actual ID.
bool supportsNestedFields() const
Returns whether nested fields are supported.
bool isAdditionalTypeInfoUsed() const
Returns whether the additional type info is used.
Defines traits for the specified ImplementationType.
The TagField class is used by FieldMapBasedTag to store the fields.
The TagValue class wraps values of different types.
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Definition global.h:14
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10