Fix up the stuff here for appending values to an APE::Item and round out the API a bit.

Based on Michael's patch...

BUG:120256


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@503255 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
This commit is contained in:
Scott Wheeler 2006-01-28 15:18:31 +00:00
parent 4841a5c39c
commit 99fbe7ff25
3 changed files with 67 additions and 1 deletions

View File

@ -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();

View File

@ -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.
*/

View File

@ -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));
}