Make removeField() actually remove the map content, not just

empty the list.  Also added an erase method to Map that works on keys
rather than itterators.


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@572681 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
This commit is contained in:
Scott Wheeler 2006-08-13 15:25:48 +00:00
parent 953b8a119a
commit 071c691a9a
3 changed files with 14 additions and 1 deletions

View File

@ -202,7 +202,7 @@ void Ogg::XiphComment::removeField(const String &key, const String &value)
}
}
else
d->fieldListMap[key].clear();
d->fieldListMap.erase(key);
}
bool Ogg::XiphComment::contains(const String &key) const

View File

@ -131,6 +131,11 @@ namespace TagLib {
*/
Map<Key, T> &erase(Iterator it);
/*!
* Erase the item with \a key from the list.
*/
Map<Key, T> &erase(const Key &key);
/*!
* Returns a reference to the value associated with \a key.
*

View File

@ -130,6 +130,14 @@ Map<Key, T> &Map<Key,T>::erase(Iterator it)
return *this;
}
template <class Key, class T>
Map<Key, T> &Map<Key,T>::erase(const Key &key)
{
detach();
d->map.erase(find(key));
return *this;
}
template <class Key, class T>
TagLib::uint Map<Key, T>::size() const
{