Tag Parser
9.4.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
|
Go to the documentation of this file. 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);
22 std::istream &stream()
const;
23 std::istream::pos_type startOffset()
const;
24 std::istream::pos_type endOffset()
const;
25 std::istream::pos_type 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();
108 void setDescription(
const std::string &
description);
109 const std::string &name()
const;
110 void setName(
const std::string &name);
111 const std::string &mimeType()
const;
112 void setMimeType(
const std::string &mimeType);
113 std::uint64_t id()
const;
114 void setId(
const std::uint64_t &
id);
116 void setData(std::unique_ptr<StreamDataBlock> &&data);
117 void setFile(
const std::string &path,
Diagnostics &diag);
118 bool isDataFromFile()
const;
119 std::string
label()
const;
121 bool isIgnored()
const;
122 void setIgnored(
bool ignored);
123 bool isEmpty()
const;
129 std::string m_description;
131 std::string m_mimeType;
133 std::unique_ptr<StreamDataBlock> m_data;
134 bool m_isDataFromFile;
143 , m_isDataFromFile(false)
153 return m_description;
231 m_data = std::move(
data);
232 m_isDataFromFile =
false;
240 return m_isDataFromFile;
270 return m_description.empty() && m_name.empty() && !m_mimeType.empty() && !m_data;
275 #endif // TAG_PARSER_ABSTRACTATTACHMENT_H
void setMimeType(const std::string &mimeType)
Sets the MIME-type of the attachment.
bool isIgnored() const
Returns whether the attachment is ignored/omitted when rewriting the container.
void setIgnored(bool ignored)
Sets whether the attachment is ignored/omitted when rewriting the container.
The AbstractAttachment class parses and stores attachment information.
constexpr TAG_PARSER_EXPORT const char * description()
std::istream::pos_type startOffset() const
Returns the absolute start offset of the data block in the stream.
std::istream & stream() const
Returns the associated stream.
std::istream::pos_type size() const
Returns the size of the data block.
const std::string & name() const
Returns the (file) name of the attachment.
void setName(const std::string &name)
Sets the (file) name of the attachment.
void setId(const std::uint64_t &id)
Sets the ID of the attachment.
void setDescription(const std::string &description)
Sets a description of the attachment.
const std::string & mimeType() const
Returns the MIME-type of the attachment.
The Diagnostics class is a container for DiagMessage.
bool isDataFromFile() const
Returns whether the assigned data has been assigned using the setFile() method.
std::uint64_t id() const
Returns the ID of the attachment.
Contains all classes and functions of the TagInfo library.
std::istream::pos_type m_endOffset
bool isEmpty() const
Returns whether the attachment is empty (no data and no meta-data assigned).
std::istream::pos_type m_startOffset
const std::unique_ptr< char[]> & buffer() const
Returns the data buffered via makeBuffer().
void discardBuffer()
Discards buffered data.
std::function< std::istream &()> m_stream
The StreamDataBlock class is a reference to a certain data block of a stream.
The FileDataBlock class is a reference to a certain data block of a file stream.
void setData(std::unique_ptr< StreamDataBlock > &&data)
Sets the data for the attachment.
const std::string & description() const
Returns a description of the attachment.
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
AbstractAttachment()
Constructs a new attachment.
StreamDataBlock(const std::function< std::istream &()> &stream, std::istream::off_type startOffset=0, std::ios_base::seekdir startDir=std::ios_base::beg, std::istream::off_type endOffset=0, std::ios_base::seekdir endDir=std::ios_base::end)
const StreamDataBlock * data() const
Returns a reference to the data of the attachment.
std::unique_ptr< char[]> m_buffer
std::istream::pos_type endOffset() const
Returns the absolute end offset of the data block in the stream.
const MediaFileInfo * fileInfo() const