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


C++ StringList::toString方法代码示例

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


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

示例1: processXiphComment

bool SoundSource::processXiphComment(TagLib::Ogg::XiphComment* xiph) {
    if (s_bDebugMetadata) {
        for (TagLib::Ogg::FieldListMap::ConstIterator it = xiph->fieldListMap().begin();
                it != xiph->fieldListMap().end(); ++it) {
            qDebug() << "XIPH" << TStringToQString((*it).first) << "-" << TStringToQString((*it).second.toString());
        }
    }

    // Some tags use "BPM" so check for that.
    if (xiph->fieldListMap().contains("BPM")) {
        TagLib::StringList bpmString = xiph->fieldListMap()["BPM"];
        QString sBpm = TStringToQString(bpmString.toString());
        processBpmString("XIPH-BPM", sBpm);
    }

    // Give preference to the "TEMPO" tag which seems to be more standard
    if (xiph->fieldListMap().contains("TEMPO")) {
        TagLib::StringList bpmString = xiph->fieldListMap()["TEMPO"];
        QString sBpm = TStringToQString(bpmString.toString());
        processBpmString("XIPH-TEMPO", sBpm);
    }

    if (xiph->fieldListMap().contains("REPLAYGAIN_ALBUM_GAIN")) {
        TagLib::StringList rgainString = xiph->fieldListMap()["REPLAYGAIN_ALBUM_GAIN"];
        QString sReplayGain = TStringToQString(rgainString.toString());
        parseReplayGainString(sReplayGain);
    }

    if (xiph->fieldListMap().contains("REPLAYGAIN_TRACK_GAIN")) {
        TagLib::StringList rgainString = xiph->fieldListMap()["REPLAYGAIN_TRACK_GAIN"];
        QString sReplayGain = TStringToQString(rgainString.toString());
        parseReplayGainString(sReplayGain);
    }

    /*
     * Reading key code information
     * Unlike, ID3 tags, there's no standard or recommendation on how to store 'key' code
     *
     * Luckily, there are only a few tools for that, e.g., Rapid Evolution (RE).
     * Assuming no distinction between start and end key, RE uses a "INITIALKEY"
     * or a "KEY" vorbis comment.
     */
    if (xiph->fieldListMap().contains("KEY")) {
        TagLib::StringList keyStr = xiph->fieldListMap()["KEY"];
        QString key = TStringToQString(keyStr.toString());
        setKey(key);
    }

    if (getKey() == "" && xiph->fieldListMap().contains("INITIALKEY")) {
        TagLib::StringList keyStr = xiph->fieldListMap()["INITIALKEY"];
        QString key = TStringToQString(keyStr.toString());
        setKey(key);
    }
    return true;
}
开发者ID:AlbanBedel,项目名称:mixxx,代码行数:55,代码来源:soundsource.cpp

示例2: formatString

// Utility function to format tags so that they can be correctly parsed back
string formatString(const TagLib::StringList& strList) {
  TagLib::String str = strList.toString(";");
  if (str.isEmpty()) return "";

  string result = str.to8Bit(true);

  // heuristic to detect wrongly encoded tags (ie: twice latin-1 to utf-8, mostly)
  // we should encode everything ourselves to utf-8, but sometimes it might happen
  // that someone already did that, but told us the string was in latin-1.
  // A way to detect that is if the string contains only latin-1 chars, when
  // converting it to latin-1 it contains code chars, this probably means it was
  // previously encoded in utf-8
  if (isLatin1(str) &&
      containsControlChars(str.to8Bit(false))) {
    result = str.to8Bit(false);
  }

  // fix invalid utf-8 characters
  result = fixInvalidUTF8(result);

  return result;
}
开发者ID:arseneyr,项目名称:essentia,代码行数:23,代码来源:metadatareader.cpp


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