2015-09-06 19:57:33 +02:00
|
|
|
#include "./abstractcontainer.h"
|
2018-03-05 17:49:29 +01:00
|
|
|
#include "./diagnostics.h"
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
using namespace std;
|
2019-06-10 22:49:11 +02:00
|
|
|
using namespace CppUtilities;
|
2015-04-22 19:22:01 +02:00
|
|
|
|
2018-03-06 23:09:15 +01:00
|
|
|
namespace TagParser {
|
2015-04-22 19:22:01 +02:00
|
|
|
|
2023-05-11 22:54:24 +02:00
|
|
|
/// \brief The AbstractContainerPrivate struct contains private fields of the AbstractContainer class.
|
|
|
|
struct AbstractContainerPrivate {};
|
|
|
|
|
2015-04-22 19:22:01 +02:00
|
|
|
/*!
|
2018-06-03 20:38:32 +02:00
|
|
|
* \class TagParser::AbstractContainer
|
2015-04-22 19:22:01 +02:00
|
|
|
* \brief The AbstractContainer class provides an interface and common functionality to parse and make a certain container format.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Constructs a new container for the specified file \a stream at the specified \a startOffset.
|
|
|
|
*/
|
2019-03-13 19:06:42 +01:00
|
|
|
AbstractContainer::AbstractContainer(iostream &stream, std::uint64_t startOffset)
|
2018-03-07 01:17:50 +01:00
|
|
|
: m_version(0)
|
|
|
|
, m_readVersion(0)
|
|
|
|
, m_doctypeVersion(0)
|
|
|
|
, m_doctypeReadVersion(0)
|
|
|
|
, m_timeScale(0)
|
|
|
|
, m_headerParsed(false)
|
|
|
|
, m_tagsParsed(false)
|
|
|
|
, m_tracksParsed(false)
|
|
|
|
, m_tracksAltered(false)
|
|
|
|
, m_chaptersParsed(false)
|
|
|
|
, m_attachmentsParsed(false)
|
|
|
|
, m_startOffset(startOffset)
|
|
|
|
, m_stream(&stream)
|
|
|
|
, m_reader(BinaryReader(m_stream))
|
|
|
|
, m_writer(BinaryWriter(m_stream))
|
|
|
|
{
|
|
|
|
}
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Destroys the container.
|
|
|
|
*
|
|
|
|
* Destroys the reader, the writer and track, tag, chapter and attachment objects as well.
|
|
|
|
* Does NOT destroy the stream which has been specified when constructing the object.
|
|
|
|
*/
|
|
|
|
AbstractContainer::~AbstractContainer()
|
2018-03-07 01:17:50 +01:00
|
|
|
{
|
|
|
|
}
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Parses the header if not parsed yet.
|
|
|
|
*
|
|
|
|
* The information will be read from the associated stream. The stream and the start offset
|
|
|
|
* have been specified when constructing the object.
|
|
|
|
*
|
|
|
|
* \throws Throws std::ios_base::failure when an IO error occurs.
|
|
|
|
* \throws Throws Failure or a derived class when an parsing error occurs.
|
|
|
|
*/
|
2021-02-04 23:21:50 +01:00
|
|
|
void AbstractContainer::parseHeader(Diagnostics &diag, AbortableProgressFeedback &progress)
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
2018-03-07 01:17:50 +01:00
|
|
|
if (!isHeaderParsed()) {
|
2015-04-22 19:22:01 +02:00
|
|
|
removeAllTags();
|
|
|
|
removeAllTracks();
|
2021-02-04 23:21:50 +01:00
|
|
|
internalParseHeader(diag, progress);
|
2015-04-22 19:22:01 +02:00
|
|
|
m_headerParsed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Parses the tag information if not parsed yet.
|
|
|
|
*
|
|
|
|
* The header will be parsed before if not parsed yet.
|
|
|
|
*
|
|
|
|
* The information will be read from the associated stream. The stream and the start offset
|
|
|
|
* have been specified when constructing the object.
|
|
|
|
*
|
|
|
|
* \throws Throws std::ios_base::failure when an IO error occurs.
|
|
|
|
* \throws Throws Failure or a derived class when an parsing error occurs.
|
|
|
|
*
|
|
|
|
* \sa parseHeader()
|
|
|
|
* \sa parseTracks()
|
|
|
|
* \sa parseAttachments()
|
|
|
|
* \sa parseChapters()
|
|
|
|
* \sa tags()
|
|
|
|
*/
|
2021-02-04 23:21:50 +01:00
|
|
|
void AbstractContainer::parseTags(Diagnostics &diag, AbortableProgressFeedback &progress)
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
2018-03-07 01:17:50 +01:00
|
|
|
if (!areTagsParsed()) {
|
2021-02-04 23:21:50 +01:00
|
|
|
parseHeader(diag, progress);
|
|
|
|
internalParseTags(diag, progress);
|
2015-04-22 19:22:01 +02:00
|
|
|
m_tagsParsed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Parses the tracks of the file if not parsed yet.
|
|
|
|
*
|
|
|
|
* The header will be parsed before if not parsed yet.
|
|
|
|
*
|
|
|
|
* The information will be read from the associated stream. The stream and the start offset
|
|
|
|
* have been specified when constructing the object.
|
|
|
|
*
|
|
|
|
* \throws Throws std::ios_base::failure when an IO error occurs.
|
|
|
|
* \throws Throws Failure or a derived class when an parsing error occurs.
|
|
|
|
*
|
|
|
|
* \sa parseHeader()
|
|
|
|
* \sa parseTags()
|
|
|
|
* \sa tracks()
|
|
|
|
*/
|
2021-02-04 23:21:50 +01:00
|
|
|
void AbstractContainer::parseTracks(Diagnostics &diag, AbortableProgressFeedback &progress)
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
2018-03-07 01:17:50 +01:00
|
|
|
if (!areTracksParsed()) {
|
2021-02-04 23:21:50 +01:00
|
|
|
parseHeader(diag, progress);
|
|
|
|
internalParseTracks(diag, progress);
|
2015-04-22 19:22:01 +02:00
|
|
|
m_tracksParsed = true;
|
|
|
|
m_tracksAltered = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Parses the chapters of the file if not parsed yet.
|
|
|
|
*
|
|
|
|
* The information will be read from the associated stream. The stream and the start offset
|
|
|
|
* have been specified when constructing the object.
|
|
|
|
*
|
|
|
|
* \throws Throws std::ios_base::failure when an IO error occurs.
|
2018-06-03 20:38:32 +02:00
|
|
|
* \throws Throws TagParser::Failure or a derived exception when a parsing
|
2015-04-22 19:22:01 +02:00
|
|
|
* error occurs.
|
|
|
|
*/
|
2021-02-04 23:21:50 +01:00
|
|
|
void AbstractContainer::parseChapters(Diagnostics &diag, AbortableProgressFeedback &progress)
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
2018-03-07 01:17:50 +01:00
|
|
|
if (!areChaptersParsed()) {
|
2021-02-04 23:21:50 +01:00
|
|
|
parseHeader(diag, progress);
|
|
|
|
internalParseChapters(diag, progress);
|
2015-04-22 19:22:01 +02:00
|
|
|
m_chaptersParsed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Parses the attachments of the file if not parsed yet.
|
|
|
|
*
|
|
|
|
* The information will be read from the associated stream. The stream and the start offset
|
|
|
|
* have been specified when constructing the object.
|
|
|
|
*
|
|
|
|
* \throws Throws std::ios_base::failure when an IO error occurs.
|
2018-06-03 20:38:32 +02:00
|
|
|
* \throws Throws TagParser::Failure or a derived exception when a parsing
|
2015-04-22 19:22:01 +02:00
|
|
|
* error occurs.
|
|
|
|
*/
|
2021-02-04 23:21:50 +01:00
|
|
|
void AbstractContainer::parseAttachments(Diagnostics &diag, AbortableProgressFeedback &progress)
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
2018-03-07 01:17:50 +01:00
|
|
|
if (!areAttachmentsParsed()) {
|
2021-02-04 23:21:50 +01:00
|
|
|
parseHeader(diag, progress);
|
|
|
|
internalParseAttachments(diag, progress);
|
2015-04-22 19:22:01 +02:00
|
|
|
m_attachmentsParsed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Rewrites the file to apply changed tag information.
|
|
|
|
*
|
|
|
|
* \throws Throws std::ios_base::failure when an IO error occurs.
|
2018-06-03 20:38:32 +02:00
|
|
|
* \throws Throws TagParser::Failure or a derived exception when a making
|
2015-04-22 19:22:01 +02:00
|
|
|
* error occurs.
|
|
|
|
*/
|
2018-03-05 17:49:29 +01:00
|
|
|
void AbstractContainer::makeFile(Diagnostics &diag, AbortableProgressFeedback &progress)
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
2018-03-05 17:49:29 +01:00
|
|
|
internalMakeFile(diag, progress);
|
2015-04-22 19:22:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns whether the implementation supports adding or removing of tracks.
|
|
|
|
*/
|
|
|
|
bool AbstractContainer::supportsTrackModifications() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-11-16 19:31:09 +01:00
|
|
|
/*!
|
|
|
|
* \brief Determines the position of the index.
|
|
|
|
* \returns Returns ElementPosition::BeforeData or ElementPosition::AfterData if the position could
|
|
|
|
* be determined; otherwise returns ElementPosition::Keep.
|
2016-11-16 22:06:12 +01:00
|
|
|
* \remarks
|
|
|
|
* - It might be required to parse tracks before the index position can be determined.
|
|
|
|
* - Not be applicable for files composed of multiple segments.
|
2017-05-22 23:40:30 +02:00
|
|
|
* \sa MediaFileInfo::indexPosition()
|
2016-11-16 19:31:09 +01:00
|
|
|
*/
|
2018-03-05 17:49:29 +01:00
|
|
|
ElementPosition AbstractContainer::determineIndexPosition(Diagnostics &diag) const
|
2016-11-16 19:31:09 +01:00
|
|
|
{
|
2019-06-12 20:40:45 +02:00
|
|
|
CPP_UTILITIES_UNUSED(diag);
|
2016-11-16 19:31:09 +01:00
|
|
|
return ElementPosition::Keep;
|
|
|
|
}
|
|
|
|
|
2015-04-22 19:22:01 +02:00
|
|
|
/*!
|
|
|
|
* \brief Internally called to parse the header.
|
|
|
|
*
|
|
|
|
* Must be implemented when subclassing to provide this feature.
|
|
|
|
*
|
|
|
|
* \throws Throws Failure or a derived class when a parsing error occurs.
|
|
|
|
* \throws Throws std::ios_base::failure when an IO error occurs.
|
|
|
|
*/
|
2021-02-04 23:21:50 +01:00
|
|
|
void AbstractContainer::internalParseHeader(Diagnostics &diag, AbortableProgressFeedback &progress)
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
2019-06-12 20:40:45 +02:00
|
|
|
CPP_UTILITIES_UNUSED(diag);
|
2021-02-04 23:21:50 +01:00
|
|
|
CPP_UTILITIES_UNUSED(progress);
|
2015-04-22 19:22:01 +02:00
|
|
|
throw NotImplementedException();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Internally called to parse the tags.
|
|
|
|
*
|
|
|
|
* Must be implemented when subclassing to provide this feature.
|
|
|
|
*
|
|
|
|
* \throws Throws Failure or a derived class when a parsing error occurs.
|
|
|
|
* \throws Throws std::ios_base::failure when an IO error occurs.
|
|
|
|
*/
|
2021-02-04 23:21:50 +01:00
|
|
|
void AbstractContainer::internalParseTags(Diagnostics &diag, AbortableProgressFeedback &progress)
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
2019-06-12 20:40:45 +02:00
|
|
|
CPP_UTILITIES_UNUSED(diag);
|
2021-02-04 23:21:50 +01:00
|
|
|
CPP_UTILITIES_UNUSED(progress);
|
2015-04-22 19:22:01 +02:00
|
|
|
throw NotImplementedException();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Internally called to parse the tracks.
|
|
|
|
*
|
|
|
|
* Must be implemented when subclassing to provide this feature.
|
|
|
|
*
|
|
|
|
* \throws Throws Failure or a derived class when a parsing error occurs.
|
|
|
|
* \throws Throws std::ios_base::failure when an IO error occurs.
|
|
|
|
*/
|
2021-02-04 23:21:50 +01:00
|
|
|
void AbstractContainer::internalParseTracks(Diagnostics &diag, AbortableProgressFeedback &progress)
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
2019-06-12 20:40:45 +02:00
|
|
|
CPP_UTILITIES_UNUSED(diag);
|
2021-02-04 23:21:50 +01:00
|
|
|
CPP_UTILITIES_UNUSED(progress);
|
2015-04-22 19:22:01 +02:00
|
|
|
throw NotImplementedException();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Internally called to parse the chapters.
|
|
|
|
*
|
|
|
|
* Must be implemented when subclassing to provide this feature.
|
|
|
|
*
|
|
|
|
* \throws Throws Failure or a derived class when a parsing error occurs.
|
|
|
|
* \throws Throws std::ios_base::failure when an IO error occurs.
|
|
|
|
*/
|
2021-02-04 23:21:50 +01:00
|
|
|
void AbstractContainer::internalParseChapters(Diagnostics &diag, AbortableProgressFeedback &progress)
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
2019-06-12 20:40:45 +02:00
|
|
|
CPP_UTILITIES_UNUSED(diag);
|
2021-02-04 23:21:50 +01:00
|
|
|
CPP_UTILITIES_UNUSED(progress);
|
2015-04-22 19:22:01 +02:00
|
|
|
throw NotImplementedException();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Internally called to parse the attachments.
|
|
|
|
*
|
|
|
|
* Must be implemented when subclassing to provide this feature.
|
|
|
|
*
|
|
|
|
* \throws Throws Failure or a derived class when a parsing error occurs.
|
|
|
|
* \throws Throws std::ios_base::failure when an IO error occurs.
|
|
|
|
*/
|
2021-02-04 23:21:50 +01:00
|
|
|
void AbstractContainer::internalParseAttachments(Diagnostics &diag, AbortableProgressFeedback &progress)
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
2019-06-12 20:40:45 +02:00
|
|
|
CPP_UTILITIES_UNUSED(diag);
|
2021-02-04 23:21:50 +01:00
|
|
|
CPP_UTILITIES_UNUSED(progress);
|
2015-04-22 19:22:01 +02:00
|
|
|
throw NotImplementedException();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Internally called to make the file.
|
|
|
|
*
|
|
|
|
* Must be implemented when subclassing.
|
|
|
|
*
|
|
|
|
* \throws Throws Failure or a derived class when a parsing error occurs.
|
|
|
|
* \throws Throws std::ios_base::failure when an IO error occurs.
|
|
|
|
*/
|
2018-03-05 17:49:29 +01:00
|
|
|
void AbstractContainer::internalMakeFile(Diagnostics &diag, AbortableProgressFeedback &progress)
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
2019-06-12 20:40:45 +02:00
|
|
|
CPP_UTILITIES_UNUSED(diag);
|
|
|
|
CPP_UTILITIES_UNUSED(progress);
|
2015-04-22 19:22:01 +02:00
|
|
|
throw NotImplementedException();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Creates and returns a tag for the specified \a target.
|
|
|
|
* \remarks
|
|
|
|
* - If there is already a tag (for the specified \a target) present,
|
|
|
|
* no new tag will be created. The present tag will be returned instead.
|
2016-05-14 00:24:01 +02:00
|
|
|
* - If an empty \a target is specified it will be ignored.
|
|
|
|
* - If targets aren't supported the specified \a target will be ignored.
|
2015-04-22 19:22:01 +02:00
|
|
|
* - If no tag could be created, nullptr is returned.
|
|
|
|
* - The container keeps the ownership over the created tag.
|
|
|
|
*/
|
|
|
|
Tag *AbstractContainer::createTag(const TagTarget &)
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the tag with the specified \a index.
|
|
|
|
*
|
2017-03-01 18:21:00 +01:00
|
|
|
* \a index must be less than tagCount().
|
2015-04-22 19:22:01 +02:00
|
|
|
*/
|
2018-03-05 17:49:29 +01:00
|
|
|
Tag *AbstractContainer::tag(size_t index)
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
2019-06-12 20:40:45 +02:00
|
|
|
CPP_UTILITIES_UNUSED(index);
|
2015-04-22 19:22:01 +02:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the number of tags attached to the container.
|
|
|
|
*
|
|
|
|
* This method returns zero if the tags have not been parsed yet.
|
|
|
|
*/
|
|
|
|
size_t AbstractContainer::tagCount() const
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Removes the specified \a tag from the container.
|
|
|
|
*
|
|
|
|
* Does nothing if the tag is not attached to the container.
|
|
|
|
*
|
|
|
|
* The tags need to be parsed before a removal is possible.
|
|
|
|
* \sa areTagsParsed()
|
|
|
|
* \sa parseTags()
|
|
|
|
*
|
2021-07-02 03:00:50 +02:00
|
|
|
* \remarks The \a tag is not destroyed. The ownership is transferred to the caller.
|
2015-04-22 19:22:01 +02:00
|
|
|
*
|
|
|
|
* \returns Returns whether the \a tag could be removed.
|
|
|
|
*/
|
2018-03-05 17:49:29 +01:00
|
|
|
bool AbstractContainer::removeTag(Tag *tag)
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
2019-06-12 20:40:45 +02:00
|
|
|
CPP_UTILITIES_UNUSED(tag);
|
2015-04-22 19:22:01 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Removes all tags attached to the container.
|
|
|
|
*
|
|
|
|
* The tags need to be parsed before they can be removed.
|
|
|
|
* \sa areTagsParsed()
|
|
|
|
* \sa parseTags()
|
|
|
|
*
|
|
|
|
* \remarks The current tag objects are destroyed. All pointers obtained
|
|
|
|
* by calling tag() are invalidated.
|
|
|
|
*/
|
|
|
|
void AbstractContainer::removeAllTags()
|
2018-03-07 01:17:50 +01:00
|
|
|
{
|
|
|
|
}
|
2015-04-22 19:22:01 +02:00
|
|
|
|
2016-11-15 22:48:38 +01:00
|
|
|
/*!
|
|
|
|
* \brief Determines the position of the tags inside the file.
|
|
|
|
* \returns Returns ElementPosition::BeforeData or ElementPosition::AfterData if the position could
|
|
|
|
* be determined; otherwise returns ElementPosition::Keep.
|
2016-11-16 22:06:12 +01:00
|
|
|
* \remarks
|
|
|
|
* - It might be required to parse tags before the tag position can be determined.
|
|
|
|
* - Not be applicable for files composed of multiple segments.
|
2017-05-22 23:40:30 +02:00
|
|
|
* \sa MediaFileInfo::tagPosition()
|
2016-11-15 22:48:38 +01:00
|
|
|
*/
|
2018-03-05 17:49:29 +01:00
|
|
|
ElementPosition AbstractContainer::determineTagPosition(Diagnostics &diag) const
|
2016-11-15 22:48:38 +01:00
|
|
|
{
|
2019-06-12 20:40:45 +02:00
|
|
|
CPP_UTILITIES_UNUSED(diag);
|
2016-11-15 22:48:38 +01:00
|
|
|
return ElementPosition::Keep;
|
|
|
|
}
|
|
|
|
|
2015-04-22 19:22:01 +02:00
|
|
|
/*!
|
|
|
|
* \brief Returns the track with the specified \a index.
|
|
|
|
*
|
2017-03-01 18:21:00 +01:00
|
|
|
* \a index must be less than trackCount().
|
2015-04-22 19:22:01 +02:00
|
|
|
*/
|
2018-03-05 17:49:29 +01:00
|
|
|
AbstractTrack *AbstractContainer::track(size_t index)
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
2019-06-12 20:40:45 +02:00
|
|
|
CPP_UTILITIES_UNUSED(index);
|
2015-04-22 19:22:01 +02:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the number of tracks the container holds.
|
|
|
|
*/
|
|
|
|
size_t AbstractContainer::trackCount() const
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Removes the specified \a track to the container.
|
|
|
|
*
|
|
|
|
* Removal of tracks might be not supported by the implementation.
|
|
|
|
* \sa supportsTrackModifications()
|
|
|
|
*
|
|
|
|
* The tracks need to be parsed before a removal is possible.
|
|
|
|
* \sa areTracksParsed()
|
|
|
|
* \sa parseTracks()
|
|
|
|
*
|
2021-07-02 03:00:50 +02:00
|
|
|
* \remarks The \a track is not destroyed. The ownership is transferred to the caller.
|
2015-04-22 19:22:01 +02:00
|
|
|
*
|
|
|
|
* \returns Returns whether the \a track could be removed.
|
|
|
|
*/
|
2018-03-05 17:49:29 +01:00
|
|
|
bool AbstractContainer::removeTrack(AbstractTrack *track)
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
2019-06-12 20:40:45 +02:00
|
|
|
CPP_UTILITIES_UNUSED(track);
|
2015-04-22 19:22:01 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Removes all tracks from the container.
|
|
|
|
*
|
|
|
|
* Modifying tracks might be not supported by the implementation.
|
|
|
|
* \sa supportsTrackModifications()
|
|
|
|
*
|
|
|
|
* The tracks need to be parsed before they can be removed.
|
|
|
|
* \sa areTracksParsed()
|
|
|
|
* \sa parseTracks()
|
|
|
|
*
|
|
|
|
* \remarks The current track objects are destroyed. All pointers obtained
|
|
|
|
* by calling track() are invalidated.
|
|
|
|
*/
|
|
|
|
void AbstractContainer::removeAllTracks()
|
2018-03-07 01:17:50 +01:00
|
|
|
{
|
|
|
|
}
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the chapter with the specified \a index.
|
|
|
|
*
|
2017-03-01 18:21:00 +01:00
|
|
|
* \a index must be less than chapterCount().
|
2015-04-22 19:22:01 +02:00
|
|
|
*/
|
2018-03-05 17:49:29 +01:00
|
|
|
AbstractChapter *AbstractContainer::chapter(size_t index)
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
2019-06-12 20:40:45 +02:00
|
|
|
CPP_UTILITIES_UNUSED(index);
|
2015-04-22 19:22:01 +02:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the number of chapters the container holds.
|
|
|
|
*/
|
|
|
|
size_t AbstractContainer::chapterCount() const
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Creates and returns a new attachment.
|
|
|
|
* \returns Returns the created attachment.
|
|
|
|
* \remarks The container keeps the ownership over the created attachment.
|
|
|
|
*/
|
|
|
|
AbstractAttachment *AbstractContainer::createAttachment()
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the attachment with the specified \a index.
|
|
|
|
*
|
2017-03-01 18:21:00 +01:00
|
|
|
* \a index must be less than attachmentCount().
|
2015-04-22 19:22:01 +02:00
|
|
|
*/
|
2018-03-05 17:49:29 +01:00
|
|
|
AbstractAttachment *AbstractContainer::attachment(size_t index)
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
2019-06-12 20:40:45 +02:00
|
|
|
CPP_UTILITIES_UNUSED(index);
|
2015-04-22 19:22:01 +02:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the number of attachments the container holds.
|
|
|
|
*/
|
|
|
|
size_t AbstractContainer::attachmentCount() const
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2015-12-27 19:51:57 +01:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns whether the title property is supported.
|
|
|
|
*/
|
|
|
|
bool AbstractContainer::supportsTitle() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the number of segments.
|
|
|
|
*/
|
|
|
|
size_t AbstractContainer::segmentCount() const
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-04-22 19:22:01 +02:00
|
|
|
/*!
|
|
|
|
* \brief Discards all parsing results.
|
|
|
|
*/
|
|
|
|
void AbstractContainer::reset()
|
|
|
|
{
|
|
|
|
m_headerParsed = false;
|
|
|
|
m_tagsParsed = false;
|
|
|
|
m_tracksParsed = false;
|
|
|
|
m_tracksAltered = false;
|
2015-10-06 22:32:03 +02:00
|
|
|
m_chaptersParsed = false;
|
|
|
|
m_attachmentsParsed = false;
|
2015-04-22 19:22:01 +02:00
|
|
|
m_version = 0;
|
|
|
|
m_readVersion = 0;
|
|
|
|
m_doctypeVersion = 0;
|
|
|
|
m_doctypeReadVersion = 0;
|
|
|
|
m_timeScale = 0;
|
2015-10-14 19:42:48 +02:00
|
|
|
m_titles.clear();
|
2015-04-22 19:22:01 +02:00
|
|
|
}
|
|
|
|
|
2018-03-07 01:17:50 +01:00
|
|
|
} // namespace TagParser
|