当前位置: 首页>>代码示例>>C++>>正文


C++ PropertyMap::erase方法代码示例

本文整理汇总了C++中PropertyMap::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertyMap::erase方法的具体用法?C++ PropertyMap::erase怎么用?C++ PropertyMap::erase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PropertyMap的用法示例。


在下文中一共展示了PropertyMap::erase方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: copy

  void testDictInterface2()
  {
    ScopedFileCopy copy("test", ".ogg");
    string newname = copy.fileName();

    Vorbis::File *f = new Vorbis::File(newname.c_str());
    PropertyMap tags = f->tag()->properties();

    CPPUNIT_ASSERT_EQUAL(TagLib::uint(2), tags["UNUSUALTAG"].size());
    CPPUNIT_ASSERT_EQUAL(String("usual value"), tags["UNUSUALTAG"][0]);
    CPPUNIT_ASSERT_EQUAL(String("another value"), tags["UNUSUALTAG"][1]);
    CPPUNIT_ASSERT_EQUAL(
      String("\xC3\xB6\xC3\xA4\xC3\xBC\x6F\xCE\xA3\xC3\xB8", String::UTF8),
      tags["UNICODETAG"][0]);

    tags["UNICODETAG"][0] = String(
      "\xCE\xBD\xCE\xB5\xCF\x89\x20\xCE\xBD\xCE\xB1\xCE\xBB\xCF\x85\xCE\xB5", String::UTF8);
    tags.erase("UNUSUALTAG");
    f->tag()->setProperties(tags);
    CPPUNIT_ASSERT_EQUAL(
      String("\xCE\xBD\xCE\xB5\xCF\x89\x20\xCE\xBD\xCE\xB1\xCE\xBB\xCF\x85\xCE\xB5", String::UTF8),
      f->tag()->properties()["UNICODETAG"][0]);
    CPPUNIT_ASSERT_EQUAL(false, f->tag()->properties().contains("UNUSUALTAG"));

    delete f;
  }
开发者ID:Azaraf,项目名称:taglib,代码行数:26,代码来源:test_ogg.cpp

示例2: testInsertAndExtract

  void testInsertAndExtract()
  {
    ScopedFileCopy copy("matroska", ".mka");
    string filename = copy.fileName();

    {
      EBML::Matroska::File f1(filename.c_str());
      CPPUNIT_ASSERT(f1.isValid());

      Tag* t = f1.tag();

      CPPUNIT_ASSERT(t != 0);
      t->setTitle("Seconds of Silence");
      t->setArtist("Nobody");
      t->setAlbum("TagLib Test Suite");
      t->setComment("Well, there's nothing to say - a few special signs: ©’…ä–€ſ");
      t->setGenre("Air");
      t->setYear(2013);
      t->setTrack(15);

      CPPUNIT_ASSERT(f1.save());
    }
    {
      EBML::Matroska::File f2(filename.c_str());
      CPPUNIT_ASSERT(f2.isValid());

      Tag* t = f2.tag();

      CPPUNIT_ASSERT(t != 0);
      CPPUNIT_ASSERT_EQUAL(String("Seconds of Silence"), t->title());
      CPPUNIT_ASSERT_EQUAL(String("Nobody"), t->artist());
      CPPUNIT_ASSERT_EQUAL(String("TagLib Test Suite"), t->album());
      CPPUNIT_ASSERT_EQUAL(String("Well, there's nothing to say - a few special signs: ©’…ä–€ſ"), t->comment());
      CPPUNIT_ASSERT_EQUAL(String("Air"), t->genre());
      CPPUNIT_ASSERT_EQUAL(2013u, t->year());
      CPPUNIT_ASSERT_EQUAL(15u, t->track());

      PropertyMap pm = f2.properties();
      pm.erase("COMMENT");
      f2.setProperties(pm);

      CPPUNIT_ASSERT(f2.save());
    }

    {
      EBML::Matroska::File f3(filename.c_str());
      CPPUNIT_ASSERT(f3.isValid());

      PropertyMap pm = f3.properties();
      PropertyMap::Iterator i = pm.find("GENRE");

      CPPUNIT_ASSERT(i != pm.end());
      CPPUNIT_ASSERT_EQUAL(String("Air"), i->second.front());
    }
  }
开发者ID:Linko91,项目名称:node-taglib2,代码行数:55,代码来源:test_matroska.cpp

示例3: unshare

void
Event::unset(const PropertyName &name)
{
#ifndef NDEBUG
    ++m_unsetCount;
#endif

    unshare();
    PropertyMap::iterator i;
    PropertyMap *map = find(name, i);
    if (map) {
	delete i->second;
	map->erase(i);
    }
}
开发者ID:tedfelix,项目名称:rosegarden,代码行数:15,代码来源:Event.cpp


注:本文中的PropertyMap::erase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。