本文整理汇总了C++中SongList::length方法的典型用法代码示例。如果您正苦于以下问题:C++ SongList::length方法的具体用法?C++ SongList::length怎么用?C++ SongList::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SongList
的用法示例。
在下文中一共展示了SongList::length方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SearchFinished
void SpotifyResolver::SearchFinished(const spotify_pb::SearchResponse& response) {
QString query_string = QString::fromUtf8(response.request().query().c_str());
qLog(Debug) << query_string;
QMap<QString, int>::iterator it = queries_.find(query_string);
if (it == queries_.end()) {
return;
}
int id = it.value();
queries_.erase(it);
SongList songs;
for (int i = 0; i < response.result_size(); ++i) {
const spotify_pb::Track& track = response.result(i);
Song song;
SpotifyService::SongFromProtobuf(track, &song);
songs << song;
}
qLog(Debug) << "Resolved from spotify:" << songs.length();
if (!songs.isEmpty()) {
qLog(Debug) << songs[0].title() << songs[0].artist();
}
emit ResolveFinished(id, songs);
}
示例2: file
TEST_F(AsxIniParserTest, ParsesBasicTrackList) {
QFile file(":/testdata/test.asxini");
file.open(QIODevice::ReadOnly);
SongList songs = parser_.Load(&file, "", QDir());
ASSERT_EQ(2, songs.length());
EXPECT_EQ(QUrl("http://195.245.168.21/antena3?MSWMExt=.asf"), songs[0].url());
EXPECT_EQ(QUrl("http://195.245.168.21:80/antena3?MSWMExt=.asf"), songs[1].url());
EXPECT_TRUE(songs[0].is_valid());
EXPECT_TRUE(songs[1].is_valid());
}
示例3: buffer
TEST_F(XSPFParserTest, IgnoresInvalidLength) {
QByteArray data =
"<playlist><trackList><track>"
"<location>http://example.com/foo.mp3</location>"
"<title>Foo</title>"
"<creator>Bar</creator>"
"<album>Baz</album>"
"<duration>60000qwerty</duration>"
"<image>http://example.com/albumcover.jpg</image>"
"<info>http://example.com</info>"
"</track></trackList></playlist>";
QBuffer buffer(&data);
buffer.open(QIODevice::ReadOnly);
XSPFParser parser(NULL);
SongList songs = parser.Load(&buffer);
ASSERT_EQ(1, songs.length());
EXPECT_EQ(-1, songs[0].length_nanosec());
}
示例4: buffer
TEST_F(ASXParserTest, ParsesOneTrackFromXML) {
QByteArray data =
"<asx version=\"3.0\"><title>foobar</title><entry>"
"<ref href=\"http://example.com/foo.mp3\"/>"
"<title>Foo</title>"
"<author>Bar</author>"
"<copyright>mumble mumble</copyright>"
"</entry></asx>";
QBuffer buffer(&data);
buffer.open(QIODevice::ReadOnly);
ASXParser parser(NULL);
SongList songs = parser.Load(&buffer);
ASSERT_EQ(1, songs.length());
const Song& song = songs[0];
EXPECT_EQ("Foo", song.title());
EXPECT_EQ("Bar", song.artist());
EXPECT_EQ(QUrl("http://example.com/foo.mp3"), song.url());
EXPECT_TRUE(song.is_valid());
}