本文整理汇总了C++中QLinkedList::pop_front方法的典型用法代码示例。如果您正苦于以下问题:C++ QLinkedList::pop_front方法的具体用法?C++ QLinkedList::pop_front怎么用?C++ QLinkedList::pop_front使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLinkedList
的用法示例。
在下文中一共展示了QLinkedList::pop_front方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main ()
{
QLinkedList<int> myQLinkedList;
int sum (0);
for (int i=1;i<=10;i++) myQLinkedList.push_back(i);
assert(!myQLinkedList.empty());
while (!myQLinkedList.empty())
{
sum += myQLinkedList.front();
myQLinkedList.pop_front();
}
assert(myQLinkedList.empty()&&(myQLinkedList.size() == 0));
cout << "total: " << sum << endl;
return 0;
}
示例2: run
void SendDataThread::run()
{
while(true)
{
QMutexLocker locker(&m_DataMutex);
m_DataCondition.wait(&m_DataMutex);
int count = m_DataList.count();
for(int i = 0; i < count; ++i)
{
const QByteArray& data = m_DataList.first();
if(!::sendData(m_Socket, data.data(), data.size()))
{
qDebug()<<"Send data to server error";
return;
}
m_DataList.pop_front();
}
}
}
示例3: removeResources
void RDFGraphBasic::removeResources(RDFVariable const &variable)
{
QLinkedList<RDFVariable> removes;
removes << variable;
RDFTransactionPtr tx = createTransaction();
while(1)
{
RDFStatementList removed_statements;
executeQuery
(RDFUpdate(service_context_data_->update())
.addDeletion(*recurseRemoveResources
(&removed_statements, removes.front(), &removes)));
removes.pop_front();
tx->commit();
if(!removes.size())
return;
if(!(tx = createTransaction(RDFTransaction::Exclusive)))
{
warning() << "using recursive sharing removes requires that "
"no transaction is active on the service";
return;
}
}
}
示例4: trackdir
//.........这里部分代码省略.........
EXPECT_TRUE(img.scaled(100,100).save(cLoc_folder, format));
prefCovers << QFileInfo(cLoc_folder);
// 8. other1.jpg
QString cLoc_other1 = QString(trackdir % "/" % "other1." % qFormat);
EXPECT_TRUE(img.scaled(10,10).save(cLoc_other1, format));
prefCovers << QFileInfo(cLoc_other1);
// 7. other2.jpg
QString cLoc_other2 = QString(trackdir % "/" % "other2." % qFormat);
EXPECT_TRUE(img.scaled(10,10).save(cLoc_other2, format));
prefCovers << QFileInfo(cLoc_other2);
// we must find covers in the right order
EXPECT_EQ(8, prefCovers.size());
// Remove the covers one by one from the front, checking that each one is
// selected as we remove the previously-most-preferable cover.
while (!prefCovers.isEmpty()) {
QFileInfo cover = prefCovers.first();
// We expect no cover selected for other1 since there are 2 covers,
// neither of which match our preferred cover names. other2 will be
// selected once we get to it since it is the only cover available.
if (cover.baseName() == "other1") {
expected.image = QImage();
expected.info.type = CoverInfo::NONE;
expected.info.coverLocation = QString();
expected.info.hash = 0;
} else {
expected.image = QImage(cover.filePath());
expected.info.type = CoverInfo::FILE;
expected.info.coverLocation = cover.fileName();
expected.info.hash = CoverArtUtils::calculateHash(expected.image);
}
res = CoverArtUtils::selectCoverArtForTrack(trackBaseName, trackAlbum,
prefCovers);
EXPECT_QSTRING_EQ(expected.info.coverLocation, res.info.coverLocation);
EXPECT_QSTRING_EQ(expected.info.hash, res.info.hash);
EXPECT_EQ(expected, res);
QFile::remove(cover.filePath());
prefCovers.pop_front();
}
//
// Additional tests
//
// what is chosen when cover.jpg and cover.JPG exists?
// (it must always prefer the lighter cover)
QString cLoc_coverJPG = trackdir % "/" % "cover." % "JPG";
EXPECT_TRUE(img.scaled(200,200).save(cLoc_coverJPG, "JPG"));
prefCovers.append(QFileInfo(cLoc_coverJPG));
QString cLoc_coverjpg = trackdir % "/" % "cover." % "jpg";
EXPECT_TRUE(img.scaled(400,400).save(cLoc_coverjpg, "jpg"));
prefCovers.append(QFileInfo(cLoc_coverjpg));
extraCovers << cLoc_coverJPG << cLoc_coverjpg;
res = CoverArtUtils::selectCoverArtForTrack(trackBaseName, trackAlbum,
prefCovers);
expected.image = QImage(cLoc_coverJPG);
expected.info.hash = CoverArtUtils::calculateHash(expected.image);
expected.info.coverLocation = "cover.JPG";
EXPECT_EQ(expected, res);
// As we are looking for %album%.jpg and %base_track.jpg%,
// we need to check if everything works with UTF8 chars.
trackBaseName = QString::fromUtf8("track_ðÑöæäî");
trackAlbum = QString::fromUtf8("öæäîðÑ_album");
prefCovers.clear();
// 2. album_name.jpg
cLoc_albumName = QString(trackdir % "/" % trackAlbum % "." % qFormat);
EXPECT_TRUE(img.save(cLoc_albumName, format));
prefCovers.append(QFileInfo(cLoc_albumName));
res = CoverArtUtils::selectCoverArtForTrack(trackBaseName, trackAlbum,
prefCovers);
expected.image = QImage(cLoc_albumName);
expected.info.hash = CoverArtUtils::calculateHash(expected.image);
expected.info.coverLocation = trackAlbum % ".jpg";
EXPECT_EQ(expected, res);
// 1. track_filename.jpg
cLoc_filename = QString(trackdir % "/" % trackBaseName % "." % qFormat);
EXPECT_TRUE(img.save(cLoc_filename, format));
prefCovers.append(QFileInfo(cLoc_filename));
res = CoverArtUtils::selectCoverArtForTrack(trackBaseName, trackAlbum,
prefCovers);
expected.image = QImage(cLoc_filename);
expected.info.hash = CoverArtUtils::calculateHash(expected.image);
expected.info.coverLocation = trackBaseName % ".jpg";
EXPECT_EQ(expected, res);
QFile::remove(cLoc_filename);
QFile::remove(cLoc_albumName);
// cleaning temp dir
foreach (QString loc, extraCovers) {
QFile::remove(loc);
}