Tag Parser: abstractchapter.h Source File

Tag Parser 12.5.2 C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags

Loading...
Searching...
No Matches
abstractchapter.h
Go to the documentation of this file.
1#ifndef TAG_PARSER_ABSTRACTCHAPTER_H
2#define TAG_PARSER_ABSTRACTCHAPTER_H
3
4#include "./localeawarestring.h"
5
6#include <c++utilities/chrono/timespan.h>
7
8#include <memory>
9#include <string>
10#include <vector>
11
12namespace TagParser {
13
14class AbortableProgressFeedback;
15class Diagnostics;
16struct AbstractChapterPrivate;
17
18 class TAG_PARSER_EXPORT AbstractChapter {
19public:
20 virtual ~AbstractChapter();
21
22 std::uint64_t id() const;
23 const std::vector<LocaleAwareString> &names() const;
24 CppUtilities::TimeSpan startTime() const;
25 CppUtilities::TimeSpan endTime() const;
26 const std::vector<std::uint64_t> &tracks() const;
27 bool isHidden() const;
28 bool isEnabled() const;
29 std::string label() const;
30 virtual AbstractChapter *nestedChapter(std::size_t index);
31 virtual const AbstractChapter *nestedChapter(std::size_t index) const;
32 virtual std::size_t nestedChapterCount() const;
33 virtual void clear();
34 void parse(Diagnostics &diag, AbortableProgressFeedback &progress);
35 void parseNested(Diagnostics &diag, AbortableProgressFeedback &progress);
36
37protected:
38 AbstractChapter();
39 virtual void internalParse(Diagnostics &diag, AbortableProgressFeedback &progress) = 0;
40
41 std::uint64_t m_id;
42 std::vector<LocaleAwareString> m_names;
43 CppUtilities::TimeSpan m_startTime;
44 CppUtilities::TimeSpan m_endTime;
45 std::vector<std::uint64_t> m_tracks;
46 std::unique_ptr<AbstractChapterPrivate> m_p;
47 bool m_hidden;
48 bool m_enabled;
49};
50
54 inline std::uint64_t AbstractChapter::id() const
55{
56 return m_id;
57}
58
62 inline const std::vector<LocaleAwareString> &AbstractChapter::names() const
63{
64 return m_names;
65}
66
70 inline CppUtilities::TimeSpan AbstractChapter::startTime() const
71{
72 return m_startTime;
73}
74
78 inline CppUtilities::TimeSpan AbstractChapter::endTime() const
79{
80 return m_endTime;
81}
82
86 inline const std::vector<std::uint64_t> &AbstractChapter::tracks() const
87{
88 return m_tracks;
89}
90
94 inline bool AbstractChapter::isHidden() const
95{
96 return m_hidden;
97}
98
102 inline bool AbstractChapter::isEnabled() const
103{
104 return m_enabled;
105}
106
110 inline AbstractChapter *AbstractChapter::nestedChapter(std::size_t)
111{
112 return nullptr;
113}
114
118 inline const AbstractChapter *AbstractChapter::nestedChapter(std::size_t) const
119{
120 return nullptr;
121}
122
126 inline std::size_t AbstractChapter::nestedChapterCount() const
127{
128 return 0;
129}
130
131} // namespace TagParser
132
133#endif // TAG_PARSER_ABSTRACTCHAPTER_H
TagParser::AbortableProgressFeedback
The AbortableProgressFeedback class provides feedback about an ongoing operation via callbacks.
Definition progressfeedback.h:186
TagParser::AbstractChapter::m_p
std::unique_ptr< AbstractChapterPrivate > m_p
Definition abstractchapter.h:46
TagParser::AbstractChapter::m_enabled
bool m_enabled
Definition abstractchapter.h:48
TagParser::AbstractChapter::endTime
CppUtilities::TimeSpan endTime() const
Returns the end time if known; otherwise returns a negative time span.
Definition abstractchapter.h:78
TagParser::AbstractChapter::parseNested
void parseNested(Diagnostics &diag, AbortableProgressFeedback &progress)
Parses the chapter and nested chapters recursively.
Definition abstractchapter.cpp:85
TagParser::AbstractChapter::nestedChapterCount
virtual std::size_t nestedChapterCount() const
Returns the number of nested chapters.
Definition abstractchapter.h:126
TagParser::AbstractChapter::m_id
std::uint64_t m_id
Definition abstractchapter.h:41
TagParser::AbstractChapter::names
const std::vector< LocaleAwareString > & names() const
Returns the chapter name.
Definition abstractchapter.h:62
TagParser::AbstractChapter::m_tracks
std::vector< std::uint64_t > m_tracks
Definition abstractchapter.h:45
TagParser::AbstractChapter::internalParse
virtual void internalParse(Diagnostics &diag, AbortableProgressFeedback &progress)=0
Internally called to parse the chapter.
TagParser::AbstractChapter::m_endTime
CppUtilities::TimeSpan m_endTime
Definition abstractchapter.h:44
TagParser::AbstractChapter::m_hidden
bool m_hidden
Definition abstractchapter.h:47
TagParser::AbstractChapter::m_startTime
CppUtilities::TimeSpan m_startTime
Definition abstractchapter.h:43
TagParser::AbstractChapter::parse
void parse(Diagnostics &diag, AbortableProgressFeedback &progress)
Parses the chapter.
Definition abstractchapter.cpp:74
TagParser::AbstractChapter::clear
virtual void clear()
Resets the object to its initial state.
Definition abstractchapter.cpp:57
TagParser::AbstractChapter::label
std::string label() const
Returns a label for the chapter.
Definition abstractchapter.cpp:41
TagParser::AbstractChapter::startTime
CppUtilities::TimeSpan startTime() const
Returns the start time if known; otherwise returns a negative time span.
Definition abstractchapter.h:70
TagParser::AbstractChapter::nestedChapter
virtual AbstractChapter * nestedChapter(std::size_t index)
Returns the nested chapter with the specified index.
Definition abstractchapter.h:110
TagParser::AbstractChapter::id
std::uint64_t id() const
Returns the chapter ID if known; otherwise returns zero.
Definition abstractchapter.h:54
TagParser::AbstractChapter::AbstractChapter
AbstractChapter()
Constructs a new chapter.
Definition abstractchapter.cpp:22
TagParser::AbstractChapter::isEnabled
bool isEnabled() const
Returns whether the chapter is flagged as enabled.
Definition abstractchapter.h:102
TagParser::AbstractChapter::tracks
const std::vector< std::uint64_t > & tracks() const
Returns a list of tracks on which the chapter applies.
Definition abstractchapter.h:86
TagParser::AbstractChapter::isHidden
bool isHidden() const
Returns whether the chapter is flagged as hidden.
Definition abstractchapter.h:94
TagParser::AbstractChapter::m_names
std::vector< LocaleAwareString > m_names
Definition abstractchapter.h:42
TagParser::Diagnostics
The Diagnostics class is a container for DiagMessage.
Definition diagnostics.h:156
TAG_PARSER_EXPORT
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Definition global.h:14
localeawarestring.h
TagParser
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10
TagParser::AbstractChapterPrivate
The AbstractChapterPrivate struct contains private fields of the AbstractChapter class.
Definition abstractchapter.cpp:12