1#ifndef TAG_PARSER_ABSTRACTCONTAINER_H
2#define TAG_PARSER_ABSTRACTCONTAINER_H
8#include <c++utilities/chrono/datetime.h>
9#include <c++utilities/chrono/timespan.h>
10#include <c++utilities/io/binaryreader.h>
11#include <c++utilities/io/binarywriter.h>
26class AbstractAttachment;
28class AbortableProgressFeedback;
29struct AbstractContainerPrivate;
33 virtual ~AbstractContainer();
35 std::iostream &stream();
36 void setStream(std::iostream &stream);
37 std::uint64_t startOffset()
const;
38 CppUtilities::BinaryReader &reader();
39 CppUtilities::BinaryWriter &writer();
41 void parseHeader(Diagnostics &diag, AbortableProgressFeedback &progress);
42 void parseTags(Diagnostics &diag, AbortableProgressFeedback &progress);
43 void parseTracks(Diagnostics &diag, AbortableProgressFeedback &progress);
44 void parseChapters(Diagnostics &diag, AbortableProgressFeedback &progress);
45 void parseAttachments(Diagnostics &diag, AbortableProgressFeedback &progress);
46 void makeFile(Diagnostics &diag, AbortableProgressFeedback &progress);
48 bool isHeaderParsed()
const;
49 bool areTagsParsed()
const;
50 bool areTracksParsed()
const;
51 bool areChaptersParsed()
const;
52 bool areAttachmentsParsed()
const;
54 virtual Tag *createTag(
const TagTarget &target = TagTarget());
55 virtual Tag *tag(std::size_t index);
56 virtual std::size_t tagCount()
const;
57 virtual bool removeTag(Tag *tag);
58 virtual void removeAllTags();
59 virtual ElementPosition determineTagPosition(Diagnostics &diag)
const;
61 virtual AbstractTrack *track(std::size_t index);
62 virtual std::size_t trackCount()
const;
63 virtual bool removeTrack(AbstractTrack *track);
64 virtual void removeAllTracks();
65 virtual bool supportsTrackModifications()
const;
66 virtual ElementPosition determineIndexPosition(Diagnostics &diag)
const;
68 virtual AbstractChapter *chapter(std::size_t index);
69 virtual std::size_t chapterCount()
const;
71 virtual AbstractAttachment *createAttachment();
72 virtual AbstractAttachment *attachment(std::size_t index);
73 virtual std::size_t attachmentCount()
const;
75 std::uint64_t version()
const;
76 std::uint64_t readVersion()
const;
77 const std::string &documentType()
const;
78 std::uint64_t doctypeVersion()
const;
79 std::uint64_t doctypeReadVersion()
const;
80 const std::vector<std::string> &titles()
const;
81 void setTitle(std::string_view title, std::size_t segmentIndex = 0);
82 virtual bool supportsTitle()
const;
83 const std::vector<std::string> &muxingApplications()
const;
84 const std::vector<std::string> &writingApplications()
const;
85 virtual std::size_t segmentCount()
const;
86 CppUtilities::TimeSpan duration()
const;
87 CppUtilities::DateTime creationTime()
const;
88 CppUtilities::DateTime modificationTime()
const;
89 std::uint32_t timeScale()
const;
94 AbstractContainer(std::iostream &stream, std::uint64_t startOffset);
96 virtual void internalParseHeader(Diagnostics &diag, AbortableProgressFeedback &progress);
97 virtual void internalParseTags(Diagnostics &diag, AbortableProgressFeedback &progress);
98 virtual void internalParseTracks(Diagnostics &diag, AbortableProgressFeedback &progress);
99 virtual void internalParseChapters(Diagnostics &diag, AbortableProgressFeedback &progress);
100 virtual void internalParseAttachments(Diagnostics &diag, AbortableProgressFeedback &progress);
101 virtual void internalMakeFile(Diagnostics &diag, AbortableProgressFeedback &progress);
102 std::vector<std::string> &muxingApplications();
103 std::vector<std::string> &writingApplications();
124 std::unique_ptr<AbstractContainerPrivate> &p();
126 std::uint64_t m_startOffset;
127 std::iostream *m_stream;
128 CppUtilities::BinaryReader m_reader;
129 CppUtilities::BinaryWriter m_writer;
130 std::unique_ptr<AbstractContainerPrivate> m_p;
147 m_reader.setStream(m_stream);
148 m_writer.setStream(m_stream);
156 return m_startOffset;
CppUtilities::DateTime modificationTime() const
Returns the modification time of the file if known; otherwise the returned date time is null.
std::uint64_t doctypeVersion() const
Returns the document type version if known; otherwise returns 0.
bool areAttachmentsParsed() const
Returns an indication whether the attachments have been parsed yet.
CppUtilities::DateTime m_modificationTime
std::iostream & stream()
Returns the related stream.
std::uint64_t startOffset() const
Returns the start offset in the related stream.
void setTitle(std::string_view title, std::size_t segmentIndex=0)
Sets the title for the specified segment.
std::vector< std::string > m_titles
bool areTracksParsed() const
Returns an indication whether the tracks have been parsed yet.
std::uint64_t doctypeReadVersion() const
Returns the document type "read version" if known; otherwise returns 0.
std::uint64_t version() const
Returns the version if known; otherwise returns 0.
CppUtilities::DateTime creationTime() const
Returns the creation time of the file if known; otherwise the returned date time is null.
bool isHeaderParsed() const
Returns an indication whether the header has been parsed yet.
void setStream(std::iostream &stream)
Sets the related stream.
std::uint32_t timeScale() const
Returns the time scale of the file if known; otherwise returns 0.
CppUtilities::BinaryWriter & writer()
Returns the related BinaryWriter.
std::uint64_t m_doctypeReadVersion
std::uint64_t m_readVersion
CppUtilities::BinaryReader & reader()
Returns the related BinaryReader.
CppUtilities::DateTime m_creationTime
const std::string & documentType() const
Returns a string that describes the document type if available; otherwise returns an empty string.
const std::vector< std::string > & titles() const
Returns the title(s) of the file.
bool areTagsParsed() const
Returns an indication whether the tags have been parsed yet.
bool areChaptersParsed() const
Returns an indication whether the chapters have been parsed yet.
std::uint64_t m_doctypeVersion
std::uint32_t m_timeScale
CppUtilities::TimeSpan m_duration
CppUtilities::TimeSpan duration() const
Returns the duration of the file if known; otherwise returns a time span of zero ticks.
std::uint64_t readVersion() const
Returns the "read version" if known; otherwise returns 0.
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Contains all classes and functions of the TagInfo library.