diff --git a/ape/apeitem.cpp b/ape/apeitem.cpp index 03e61597..e45761ac 100644 --- a/ape/apeitem.cpp +++ b/ape/apeitem.cpp @@ -102,9 +102,37 @@ String APE::Item::key() const ByteVector APE::Item::value() const { + // This seems incorrect as it won't be actually rendering the value to keep it + // up to date. + return d->value; } +void APE::Item::setKey(const String &key) +{ + d->key = key; +} + +void APE::Item::setValue(const String &value) +{ + d->text = value; +} + +void APE::Item::setValues(const StringList &value) +{ + d->text = value; +} + +void APE::Item::appendValue(const String &value) +{ + d->text.append(value); +} + +void APE::Item::appendValues(const StringList &values) +{ + d->text.append(values); +} + int APE::Item::size() const { return 8 + d->key.size() + 1 + d->value.size(); diff --git a/ape/apeitem.h b/ape/apeitem.h index 63487655..dd9fa298 100644 --- a/ape/apeitem.h +++ b/ape/apeitem.h @@ -86,9 +86,47 @@ namespace TagLib { /*! * Returns the binary value. + * + * \deprecated This will be removed in the next binary incompatible version + * as it is not kept in sync with the things that are set using setValue() + * and friends. */ ByteVector value() const; + /*! + * Sets the key for the item to \a key. + */ + void setKey(const String &key); + + /*! + * Sets the value of the item to \a value and clears any previous contents. + * + * \see toString() + */ + void setValue(const String &value); + + /*! + * Sets the value of the item to the list of values in \a value and clears + * any previous contents. + * + * \see toStringList() + */ + void setValues(const StringList &values); + + /*! + * Appends \a value to create (or extend) the current list of values. + * + * \see toString() + */ + void appendValue(const String &value); + + /*! + * Appends \a values to extend the current list of values. + * + * \see toStringList() + */ + void appendValues(const StringList &values); + /*! * Returns the size of the full item. */ diff --git a/ape/apetag.cpp b/ape/apetag.cpp index 3fecad8b..58ca1389 100644 --- a/ape/apetag.cpp +++ b/ape/apetag.cpp @@ -186,7 +186,7 @@ void APE::Tag::addValue(const String &key, const String &value, bool replace) removeItem(key); if(!value.isEmpty()) { if(d->itemListMap.contains(key) || !replace) - d->itemListMap[key.upper()].toStringList().append(value); + d->itemListMap[key.upper()].appendValue(value); else setItem(key, Item(key, value)); }