1 #ifndef TAG_PARSER_ABSTRACTATTACHMENT_H 2 #define TAG_PARSER_ABSTRACTATTACHMENT_H 17 StreamDataBlock(
const std::function<std::istream &()> &stream, std::istream::off_type startOffset = 0,
18 std::ios_base::seekdir startDir = std::ios_base::beg, std::istream::off_type endOffset = 0,
19 std::ios_base::seekdir endDir = std::ios_base::end);
21 std::istream &stream()
const;
22 std::istream::pos_type startOffset()
const;
23 std::istream::pos_type endOffset()
const;
24 std::istream::pos_type size()
const;
25 const std::unique_ptr<char[]> &buffer()
const;
26 void makeBuffer()
const;
28 void copyTo(std::ostream &stream)
const;
95 std::unique_ptr<MediaFileInfo> m_fileInfo;
100 return m_fileInfo.get();
106 void setDescription(
const std::string &
description);
107 const std::string &name()
const;
108 void setName(
const std::string &name);
109 const std::string &mimeType()
const;
110 void setMimeType(
const std::string &mimeType);
112 void setId(
const uint64 &
id);
114 void setData(std::unique_ptr<StreamDataBlock> &&data);
115 void setFile(
const std::string &path,
Diagnostics &diag);
116 bool isDataFromFile()
const;
117 std::string
label()
const;
119 bool isIgnored()
const;
120 void setIgnored(
bool ignored);
121 bool isEmpty()
const;
127 std::string m_description;
129 std::string m_mimeType;
131 std::unique_ptr<StreamDataBlock> m_data;
132 bool m_isDataFromFile;
141 , m_isDataFromFile(false)
151 return m_description;
229 m_data = std::move(
data);
230 m_isDataFromFile =
false;
238 return m_isDataFromFile;
268 return m_description.empty() && m_name.empty() && !m_mimeType.empty() && !m_data;
273 #endif // TAG_PARSER_ABSTRACTATTACHMENT_H const MediaFileInfo * fileInfo() const
TAG_PARSER_EXPORT const char * description()
const std::unique_ptr< char[]> & buffer() const
Returns the data buffered via makeBuffer().
void setDescription(const std::string &description)
Sets a description of the attachment.
std::unique_ptr< char[]> m_buffer
const std::string & description() const
Returns a description of the attachment.
bool isEmpty() const
Returns whether the attachment is empty (no data and no meta-data assigned).
AbstractAttachment()
Constructs a new attachment.
const StreamDataBlock * data() const
Returns a reference to the data of the attachment.
void setIgnored(bool ignored)
Sets whether the attachment is ignored/omitted when rewriting the container.
void setData(std::unique_ptr< StreamDataBlock > &&data)
Sets the data for the attachment.
uint64 id() const
Returns the ID of the attachment.
const std::string & name() const
Returns the (file) name of the attachment.
void setId(const uint64 &id)
Sets the ID of the attachment.
std::istream::pos_type endOffset() const
Returns the absolute end offset of the data block in the stream.
bool isDataFromFile() const
Returns whether the assigned data has been assigned using the setFile() method.
void discardBuffer()
Discards buffered data.
std::istream::pos_type m_endOffset
void setMimeType(const std::string &mimeType)
Sets the MIME-type of the attachment.
std::function< std::istream &()> m_stream
bool isIgnored() const
Returns whether the attachment is ignored/omitted when rewriting the container.
std::istream::pos_type startOffset() const
Returns the absolute start offset of the data block in the stream.
std::istream::pos_type size() const
Returns the size of the data block.
std::istream & stream() const
Returns the associated stream.
void setName(const std::string &name)
Sets the (file) name of the attachment.
const std::string & mimeType() const
Returns the MIME-type of the attachment.
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
std::istream::pos_type m_startOffset