]> granicus.if.org Git - taglib/commitdiff
Add a simple function for checking for membership in the fieldListMap.
authorScott Wheeler <wheeler@kde.org>
Sun, 13 Aug 2006 15:19:36 +0000 (15:19 +0000)
committerScott Wheeler <wheeler@kde.org>
Sun, 13 Aug 2006 15:19:36 +0000 (15:19 +0000)
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@572680 283d02a7-25f6-0310-bc7c-ecb5cbfe19da

ogg/xiphcomment.cpp
ogg/xiphcomment.h

index e1fe67afc42e4f2009477612d90eca12fafe6dab..2de04cd5335fab52bd39f87ce1b8c47996f3e1cd 100644 (file)
@@ -205,6 +205,11 @@ void Ogg::XiphComment::removeField(const String &key, const String &value)
     d->fieldListMap[key].clear();
 }
 
+bool Ogg::XiphComment::contains(const String &key) const
+{
+  return d->fieldListMap.contains(key) && !d->fieldListMap[key].isEmpty();
+}
+
 ByteVector Ogg::XiphComment::render() const
 {
   return render(true);
index dbcde9d5e61f89fe463a8526a0df64f650108347..b94b565dadfaed9c0cf9a2c1872f9c36390ac634 100644 (file)
@@ -156,6 +156,13 @@ namespace TagLib {
        */
       void removeField(const String &key, const String &value = String::null);
 
+      /*!
+       * Returns true if the field is contained within the comment.
+       *
+       * \note This is safer than checking for membership in the FieldListMap. 
+       */
+      bool contains(const String &key) const;
+
       /*!
        * Renders the comment to a ByteVector suitable for inserting into a file.
        */