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> 90 void clearDataAndMetadata();
96 int32 toInteger()
const;
97 int toStandardGenreIndex()
const;
101 std::size_t dataSize()
const;
103 const char *dataPointer()
const;
106 const std::string &mimeType()
const;
107 void setMimeType(
const std::string &mimeType);
108 const std::string &
language()
const;
109 void setLanguage(
const std::string &
language);
110 bool isLabeledAsReadonly()
const;
111 void setReadonly(
bool readOnly);
114 void convertDataEncodingForTag(
const Tag *tag);
122 void assignInteger(
int value);
123 void assignStandardGenreIndex(
int index);
131 static void stripBom(
const char *&text,
size_t &length,
TagTextEncoding encoding);
132 static void ensureHostByteOrder(std::u16string &u16str,
TagTextEncoding currentEncoding);
135 std::unique_ptr<char[]> m_ptr;
138 std::string m_mimeType;
139 std::string m_language;
143 bool m_labeledAsReadonly;
154 , m_labeledAsReadonly(false)
177 , m_labeledAsReadonly(false)
179 assignText(text, textSize, textEncoding, convertTo);
193 , m_labeledAsReadonly(false)
219 , m_encoding(encoding)
221 , m_labeledAsReadonly(false)
227 m_ptr = std::make_unique<char[]>(m_size);
228 std::copy(data, data + m_size, m_ptr.get());
247 , m_encoding(encoding)
249 , m_labeledAsReadonly(false)
271 return !(*
this == other);
285 assignText(text.data(), text.size(), textEncoding, convertTo);
369 return m_ptr ==
nullptr || m_size == 0;
442 m_descEncoding = encoding;
497 return m_labeledAsReadonly;
510 m_labeledAsReadonly = readOnly;
530 return m_descEncoding;
535 #endif // TAG_PARSER_TAGVALUE_H TAG_PARSER_EXPORT const char * language()
TagTextEncoding dataEncoding() const
Returns the data encoding.
TAG_PARSER_EXPORT const char * description()
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.
std::size_t dataSize() const
Returns the size of the assigned value in bytes.
bool operator!=(const TagValue &other) const
Returns whether both instances are not equal.
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.
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.
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.
static void stripBom(const char *&text, size_t &length, TagTextEncoding encoding)
Strips the byte order mask from the specified text.
void assignData(const char *data, size_t length, TagDataType type=TagDataType::Binary, TagTextEncoding encoding=TagTextEncoding::Latin1)
Assigns a copy of the given data.
TagTextEncoding
Specifies the text encoding.
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.