1#ifndef TAG_PARSER_ABSTRACTATTACHMENT_H
2#define TAG_PARSER_ABSTRACTATTACHMENT_H
13class AbortableProgressFeedback;
18 StreamDataBlock(
const std::function<std::istream &()> &stream, uint64_t startOffset = 0, std::ios_base::seekdir startDir = std::ios_base::beg,
19 uint64_t endOffset = 0, std::ios_base::seekdir endDir = std::ios_base::end);
22 std::istream &stream()
const;
23 std::uint64_t startOffset()
const;
24 std::uint64_t endOffset()
const;
25 std::uint64_t size()
const;
26 const std::unique_ptr<char[]> &buffer()
const;
27 void makeBuffer()
const;
29 void copyTo(std::ostream &stream)
const;
34 std::function<std::istream &()> m_stream;
97 std::unique_ptr<MediaFileInfo> m_fileInfo;
102 return m_fileInfo.get();
109 const std::string &description()
const;
110 void setDescription(std::string_view description);
111 const std::string &name()
const;
112 void setName(std::string_view name);
113 const std::string &mimeType()
const;
114 void setMimeType(std::string_view mimeType);
115 std::uint64_t id()
const;
116 void setId(std::uint64_t
id);
118 void setData(std::unique_ptr<StreamDataBlock> &&data);
120 bool isDataFromFile()
const;
121 std::string label()
const;
123 bool isIgnored()
const;
124 void setIgnored(
bool ignored);
125 bool isEmpty()
const;
132 std::string m_description;
134 std::string m_mimeType;
136 std::unique_ptr<StreamDataBlock> m_data;
137 std::unique_ptr<AbstractAttachmentPrivate> m_p;
138 bool m_isDataFromFile;
147 return m_description;
225 m_data = std::move(
data);
226 m_isDataFromFile =
false;
234 return m_isDataFromFile;
264 return m_description.empty() && m_name.empty() && !m_mimeType.empty() && !m_data;
The AbortableProgressFeedback class provides feedback about an ongoing operation via callbacks.
The AbstractAttachment class parses and stores attachment information.
bool isEmpty() const
Returns whether the attachment is empty (no data and no meta-data assigned).
void setDescription(std::string_view description)
Sets a description of the attachment.
const std::string & mimeType() const
Returns the MIME-type of the attachment.
const std::string & description() const
Returns a description of the attachment.
void setData(std::unique_ptr< StreamDataBlock > &&data)
Sets the data for the attachment.
const std::string & name() const
Returns the (file) name of the attachment.
std::uint64_t id() const
Returns the ID of the attachment.
bool isDataFromFile() const
Returns whether the assigned data has been assigned using the setFile() method.
void setName(std::string_view name)
Sets the (file) name of the attachment.
void setIgnored(bool ignored)
Sets whether the attachment is ignored/omitted when rewriting the container.
bool isIgnored() const
Returns whether the attachment is ignored/omitted when rewriting the container.
void setId(std::uint64_t id)
Sets the ID of the attachment.
const StreamDataBlock * data() const
Returns a reference to the data of the attachment.
void setMimeType(std::string_view mimeType)
Sets the MIME-type of the attachment.
The Diagnostics class is a container for DiagMessage.
The FileDataBlock class is a reference to a certain data block of a file stream.
const MediaFileInfo * fileInfo() const
The StreamDataBlock class is a reference to a certain data block of a stream.
std::uint64_t m_startOffset
std::uint64_t m_endOffset
std::unique_ptr< char[]> m_buffer
const std::unique_ptr< char[]> & buffer() const
Returns the data buffered via makeBuffer().
std::uint64_t startOffset() const
Returns the absolute start offset of the data block in the stream.
std::uint64_t size() const
Returns the size of the data block.
StreamDataBlock(const std::function< std::istream &()> &stream, uint64_t startOffset=0, std::ios_base::seekdir startDir=std::ios_base::beg, uint64_t endOffset=0, std::ios_base::seekdir endDir=std::ios_base::end)
std::istream & stream() const
Returns the associated stream.
void discardBuffer()
Discards buffered data.
std::uint64_t endOffset() const
Returns the absolute end offset of the data block in the stream.
std::function< std::istream &()> m_stream
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Contains all classes and functions of the TagInfo library.
The AbstractAttachmentPrivate struct contains private fields of the AbstractAttachment class.