tagparser/abstractchapter.h

131 lines
3.0 KiB
C
Raw Normal View History

#ifndef TAG_PARSER_ABSTRACTCHAPTER_H
#define TAG_PARSER_ABSTRACTCHAPTER_H
2015-04-22 19:22:01 +02:00
2015-09-06 19:57:33 +02:00
#include "./localeawarestring.h"
2015-04-22 19:22:01 +02:00
#include <c++utilities/chrono/timespan.h>
#include <string>
#include <vector>
namespace TagParser {
2015-04-22 19:22:01 +02:00
class AbortableProgressFeedback;
class Diagnostics;
2018-03-07 01:17:50 +01:00
class TAG_PARSER_EXPORT AbstractChapter {
2015-04-22 19:22:01 +02:00
public:
virtual ~AbstractChapter();
2019-03-13 19:06:42 +01:00
std::uint64_t id() const;
2015-04-22 19:22:01 +02:00
const std::vector<LocaleAwareString> &names() const;
2019-06-10 22:49:11 +02:00
CppUtilities::TimeSpan startTime() const;
CppUtilities::TimeSpan endTime() const;
2019-03-13 19:06:42 +01:00
const std::vector<std::uint64_t> &tracks() const;
2015-04-22 19:22:01 +02:00
bool isHidden() const;
bool isEnabled() const;
std::string label() const;
virtual AbstractChapter *nestedChapter(std::size_t index);
virtual const AbstractChapter *nestedChapter(std::size_t index) const;
virtual std::size_t nestedChapterCount() const;
virtual void clear();
void parse(Diagnostics &diag, AbortableProgressFeedback &progress);
void parseNested(Diagnostics &diag, AbortableProgressFeedback &progress);
2015-04-22 19:22:01 +02:00
protected:
AbstractChapter();
virtual void internalParse(Diagnostics &diag, AbortableProgressFeedback &progress) = 0;
2015-04-22 19:22:01 +02:00
2019-03-13 19:06:42 +01:00
std::uint64_t m_id;
2015-04-22 19:22:01 +02:00
std::vector<LocaleAwareString> m_names;
2019-06-10 22:49:11 +02:00
CppUtilities::TimeSpan m_startTime;
CppUtilities::TimeSpan m_endTime;
2019-03-13 19:06:42 +01:00
std::vector<std::uint64_t> m_tracks;
2015-04-22 19:22:01 +02:00
bool m_hidden;
bool m_enabled;
};
/*!
* \brief Returns the chapter ID if known; otherwise returns zero.
*/
2019-03-13 19:06:42 +01:00
inline std::uint64_t AbstractChapter::id() const
2015-04-22 19:22:01 +02:00
{
return m_id;
}
/*!
* \brief Returns the chapter name.
*/
inline const std::vector<LocaleAwareString> &AbstractChapter::names() const
{
return m_names;
}
/*!
* \brief Returns the start time if known; otherwise returns a negative time span.
*/
2019-06-10 22:49:11 +02:00
inline CppUtilities::TimeSpan AbstractChapter::startTime() const
2015-04-22 19:22:01 +02:00
{
return m_startTime;
}
/*!
* \brief Returns the end time if known; otherwise returns a negative time span.
*/
2019-06-10 22:49:11 +02:00
inline CppUtilities::TimeSpan AbstractChapter::endTime() const
2015-04-22 19:22:01 +02:00
{
return m_endTime;
}
/*!
* \brief Returns a list of tracks on which the chapter applies.
*/
2019-03-13 19:06:42 +01:00
inline const std::vector<std::uint64_t> &AbstractChapter::tracks() const
2015-04-22 19:22:01 +02:00
{
return m_tracks;
}
/*!
* \brief Returns whether the chapter is flagged as hidden.
*/
inline bool AbstractChapter::isHidden() const
{
return m_hidden;
}
/*!
* \brief Returns whether the chapter is flagged as enabled.
*/
inline bool AbstractChapter::isEnabled() const
{
return m_enabled;
}
/*!
* \brief Returns the nested chapter with the specified \a index.
*/
2018-03-07 01:17:50 +01:00
inline AbstractChapter *AbstractChapter::nestedChapter(std::size_t)
2015-04-22 19:22:01 +02:00
{
return nullptr;
}
/*!
* \brief Returns the nested chapter with the specified \a index.
*/
2018-03-07 01:17:50 +01:00
inline const AbstractChapter *AbstractChapter::nestedChapter(std::size_t) const
2015-04-22 19:22:01 +02:00
{
return nullptr;
}
/*!
* \brief Returns the number of nested chapters.
*/
inline std::size_t AbstractChapter::nestedChapterCount() const
{
return 0;
}
2018-03-07 01:17:50 +01:00
} // namespace TagParser
2015-04-22 19:22:01 +02:00
#endif // TAG_PARSER_ABSTRACTCHAPTER_H