Tag Parser 12.4.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
Loading...
Searching...
No Matches
matroskaeditionentry.cpp
Go to the documentation of this file.
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
13using namespace std;
14using namespace CppUtilities;
15
16namespace TagParser {
17
27 : m_editionEntryElement(editionEntryElement)
28 , m_id(0)
29 , m_hidden(false)
30 , m_default(false)
31 , m_ordered(false)
32{
33}
34
41
46{
47 return argsToString("ID: ", id());
48}
49
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()) {
68 m_id = entryChild->readUInteger();
69 break;
71 m_hidden = entryChild->readUInteger() == 1;
72 break;
74 m_default = entryChild->readUInteger() == 1;
75 break;
77 m_ordered = entryChild->readUInteger() == 1;
78 break;
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
97{
98 progress.stopIfAborted();
99 parse(diag);
100 for (auto &chapter : chapters()) {
101 chapter->parseNested(diag, progress);
102 }
103}
104
109{
110 m_id = 0;
111 m_hidden = m_default = m_ordered = false;
112 m_chapters.clear();
113}
114
115} // namespace TagParser
The AbortableProgressFeedback class provides feedback about an ongoing operation via callbacks.
void stopIfAborted() const
Throws an OperationAbortedException if aborted.
The Diagnostics class is a container for DiagMessage.
The EbmlElement class helps to parse EBML files such as Matroska files.
std::string idToString() const
Converts the specified EBML ID to a printable string.
Definition ebmlelement.h:71
std::uint64_t readUInteger()
Reads the content of the element as unsigned integer.
const IdentifierType & id() const
Returns the element ID.
ImplementationType * nextSibling()
Returns the next sibling of the element.
ImplementationType * firstChild()
Returns the first child of the element.
void parse(Diagnostics &diag)
Parses the header information of the element which is read from the related stream at the start offse...
void clear()
Resets the object to its initial state.
std::string label() const
Returns a label for the entry.
const std::vector< std::unique_ptr< MatroskaChapter > > & chapters() const
Returns the chapters the edition contains.
MatroskaEditionEntry(EbmlElement *editionEntryElement)
Constructs a new MatroskaEditionEntry for the specified editionEntryElement.
void parse(Diagnostics &diag)
Parses the "EditionEntry"-element specified when constructing the object.
void parseNested(Diagnostics &diag, AbortableProgressFeedback &progress)
Parses the "EditionEntry"-element specified when constructing the object.
~MatroskaEditionEntry()
Destroys the MatroskaEditionEntry.
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10