1 #ifndef TAG_PARSER_TAGVALUE_H 2 #define TAG_PARSER_TAGVALUE_H 6 #include <c++utilities/chrono/datetime.h> 7 #include <c++utilities/chrono/timespan.h> 8 #include <c++utilities/conversion/binaryconversion.h> 92 void clearDataAndMetadata();
98 int32 toInteger()
const;
99 int toStandardGenreIndex()
const;
103 std::size_t dataSize()
const;
105 const char *dataPointer()
const;
108 const std::string &mimeType()
const;
109 void setMimeType(
const std::string &mimeType);
110 const std::string &
language()
const;
111 void setLanguage(
const std::string &
language);
112 bool isLabeledAsReadonly()
const;
113 void setReadonly(
bool readOnly);
116 void convertDataEncodingForTag(
const Tag *tag);
124 void assignInteger(
int value);
125 void assignStandardGenreIndex(
int index);
133 static void stripBom(
const char *&text, std::size_t &length,
TagTextEncoding encoding);
134 static void ensureHostByteOrder(std::u16string &u16str,
TagTextEncoding currentEncoding);
137 std::unique_ptr<char[]> m_ptr;
140 std::string m_mimeType;
141 std::string m_language;
145 bool m_labeledAsReadonly;
156 , m_labeledAsReadonly(false)
179 , m_labeledAsReadonly(false)
181 assignText(text, textSize, textEncoding, convertTo);
195 assignText(text, std::strlen(text), textEncoding, convertTo);
209 , m_labeledAsReadonly(false)
235 , m_encoding(encoding)
237 , m_labeledAsReadonly(false)
243 m_ptr = std::make_unique<char[]>(m_size);
244 std::copy(data, data + m_size, m_ptr.get());
263 , m_encoding(encoding)
265 , m_labeledAsReadonly(false)
288 return !(*
this == other);
302 assignText(text.data(), text.size(), textEncoding, convertTo);
386 return m_ptr ==
nullptr || m_size == 0;
459 m_descEncoding = encoding;
514 return m_labeledAsReadonly;
527 m_labeledAsReadonly = readOnly;
547 return m_descEncoding;
552 #endif // TAG_PARSER_TAGVALUE_H TAG_PARSER_EXPORT const char * language()
TagTextEncoding dataEncoding() const
Returns the data encoding.
TAG_PARSER_EXPORT const char * description()
static void stripBom(const char *&text, std::size_t &length, TagTextEncoding encoding)
Strips the byte order mask from the specified text.
The Tag class is used to store, read and write tag information.
TagTextEncoding descriptionEncoding() const
Returns the description encoding.
const std::string & description() const
Returns the description.
void setMimeType(const std::string &mimeType)
Sets the MIME type.
void setReadonly(bool readOnly)
Sets whether the TagValue is labeled as read-only.
std::u16string toWString(TagTextEncoding encoding=TagTextEncoding::Unspecified) const
Converts the value of the current TagValue object to its equivalent std::wstring representation.
bool operator!=(const TagValue &other) const
Returns whether both instances are not equal.
The PositionInSet class describes the position of an element in a set which consists of a certain num...
TagDataType
Specifies the data type.
void clearDataAndMetadata()
Wipes assigned data including meta data.
constexpr bool operator==(byte lhs, FlacMetaDataBlockType type)
bool isEmpty() const
Returns an indication whether an value is assigned.
const std::string & mimeType() const
Returns the MIME type.
std::size_t dataSize() const
Returns the size of the assigned value in bytes.
constexpr bool operator!=(byte lhs, FlacMetaDataBlockType type)
void assignDateTime(ChronoUtilities::DateTime value)
Assigns the given DateTime value.
void clearMetadata()
Wipes assigned meta data.
const std::string & language() const
Returns the language.
void assignPosition(PositionInSet value)
Assigns the given PositionInSet value.
void assignStandardGenreIndex(int index)
Assigns the given standard genre index to be assigned.
~TagValue()
Destroys the TagValue.
TagValue()
Constructs an empty TagValue.
void setLanguage(const std::string &language)
Sets the language.
char * dataPointer()
Returns a pointer to the raw data assigned to the current instance.
constexpr bool isNull() const
Returns an indication whether both the element position and total element count is 0...
TagDataType type() const
Returns the type of the assigned value.
void assignInteger(int value)
Assigns the given integer value.
void assignText(const char *text, std::size_t textSize, TagTextEncoding textEncoding=TagTextEncoding::Latin1, TagTextEncoding convertTo=TagTextEncoding::Unspecified)
Assigns a copy of the given text.
void clearData()
Clears the assigned data.
bool isLabeledAsReadonly() const
Returns an indication whether the value is labeled as read-only.
void setDescription(const std::string &value, TagTextEncoding encoding=TagTextEncoding::Latin1)
Sets the description.
void assignData(const char *data, std::size_t length, TagDataType type=TagDataType::Binary, TagTextEncoding encoding=TagTextEncoding::Latin1)
std::string toString(TagTextEncoding encoding=TagTextEncoding::Unspecified) const
Converts the value of the current TagValue object to its equivalent std::string representation.
void assignTimeSpan(ChronoUtilities::TimeSpan value)
Assigns the given TimeSpan value.
constexpr int characterSize(TagTextEncoding encoding)
Returns the size of one character for the specified encoding in bytes.
The TagValue class wraps values of different types.
TagTextEncoding
Specifies the text encoding.
Contains all classes and functions of the TagInfo library.
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.