本文整理汇总了C++中taglib::StringList::front方法的典型用法代码示例。如果您正苦于以下问题:C++ StringList::front方法的具体用法?C++ StringList::front怎么用?C++ StringList::front使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类taglib::StringList
的用法示例。
在下文中一共展示了StringList::front方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: extractFlacFeature
QString FileHelper::extractFlacFeature(const QString &featureToExtract) const
{
QString feature;
if (TagLib::FLAC::File *flacFile = static_cast<TagLib::FLAC::File*>(_file)) {
if (flacFile->ID3v2Tag()) {
QString key = this->convertKeyToID3v2Key(featureToExtract);
TagLib::ID3v2::FrameList l = flacFile->ID3v2Tag()->frameListMap()[key.toStdString().data()];
// Fallback to the generic map in case we didn't find the matching key
if (l.isEmpty()) {
TagLib::StringList list = flacFile->properties()[featureToExtract.toStdString()];
if (!list.isEmpty()) {
feature = list.front().toCString(true);
}
} else {
feature = QString(l.front()->toString().toCString(true));
}
} else if (flacFile->ID3v1Tag()) {
qDebug() << Q_FUNC_INFO << "Not yet implemented for ID3v1Tag FLAC file";
} else if (flacFile->xiphComment()) {
const TagLib::Ogg::FieldListMap map = flacFile->xiphComment()->fieldListMap();
if (!map[featureToExtract.toStdString().data()].isEmpty()) {
feature = QString(map[featureToExtract.toStdString().data()].front().toCString(true));
}
}
}
return feature;
}
示例2: rating
/** Convert the existing rating number into a smaller range from 1 to 5. */
int FileHelper::rating() const
{
int r = -1;
/// TODO other types?
switch (_fileType) {
case EXT_MP3: {
TagLib::MPEG::File *mpegFile = static_cast<TagLib::MPEG::File*>(_file);
if (mpegFile && mpegFile->hasID3v2Tag()) {
r = this->ratingForID3v2(mpegFile->ID3v2Tag());
}
break;
}
case EXT_FLAC: {
if (TagLib::FLAC::File *flacFile = static_cast<TagLib::FLAC::File*>(_file)) {
if (flacFile->hasID3v2Tag()) {
r = this->ratingForID3v2(flacFile->ID3v2Tag());
} else if (flacFile->hasID3v1Tag()) {
qDebug() << Q_FUNC_INFO << "Not implemented (FLAC ID3v1)";
} else if (flacFile->hasXiphComment()) {
TagLib::StringList list = flacFile->xiphComment()->fieldListMap()["RATING"];
if (!list.isEmpty()) {
r = list.front().toInt();
}
}
}
break;
}
default:
break;
}
return r;
}
示例3: extractGenericFeature
QString FileHelper::extractGenericFeature(const QString &featureToExtract) const
{
QString feature;
TagLib::PropertyMap p = _file->properties();
if (p.contains(featureToExtract.toStdString().data())) {
TagLib::StringList list = p[featureToExtract.toStdString().data()];
if (!list.isEmpty()) {
feature = list.front().toCString(true);
}
}
return feature;
}