Tag Parser
12.5.3
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
Toggle main menu visibility
Loading...
Searching...
No Matches
matroska
matroskatagfield.h
Go to the documentation of this file.
1
#ifndef TAG_PARSER_MATROSKATAGFIELD_H
2
#define TAG_PARSER_MATROSKATAGFIELD_H
3
4
#include "
../generictagfield.h
"
5
6
namespace
TagParser
{
7
8
class
EbmlElement
;
9
class
MatroskaTagField
;
10
class
Diagnostics
;
11
15
template
<>
class
TAG_PARSER_EXPORT
TagFieldTraits
<
MatroskaTagField
> {
16
public
:
17
using
IdentifierType
= std::string;
18
using
TypeInfoType
= std::string;
19
static
bool
supportsNestedFields
();
20
};
21
25
inline
bool
TagFieldTraits<MatroskaTagField>::supportsNestedFields
()
26
{
27
return
true
;
28
}
29
30
class
TAG_PARSER_EXPORT
MatroskaTagFieldMaker {
31
friend
class
MatroskaTagField
;
32
33
public
:
34
void
make
(std::ostream &stream)
const
;
35
const
MatroskaTagField
&
field
()
const
;
36
std::uint64_t
requiredSize
()
const
;
37
38
private
:
39
MatroskaTagFieldMaker(
MatroskaTagField
&
field
,
Diagnostics
&diag);
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
54
inline
const
MatroskaTagField
&
MatroskaTagFieldMaker::field
()
const
55
{
56
return
m_field;
57
}
58
62
inline
std::uint64_t
MatroskaTagFieldMaker::requiredSize
()
const
63
{
64
return
m_totalSize;
65
}
66
67
class
TAG_PARSER_EXPORT
MatroskaTagField
:
public
TagField
<MatroskaTagField> {
68
friend
class
TagField
<
MatroskaTagField
>;
69
70
public
:
71
MatroskaTagField
();
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
88
inline
bool
MatroskaTagField::isAdditionalTypeInfoUsed
()
const
89
{
90
return
false
;
91
}
92
96
inline
bool
MatroskaTagField::supportsNestedFields
()
const
97
{
98
return
true
;
99
}
100
105
inline
std::string
MatroskaTagField::fieldIdFromString
(std::string_view idString)
106
{
107
return
std::string(idString);
108
}
109
114
inline
std::string
MatroskaTagField::fieldIdToString
(
const
std::string &
id
)
115
{
116
return
id
;
117
}
118
119
}
// namespace TagParser
120
121
#endif
// TAG_PARSER_MATROSKATAGFIELD_H
TagParser::Diagnostics
The Diagnostics class is a container for DiagMessage.
Definition
diagnostics.h:156
TagParser::EbmlElement
The EbmlElement class helps to parse EBML files such as Matroska files.
Definition
ebmlelement.h:32
TagParser::MatroskaTagFieldMaker
The MatroskaTagFieldMaker class helps making tag fields.
Definition
matroskatagfield.h:30
TagParser::MatroskaTagFieldMaker::field
const MatroskaTagField & field() const
Returns the associated field.
Definition
matroskatagfield.h:54
TagParser::MatroskaTagFieldMaker::make
void make(std::ostream &stream) const
Saves the field (specified when constructing the object) to the specified stream (makes a "SimpleTag"...
Definition
matroskatagfield.cpp:269
TagParser::MatroskaTagFieldMaker::requiredSize
std::uint64_t requiredSize() const
Returns number of bytes which will be written when making the field.
Definition
matroskatagfield.h:62
TagParser::MatroskaTagFieldMaker::MatroskaTagField
friend class MatroskaTagField
Definition
matroskatagfield.h:31
TagParser::MatroskaTagField
The MatroskaTagField class is used by MatroskaTag to store the fields.
Definition
matroskatagfield.h:67
TagParser::MatroskaTagField::normalizeId
static void normalizeId(std::string &id)
Ensures the specified id is upper-case as recommended by the Matroska spec.
Definition
matroskatagfield.cpp:193
TagParser::MatroskaTagField::reparse
void reparse(EbmlElement &simpleTagElement, Diagnostics &diag, bool parseNestedFields=true)
Parses field information from the specified EbmlElement.
Definition
matroskatagfield.cpp:47
TagParser::MatroskaTagField::prepareMaking
MatroskaTagFieldMaker prepareMaking(Diagnostics &diag)
Prepares making.
Definition
matroskatagfield.cpp:162
TagParser::MatroskaTagField::fieldIdToString
static std::string fieldIdToString(const std::string &id)
Returns the string representation for the specified id.
Definition
matroskatagfield.h:114
TagParser::MatroskaTagField::make
void make(std::ostream &stream, Diagnostics &diag)
Saves the field to the specified stream (makes a "SimpleTag" element).
Definition
matroskatagfield.cpp:184
TagParser::MatroskaTagField::fieldIdFromString
static std::string fieldIdFromString(std::string_view idString)
Converts the specified ID string representation to an actual ID.
Definition
matroskatagfield.h:105
TagParser::MatroskaTagField::supportsNestedFields
bool supportsNestedFields() const
Returns whether nested fields are supported.
Definition
matroskatagfield.h:96
TagParser::MatroskaTagField::MatroskaTagField
MatroskaTagField()
Constructs a new MatroskaTagField.
Definition
matroskatagfield.cpp:25
TagParser::MatroskaTagField::isAdditionalTypeInfoUsed
bool isAdditionalTypeInfoUsed() const
Returns whether the additional type info is used.
Definition
matroskatagfield.h:88
TagParser::TagFieldTraits< MatroskaTagField >::supportsNestedFields
static bool supportsNestedFields()
The MatroskaTagField supports nested fields.
Definition
matroskatagfield.h:25
TagParser::TagFieldTraits< MatroskaTagField >::TypeInfoType
std::string TypeInfoType
Definition
matroskatagfield.h:18
TagParser::TagFieldTraits< MatroskaTagField >::IdentifierType
std::string IdentifierType
Definition
matroskatagfield.h:17
TagParser::TagFieldTraits
Defines traits for the specified ImplementationType.
Definition
generictagfield.h:16
TagParser::TagField< MatroskaTagField >::TagField
TagField()
Definition
generictagfield.h:84
TagParser::TagField< MatroskaTagField >::id
IdentifierType & id()
Definition
generictagfield.h:116
TagParser::TagField< MatroskaTagField >::value
TagValue & value()
Definition
generictagfield.h:156
TagParser::TagValue
The TagValue class wraps values of different types.
Definition
tagvalue.h:147
generictagfield.h
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
Generated on
for Tag Parser by
1.18.0