• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ ape::Tag类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ape::Tag的典型用法代码示例。如果您正苦于以下问题:C++ Tag类的具体用法?C++ Tag怎么用?C++ Tag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1:

 void testIsEmpty2()
 {
   APE::Tag tag;
   CPPUNIT_ASSERT(tag.isEmpty());
   tag.setArtist("Mike Oldfield");
   CPPUNIT_ASSERT(!tag.isEmpty());
 }
开发者ID:JohnCheNey,项目名称:taglib,代码行数:7,代码来源:test_apetag.cpp


示例2: testIsEmpty

 void testIsEmpty()
 {
   APE::Tag tag;
   CPPUNIT_ASSERT(tag.isEmpty());
   tag.addValue("COMPOSER", "Mike Oldfield");
   CPPUNIT_ASSERT(!tag.isEmpty());
 }
开发者ID:JohnCheNey,项目名称:taglib,代码行数:7,代码来源:test_apetag.cpp


示例3: testInvalidKeys

  void testInvalidKeys()
  {
    PropertyMap properties;
    properties["A"] = String("invalid key: one character");
    properties["MP+"] = String("invalid key: forbidden string");
    properties["A B~C"] = String("valid key: space and tilde");
    properties["ARTIST"] = String("valid key: normal one");

    APE::Tag tag;
    PropertyMap unsuccessful = tag.setProperties(properties);
    CPPUNIT_ASSERT_EQUAL((unsigned int)2, unsuccessful.size());
    CPPUNIT_ASSERT(unsuccessful.contains("A"));
    CPPUNIT_ASSERT(unsuccessful.contains("MP+"));
  }
开发者ID:DiodeZ,项目名称:taglib,代码行数:14,代码来源:test_apetag.cpp


示例4: String

 void testPropertyInterface1()
 {
   APE::Tag tag;
   PropertyMap dict = tag.properties();
   CPPUNIT_ASSERT(dict.isEmpty());
   dict["ARTIST"] = String("artist 1");
   dict["ARTIST"].append("artist 2");
   dict["TRACKNUMBER"].append("17");
   tag.setProperties(dict);
   CPPUNIT_ASSERT_EQUAL(String("17"), tag.itemListMap()["TRACK"].values()[0]);
   CPPUNIT_ASSERT_EQUAL(2u, tag.itemListMap()["ARTIST"].values().size());
   CPPUNIT_ASSERT_EQUAL(String("artist 1 artist 2"), tag.artist());
   CPPUNIT_ASSERT_EQUAL(17u, tag.track());
 }
开发者ID:JohnCheNey,项目名称:taglib,代码行数:14,代码来源:test_apetag.cpp


示例5: testInvalidKeys

  void testInvalidKeys()
  {
    PropertyMap properties;
    properties["A"] = String("invalid key: one character");
    properties["MP+"] = String("invalid key: forbidden string");
    properties["A B~C"] = String("valid key: space and tilde");
    properties["ARTIST"] = String("valid key: normal one");

    APE::Tag tag;
    PropertyMap unsuccessful = tag.setProperties(properties);
    CPPUNIT_ASSERT_EQUAL((unsigned int)2, unsuccessful.size());
    CPPUNIT_ASSERT(unsuccessful.contains("A"));
    CPPUNIT_ASSERT(unsuccessful.contains("MP+"));

    CPPUNIT_ASSERT_EQUAL((unsigned int)2, tag.itemListMap().size());
    tag.addValue("VALID KEY", "Test Value 1");
    tag.addValue("INVALID KEY \x7f", "Test Value 2");
    CPPUNIT_ASSERT_EQUAL((unsigned int)3, tag.itemListMap().size());
  }
开发者ID:JohnCheNey,项目名称:taglib,代码行数:19,代码来源:test_apetag.cpp


示例6: strip

bool MPEG::File::save(int tags, bool stripOthers, int id3v2Version, bool duplicateTags)
{
  if(tags == NoTags && stripOthers)
    return strip(AllTags);

  if(!ID3v2Tag() && !ID3v1Tag() && !APETag()) {

    if((d->hasID3v1 || d->hasID3v2 || d->hasAPE) && stripOthers)
      return strip(AllTags);

    return true;
  }

  if(readOnly()) {
    debug("MPEG::File::save() -- File is read only.");
    return false;
  }

  // Create the tags if we've been asked to.

  if (duplicateTags) {

    // Copy the values from the tag that does exist into the new tag,
    // except if the existing tag is to be stripped.

    if((tags & ID3v2) && ID3v1Tag() && !(stripOthers && !(tags & ID3v1)))
      Tag::duplicate(ID3v1Tag(), ID3v2Tag(true), false);

    if((tags & ID3v1) && d->tag[ID3v2Index] && !(stripOthers && !(tags & ID3v2)))
      Tag::duplicate(ID3v2Tag(), ID3v1Tag(true), false);
  }

  bool success = true;

  if(ID3v2 & tags) {

    if(ID3v2Tag() && !ID3v2Tag()->isEmpty()) {

      if(!d->hasID3v2)
        d->ID3v2Location = 0;

      insert(ID3v2Tag()->render(id3v2Version), d->ID3v2Location, d->ID3v2OriginalSize);

      d->hasID3v2 = true;

      // v1 tag location has changed, update if it exists

      if(ID3v1Tag())
        d->ID3v1Location = findID3v1();

      // APE tag location has changed, update if it exists

      if(APETag())
        findAPE();
    }
    else if(stripOthers)
      success = strip(ID3v2, false) && success;
  }
  else if(d->hasID3v2 && stripOthers)
    success = strip(ID3v2) && success;

  if(ID3v1 & tags) {
    if(ID3v1Tag() && !ID3v1Tag()->isEmpty()) {
      int offset = d->hasID3v1 ? -128 : 0;
      seek(offset, End);
      writeBlock(ID3v1Tag()->render());
      d->hasID3v1 = true;
      d->ID3v1Location = findID3v1();
    }
    else if(stripOthers)
      success = strip(ID3v1) && success;
  }
  else if(d->hasID3v1 && stripOthers)
    success = strip(ID3v1, false) && success;

  // Dont save an APE-tag unless one has been created

  if((APE & tags) && APETag()) {
    if(d->hasAPE)
      insert(APETag()->render(), d->APELocation, d->APEOriginalSize);
    else {
      if(d->hasID3v1) {
        insert(APETag()->render(), d->ID3v1Location, 0);
        d->APEOriginalSize = APETag()->footer()->completeTagSize();
        d->hasAPE = true;
        d->APELocation = d->ID3v1Location;
        d->ID3v1Location += d->APEOriginalSize;
      }
      else {
        seek(0, End);
        d->APELocation = tell();
        APE::Tag *apeTag = d->tag.access<APE::Tag>(APEIndex, false);
        d->APEFooterLocation = d->APELocation
                               + apeTag->footer()->completeTagSize()
                               - APE::Footer::size();
        writeBlock(APETag()->render());
        d->APEOriginalSize = APETag()->footer()->completeTagSize();
        d->hasAPE = true;
      }
    }
//.........这里部分代码省略.........
开发者ID:lufinkey,项目名称:AutoTagger,代码行数:101,代码来源:mpegfile.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ api::IAlgorithm_sptr类代码示例发布时间:2022-05-31
下一篇:
C++ thrift::ClientReceiveState类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap