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
matroskaeditionentry.cpp
Go to the documentation of this file.
1
#include "
./matroskaeditionentry.h
"
2
#include "
./ebmlelement.h
"
3
#include "
./matroskaid.h
"
4
5
#include "
../diagnostics.h
"
6
7
#include <c++utilities/conversion/stringbuilder.h>
8
#include <c++utilities/conversion/stringconversion.h>
9
10
#include <memory>
11
#include <string>
12
13
using namespace
std;
14
using namespace
CppUtilities
;
15
16
namespace
TagParser
{
17
22
26
MatroskaEditionEntry::MatroskaEditionEntry
(
EbmlElement
*
editionEntryElement
)
27
: m_editionEntryElement(
editionEntryElement
)
28
, m_id(0)
29
, m_hidden(false)
30
, m_default(false)
31
, m_ordered(false)
32
{
33
}
34
38
MatroskaEditionEntry::~MatroskaEditionEntry
()
39
{
40
}
41
45
string
MatroskaEditionEntry::label
()
const
46
{
47
return
argsToString(
"ID: "
,
id
());
48
}
49
57
void
MatroskaEditionEntry::parse
(
Diagnostics
&diag)
58
{
59
// clear previous values and status
60
static
const
string
context(
"parsing \"EditionEntry\"-element"
);
61
clear
();
62
// iterate through children of "EditionEntry"-element
63
EbmlElement
*entryChild = m_editionEntryElement->
firstChild
();
64
while
(entryChild) {
65
entryChild->
parse
(diag);
66
switch
(entryChild->
id
()) {
67
case
MatroskaIds::EditionUID
:
68
m_id = entryChild->
readUInteger
();
69
break
;
70
case
MatroskaIds::EditionFlagHidden
:
71
m_hidden = entryChild->
readUInteger
() == 1;
72
break
;
73
case
MatroskaIds::EditionFlagDefault
:
74
m_default = entryChild->
readUInteger
() == 1;
75
break
;
76
case
MatroskaIds::EditionFlagOrdered
:
77
m_ordered = entryChild->
readUInteger
() == 1;
78
break
;
79
case
MatroskaIds::ChapterAtom
:
80
m_chapters.emplace_back(make_unique<MatroskaChapter>(entryChild));
81
break
;
82
default
:
83
diag.emplace_back(
DiagLevel::Warning
,
84
"\"EditionEntry\"-element contains unknown child element \""
% entryChild->
idToString
() +
"\" which will be ignored."
, context);
85
}
86
entryChild = entryChild->
nextSibling
();
87
}
88
}
89
96
void
MatroskaEditionEntry::parseNested
(
Diagnostics
&diag,
AbortableProgressFeedback
&progress)
97
{
98
progress.
stopIfAborted
();
99
parse
(diag);
100
for
(
auto
&chapter :
chapters
()) {
101
chapter->parseNested(diag, progress);
102
}
103
}
104
108
void
MatroskaEditionEntry::clear
()
109
{
110
m_id = 0;
111
m_hidden = m_default = m_ordered =
false
;
112
m_chapters.clear();
113
}
114
115
}
// namespace TagParser
TagParser::AbortableProgressFeedback
The AbortableProgressFeedback class provides feedback about an ongoing operation via callbacks.
Definition
progressfeedback.h:186
TagParser::AbortableProgressFeedback::stopIfAborted
void stopIfAborted() const
Throws an OperationAbortedException if aborted.
Definition
progressfeedback.h:255
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::EbmlElement::idToString
std::string idToString() const
Converts the specified EBML ID to a printable string.
Definition
ebmlelement.h:71
TagParser::EbmlElement::readUInteger
std::uint64_t readUInteger()
Reads the content of the element as unsigned integer.
Definition
ebmlelement.cpp:238
TagParser::GenericFileElement::id
const IdentifierType & id() const
Returns the element ID.
Definition
genericfileelement.h:283
TagParser::GenericFileElement::nextSibling
ImplementationType * nextSibling()
Returns the next sibling of the element.
Definition
genericfileelement.h:439
TagParser::GenericFileElement::firstChild
ImplementationType * firstChild()
Returns the first child of the element.
Definition
genericfileelement.h:465
TagParser::GenericFileElement::parse
void parse(Diagnostics &diag)
Parses the header information of the element which is read from the related stream at the start offse...
Definition
genericfileelement.h:779
TagParser::MatroskaEditionEntry::clear
void clear()
Resets the object to its initial state.
Definition
matroskaeditionentry.cpp:108
TagParser::MatroskaEditionEntry::editionEntryElement
EbmlElement * editionEntryElement() const
Returns the "EditionEntry"-element specified when constructing the object.
Definition
matroskaeditionentry.h:39
TagParser::MatroskaEditionEntry::label
std::string label() const
Returns a label for the entry.
Definition
matroskaeditionentry.cpp:45
TagParser::MatroskaEditionEntry::chapters
const std::vector< std::unique_ptr< MatroskaChapter > > & chapters() const
Returns the chapters the edition contains.
Definition
matroskaeditionentry.h:79
TagParser::MatroskaEditionEntry::MatroskaEditionEntry
MatroskaEditionEntry(EbmlElement *editionEntryElement)
Constructs a new MatroskaEditionEntry for the specified editionEntryElement.
Definition
matroskaeditionentry.cpp:26
TagParser::MatroskaEditionEntry::parse
void parse(Diagnostics &diag)
Parses the "EditionEntry"-element specified when constructing the object.
Definition
matroskaeditionentry.cpp:57
TagParser::MatroskaEditionEntry::parseNested
void parseNested(Diagnostics &diag, AbortableProgressFeedback &progress)
Parses the "EditionEntry"-element specified when constructing the object.
Definition
matroskaeditionentry.cpp:96
TagParser::MatroskaEditionEntry::~MatroskaEditionEntry
~MatroskaEditionEntry()
Destroys the MatroskaEditionEntry.
Definition
matroskaeditionentry.cpp:38
diagnostics.h
ebmlelement.h
matroskaeditionentry.h
matroskaid.h
CppUtilities
Definition
abstractcontainer.h:16
TagParser::MatroskaIds::ChapterAtom
@ ChapterAtom
Definition
matroskaid.h:306
TagParser::MatroskaIds::EditionFlagDefault
@ EditionFlagDefault
Definition
matroskaid.h:304
TagParser::MatroskaIds::EditionFlagOrdered
@ EditionFlagOrdered
Definition
matroskaid.h:305
TagParser::MatroskaIds::EditionUID
@ EditionUID
Definition
matroskaid.h:302
TagParser::MatroskaIds::EditionFlagHidden
@ EditionFlagHidden
Definition
matroskaid.h:303
TagParser
Contains all classes and functions of the TagInfo library.
Definition
aaccodebook.h:10
TagParser::DiagLevel::Warning
@ Warning
Definition
diagnostics.h:20
Generated on
for Tag Parser by
1.18.0