Tag Parser
6.4.1
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
"
2
3
#include <sstream>
4
5
using namespace
std
;
6
using namespace
ChronoUtilities
;
7
8
namespace
Media
{
9
18
AbstractChapter::AbstractChapter() :
19
m_id(0),
20
m_startTime(-1),
21
m_endTime(-1),
22
m_hidden(false),
23
m_enabled(true)
24
{}
25
29
AbstractChapter::~AbstractChapter
()
30
{}
31
35
string
AbstractChapter::label
()
const
36
{
37
stringstream ss;
38
ss <<
"ID: "
<<
id
();
39
if
(!
names
().empty()) {
40
ss <<
", name: \""
<<
names
().front() <<
"\""
;
41
}
42
if
(!
startTime
().isNegative()) {
43
ss <<
", start: "
<<
startTime
().toString(TimeSpanOutputFormat::WithMeasures);
44
}
45
return
ss.str();
46
}
47
51
void
AbstractChapter::clear
()
52
{
53
m_id
= 0;
54
m_names
.clear();
55
m_startTime
=
m_endTime
=
TimeSpan
(-1);
56
m_tracks
.clear();
57
m_hidden
=
false
;
58
m_enabled
=
true
;
59
}
60
68
void
AbstractChapter::parse
()
69
{
70
clear
();
71
invalidateStatus
();
72
internalParse
();
73
}
74
80
void
AbstractChapter::parseNested
()
81
{
82
clear
();
83
invalidateStatus
();
84
internalParse
();
85
for
(
size_t
i = 0, count =
nestedChapterCount
(); i < count; ++i) {
86
nestedChapter
(i)->
parseNested
();
87
}
88
}
89
100
}
// namespace Media
101
Media::StatusProvider::invalidateStatus
void invalidateStatus()
Invalidates the current status.
Definition:
statusprovider.h:240
Media::AbstractChapter::m_enabled
bool m_enabled
Definition:
abstractchapter.h:44
Media::AbstractChapter::label
std::string label() const
Returns a label for the chapter.
Definition:
abstractchapter.cpp:35
ChronoUtilities
Media::AbstractChapter::m_tracks
std::vector< uint64 > m_tracks
Definition:
abstractchapter.h:42
Media::AbstractChapter::m_startTime
ChronoUtilities::TimeSpan m_startTime
Definition:
abstractchapter.h:40
Media::TagDataType::TimeSpan
Media::AbstractChapter::~AbstractChapter
virtual ~AbstractChapter()
Destroys the chapter.
Definition:
abstractchapter.cpp:29
std
STL namespace.
Media::AbstractChapter::parse
void parse()
Parses the chapter.
Definition:
abstractchapter.cpp:68
Media::AbstractChapter::parseNested
void parseNested()
Parses the chapter and nested chapters recursively.
Definition:
abstractchapter.cpp:80
Media::AbstractChapter::names
const std::vector< LocaleAwareString > & names() const
Returns the chapter name.
Definition:
abstractchapter.h:58
Media::AbstractChapter::startTime
ChronoUtilities::TimeSpan startTime() const
Returns the start time if known; otherwise returns a negative time span.
Definition:
abstractchapter.h:66
Media::AbstractChapter::m_endTime
ChronoUtilities::TimeSpan m_endTime
Definition:
abstractchapter.h:41
Media::AbstractChapter::id
uint64 id() const
Returns the chapter ID if known; otherwise returns zero.
Definition:
abstractchapter.h:50
abstractchapter.h
Media::AbstractChapter::m_id
uint64 m_id
Definition:
abstractchapter.h:38
Media::AbstractChapter::clear
virtual void clear()
Resets the object to its initial state.
Definition:
abstractchapter.cpp:51
Media::AbstractChapter::nestedChapter
virtual AbstractChapter * nestedChapter(std::size_t index)
Returns the nested chapter with the specified index.
Definition:
abstractchapter.h:106
Media::AbstractChapter::m_names
std::vector< LocaleAwareString > m_names
Definition:
abstractchapter.h:39
Media::AbstractChapter::m_hidden
bool m_hidden
Definition:
abstractchapter.h:43
Media
Contains all classes and functions of the TagInfo library.
Definition:
exceptions.h:9
Media::AbstractChapter::internalParse
virtual void internalParse()=0
Internally called to parse the chapter.
Media::AbstractChapter::nestedChapterCount
virtual std::size_t nestedChapterCount() const
Returns the number of nested chapters.
Definition:
abstractchapter.h:122
Generated on Thu Sep 14 2017 23:03:28 for Tag Parser by
1.8.13