]> granicus.if.org Git - taglib/commitdiff
Added a missing fieldListmap() method to RIFF::Info::Tag
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Tue, 17 Sep 2013 05:59:19 +0000 (14:59 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Tue, 17 Sep 2013 05:59:19 +0000 (14:59 +0900)
taglib/riff/wav/infotag.cpp
taglib/riff/wav/infotag.h
tests/CMakeLists.txt
tests/test_info.cpp

index 658ede886f1c31be0aec7afda959feca4beb8a4a..09edfa53c71a14f0b7a9b755d2a457dfe76edfdb 100644 (file)
@@ -185,6 +185,11 @@ bool RIFF::Info::Tag::isEmpty() const
   return d->fieldListMap.isEmpty();
 }
 
+FieldListMap RIFF::Info::Tag::fieldListMap() const
+{
+  return d->fieldListMap;
+}
+
 String RIFF::Info::Tag::fieldText(const ByteVector &id) const
 {
   if(d->fieldListMap.contains(id))
index 9a26d4cb45ca08a361c1e0d751c6c89754e2c94f..4007ae66103abb7812cf6eca42052ba1420de1c5 100644 (file)
@@ -120,6 +120,18 @@ namespace TagLib {
 
       virtual bool isEmpty() const;
 
+      /*!
+       * Returns a copy of the internal fields of the tag.  The returned map directly 
+       * reflects the contents of the "INFO" chunk.
+       *
+       * \note Modifying this map does not affect the tag's internal data.
+       * Use setFieldText() and removeField() instead.
+       *
+       * \see setFieldText()
+       * \see removeField()
+       */
+      FieldListMap fieldListMap() const;
+
       /*
        * Gets the value of the field with the ID \a id.
        */
index 4e428af81f643c18a463015774bda9758473e261..7a3d0bd51029a82a54b4ec4ecd273d819450649c 100644 (file)
@@ -52,6 +52,7 @@ SET(test_runner_SRCS
   test_ape.cpp
   test_apetag.cpp
   test_wav.cpp
+  test_info.cpp
   test_wavpack.cpp
   test_mp4.cpp
   test_mp4item.cpp
index f76fd67ac7394560ddcf0f20a2ddeb78c6ebc7f0..8e0d71548d49e07a97faead49372eed646d256f2 100644 (file)
@@ -1,9 +1,7 @@
-#include <cppunit/extensions/HelperMacros.h>
 #include <string>
 #include <stdio.h>
 #include <infotag.h>
-#include <tpropertymap.h>
-#include <tdebug.h>
+#include <cppunit/extensions/HelperMacros.h>
 #include "utils.h"
 
 using namespace std;
@@ -23,7 +21,13 @@ public:
 
     CPPUNIT_ASSERT_EQUAL(String(""), tag.title());
     tag.setTitle("Test title 1");
+    tag.setFieldText("TEST", "Dummy Text");
+
     CPPUNIT_ASSERT_EQUAL(String("Test title 1"), tag.title());
+    
+    RIFF::Info::FieldListMap map = tag.fieldListMap();
+    CPPUNIT_ASSERT_EQUAL(String("Test title 1"), map["INAM"]);
+    CPPUNIT_ASSERT_EQUAL(String("Dummy Text"), map["TEST"]);
   }
 
   void testNumericFields()