Tag Parser  9.3.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
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 <string>
9 #include <vector>
10 
11 namespace TagParser {
12 
13 class Diagnostics;
14 
16 public:
17  virtual ~AbstractChapter();
18 
19  std::uint64_t id() const;
20  const std::vector<LocaleAwareString> &names() const;
21  CppUtilities::TimeSpan startTime() const;
22  CppUtilities::TimeSpan endTime() const;
23  const std::vector<std::uint64_t> &tracks() const;
24  bool isHidden() const;
25  bool isEnabled() const;
26  std::string label() const;
27  virtual AbstractChapter *nestedChapter(std::size_t index);
28  virtual const AbstractChapter *nestedChapter(std::size_t index) const;
29  virtual std::size_t nestedChapterCount() const;
30  virtual void clear();
31  void parse(Diagnostics &diag);
32  void parseNested(Diagnostics &diag);
33 
34 protected:
36  virtual void internalParse(Diagnostics &diag) = 0;
37 
38  std::uint64_t m_id;
39  std::vector<LocaleAwareString> m_names;
40  CppUtilities::TimeSpan m_startTime;
41  CppUtilities::TimeSpan m_endTime;
42  std::vector<std::uint64_t> m_tracks;
43  bool m_hidden;
44  bool m_enabled;
45 };
46 
50 inline std::uint64_t AbstractChapter::id() const
51 {
52  return m_id;
53 }
54 
58 inline const std::vector<LocaleAwareString> &AbstractChapter::names() const
59 {
60  return m_names;
61 }
62 
66 inline CppUtilities::TimeSpan AbstractChapter::startTime() const
67 {
68  return m_startTime;
69 }
70 
74 inline CppUtilities::TimeSpan AbstractChapter::endTime() const
75 {
76  return m_endTime;
77 }
78 
82 inline const std::vector<std::uint64_t> &AbstractChapter::tracks() const
83 {
84  return m_tracks;
85 }
86 
90 inline bool AbstractChapter::isHidden() const
91 {
92  return m_hidden;
93 }
94 
98 inline bool AbstractChapter::isEnabled() const
99 {
100  return m_enabled;
101 }
102 
107 {
108  return nullptr;
109 }
110 
114 inline const AbstractChapter *AbstractChapter::nestedChapter(std::size_t) const
115 {
116  return nullptr;
117 }
118 
122 inline std::size_t AbstractChapter::nestedChapterCount() const
123 {
124  return 0;
125 }
126 
127 } // namespace TagParser
128 
129 #endif // TAG_PARSER_ABSTRACTCHAPTER_H
TagParser::AbstractChapter::nestedChapterCount
virtual std::size_t nestedChapterCount() const
Returns the number of nested chapters.
Definition: abstractchapter.h:122
TagParser::AbstractChapter
The AbstractChapter class parses chapter information.
Definition: abstractchapter.h:15
localeawarestring.h
TagParser::AbstractChapter::m_enabled
bool m_enabled
Definition: abstractchapter.h:44
TagParser::Mp4TagExtendedNameIds::label
const char * label
Definition: mp4ids.cpp:32
TagParser::AbstractChapter::isEnabled
bool isEnabled() const
Returns whether the chapter is flagged as enabled.
Definition: abstractchapter.h:98
TagParser::Diagnostics
The Diagnostics class is a container for DiagMessage.
Definition: diagnostics.h:156
TagParser
Contains all classes and functions of the TagInfo library.
Definition: aaccodebook.h:10
TagParser::AbstractChapter::isHidden
bool isHidden() const
Returns whether the chapter is flagged as hidden.
Definition: abstractchapter.h:90
TagParser::AbstractChapter::m_startTime
CppUtilities::TimeSpan m_startTime
Definition: abstractchapter.h:40
TagParser::AbstractChapter::m_names
std::vector< LocaleAwareString > m_names
Definition: abstractchapter.h:39
TagParser::AbstractChapter::m_tracks
std::vector< std::uint64_t > m_tracks
Definition: abstractchapter.h:42
TagParser::AbstractChapter::id
std::uint64_t id() const
Returns the chapter ID if known; otherwise returns zero.
Definition: abstractchapter.h:50
TagParser::AbstractChapter::m_endTime
CppUtilities::TimeSpan m_endTime
Definition: abstractchapter.h:41
TagParser::AbstractChapter::names
const std::vector< LocaleAwareString > & names() const
Returns the chapter name.
Definition: abstractchapter.h:58
TagParser::AbstractChapter::m_id
std::uint64_t m_id
Definition: abstractchapter.h:38
TagParser::AbstractChapter::nestedChapter
virtual AbstractChapter * nestedChapter(std::size_t index)
Returns the nested chapter with the specified index.
Definition: abstractchapter.h:106
TagParser::AbstractChapter::endTime
CppUtilities::TimeSpan endTime() const
Returns the end time if known; otherwise returns a negative time span.
Definition: abstractchapter.h:74
TAG_PARSER_EXPORT
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
TagParser::AbstractChapter::internalParse
virtual void internalParse(Diagnostics &diag)=0
Internally called to parse the chapter.
TagParser::AbstractChapter::tracks
const std::vector< std::uint64_t > & tracks() const
Returns a list of tracks on which the chapter applies.
Definition: abstractchapter.h:82
TagParser::AbstractChapter::startTime
CppUtilities::TimeSpan startTime() const
Returns the start time if known; otherwise returns a negative time span.
Definition: abstractchapter.h:66
TagParser::AbstractChapter::m_hidden
bool m_hidden
Definition: abstractchapter.h:43