Tag Parser 11.4.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
abstractchapter.cpp
Go to the documentation of this file.
1#include "./abstractchapter.h"
3
4#include <sstream>
5
6using namespace std;
7using namespace CppUtilities;
8
9namespace TagParser {
10
20 : m_id(0)
21 , m_startTime(-1)
22 , m_endTime(-1)
23 , m_hidden(false)
24 , m_enabled(true)
25{
26}
27
32{
33}
34
39{
40 stringstream ss;
41 ss << "ID: " << id();
42 if (!names().empty()) {
43 ss << ", name: \"" << names().front() << "\"";
44 }
45 if (!startTime().isNegative()) {
46 ss << ", start: " << startTime().toString(TimeSpanOutputFormat::WithMeasures);
47 }
48 return ss.str();
49}
50
55{
56 m_id = 0;
57 m_names.clear();
59 m_tracks.clear();
60 m_hidden = false;
61 m_enabled = true;
62}
63
72{
73 clear();
74 internalParse(diag, progress);
75}
76
83{
84 progress.stopIfAborted();
85 clear();
86 internalParse(diag, progress);
87 for (size_t i = 0, count = nestedChapterCount(); i < count; ++i) {
88 nestedChapter(i)->parseNested(diag, progress);
89 }
90}
91
102} // namespace TagParser
The AbortableProgressFeedback class provides feedback about an ongoing operation via callbacks.
void stopIfAborted() const
Throws an OperationAbortedException if aborted.
void parseNested(Diagnostics &diag, AbortableProgressFeedback &progress)
Parses the chapter and nested chapters recursively.
virtual void internalParse(Diagnostics &diag, AbortableProgressFeedback &progress)=0
Internally called to parse the chapter.
virtual std::size_t nestedChapterCount() const
Returns the number of nested chapters.
const std::vector< LocaleAwareString > & names() const
Returns the chapter name.
std::vector< std::uint64_t > m_tracks
CppUtilities::TimeSpan m_endTime
CppUtilities::TimeSpan m_startTime
void parse(Diagnostics &diag, AbortableProgressFeedback &progress)
Parses the chapter.
virtual void clear()
Resets the object to its initial state.
std::string label() const
Returns a label for the chapter.
CppUtilities::TimeSpan startTime() const
Returns the start time if known; otherwise returns a negative time span.
virtual AbstractChapter * nestedChapter(std::size_t index)
Returns the nested chapter with the specified index.
std::uint64_t id() const
Returns the chapter ID if known; otherwise returns zero.
AbstractChapter()
Constructs a new chapter.
virtual ~AbstractChapter()
Destroys the chapter.
std::vector< LocaleAwareString > m_names
The Diagnostics class is a container for DiagMessage.
Definition: diagnostics.h:156
Contains all classes and functions of the TagInfo library.
Definition: aaccodebook.h:10