Tag Parser  10.0.1
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 AbortableProgressFeedback;
14 class Diagnostics;
15 
17 public:
18  virtual ~AbstractChapter();
19 
20  std::uint64_t id() const;
21  const std::vector<LocaleAwareString> &names() const;
22  CppUtilities::TimeSpan startTime() const;
23  CppUtilities::TimeSpan endTime() const;
24  const std::vector<std::uint64_t> &tracks() const;
25  bool isHidden() const;
26  bool isEnabled() const;
27  std::string label() const;
28  virtual AbstractChapter *nestedChapter(std::size_t index);
29  virtual const AbstractChapter *nestedChapter(std::size_t index) const;
30  virtual std::size_t nestedChapterCount() const;
31  virtual void clear();
32  void parse(Diagnostics &diag, AbortableProgressFeedback &progress);
33  void parseNested(Diagnostics &diag, AbortableProgressFeedback &progress);
34 
35 protected:
37  virtual void internalParse(Diagnostics &diag, AbortableProgressFeedback &progress) = 0;
38 
39  std::uint64_t m_id;
40  std::vector<LocaleAwareString> m_names;
41  CppUtilities::TimeSpan m_startTime;
42  CppUtilities::TimeSpan m_endTime;
43  std::vector<std::uint64_t> m_tracks;
44  bool m_hidden;
45  bool m_enabled;
46 };
47 
51 inline std::uint64_t AbstractChapter::id() const
52 {
53  return m_id;
54 }
55 
59 inline const std::vector<LocaleAwareString> &AbstractChapter::names() const
60 {
61  return m_names;
62 }
63 
67 inline CppUtilities::TimeSpan AbstractChapter::startTime() const
68 {
69  return m_startTime;
70 }
71 
75 inline CppUtilities::TimeSpan AbstractChapter::endTime() const
76 {
77  return m_endTime;
78 }
79 
83 inline const std::vector<std::uint64_t> &AbstractChapter::tracks() const
84 {
85  return m_tracks;
86 }
87 
91 inline bool AbstractChapter::isHidden() const
92 {
93  return m_hidden;
94 }
95 
99 inline bool AbstractChapter::isEnabled() const
100 {
101  return m_enabled;
102 }
103 
108 {
109  return nullptr;
110 }
111 
115 inline const AbstractChapter *AbstractChapter::nestedChapter(std::size_t) const
116 {
117  return nullptr;
118 }
119 
123 inline std::size_t AbstractChapter::nestedChapterCount() const
124 {
125  return 0;
126 }
127 
128 } // namespace TagParser
129 
130 #endif // TAG_PARSER_ABSTRACTCHAPTER_H
The AbortableProgressFeedback class provides feedback about an ongoing operation via callbacks.
The AbstractChapter class parses chapter information.
CppUtilities::TimeSpan endTime() const
Returns the end time if known; otherwise returns a negative time span.
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
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.
bool isEnabled() const
Returns whether the chapter is flagged as enabled.
const std::vector< std::uint64_t > & tracks() const
Returns a list of tracks on which the chapter applies.
bool isHidden() const
Returns whether the chapter is flagged as hidden.
std::vector< LocaleAwareString > m_names
The Diagnostics class is a container for DiagMessage.
Definition: diagnostics.h:156
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Contains all classes and functions of the TagInfo library.
Definition: aaccodebook.h:10