本文整理汇总了C++中QFileInfoList::cend方法的典型用法代码示例。如果您正苦于以下问题:C++ QFileInfoList::cend方法的具体用法?C++ QFileInfoList::cend怎么用?C++ QFileInfoList::cend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QFileInfoList
的用法示例。
在下文中一共展示了QFileInfoList::cend方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void FindImageRunnable::run()
{
using std::vector;
using std::string;
using itk::GDCMSeriesFileNames;
if (m_forceFinish) {
emit finish();
return;
}
// Find Dicom files
{
// Generate a sequence of fileNames from a DICOM series
GDCMSeriesFileNames::Pointer nameGenerator = GDCMSeriesFileNames::New();
nameGenerator->SetUseSeriesDetails(true);
nameGenerator->SetDirectory(m_folderPath.toStdString().c_str());
//nameGenerator->AddSeriesRestriction("0008|0021");
nameGenerator->GetInputFileNames();
// basing on all seriesUIDs
// get file names form corresponding serires UID
try {
const vector<string>& seriesUID = nameGenerator->GetSeriesUIDs();
vector<string>::const_iterator seriesEnd = seriesUID.end();
for (vector<string>::const_iterator cit = seriesUID.cbegin();
cit != seriesUID.cend(); ++cit) {
GDCImageIORead(nameGenerator->GetFileNames(*cit));
}
}
catch (itk::ExceptionObject& e) {
qDebug() << e.what();
}
}
//Find Nifti file
{
QStringList filterList;
filterList << "*.nii" << "*.nii.gz";
QDir dir(m_folderPath);
QFileInfoList niiFileList = dir.entryInfoList(filterList);
// basing on wildcard to find out all NIFTI files
for (QFileInfoList::const_iterator cit = niiFileList.cbegin();
cit != niiFileList.cend(); ++cit)
{
vector<string> fileNames(1, cit->absoluteFilePath().toStdString());
GDCImageIORead(fileNames);
}
}
emit finish();
}
示例2: info
void
PlaylistModel::openFilesAndDirs0(QVector<ImageFile*> &openfiles,
const QStringList &paths, int level)
{
if (paths.empty()) return;
for (auto iter = paths.cbegin();
iter != paths.cend(); ++iter)
{
const QFileInfo info(*iter);
if (info.isFile())
{
if (ImageFile::isReadableImageFile(*iter))
{
ImageFile *imgfile = new ImageFile(*iter);
openfiles.append(imgfile);
}
else
{
QVector<ImageFile*> imgfiles =
ImageFile::openArchive(*iter);
openfiles.append(imgfiles);
imgfiles.clear();
}
}
else if (level > 0)
{
QStringList newlist;
const QFileInfoList entrylist = QDir(*iter).entryInfoList();
const int clen = info.canonicalPath().length();
for (auto iter2 = entrylist.cbegin();
iter2 != entrylist.cend(); ++iter2)
{
if (clen < iter2->canonicalPath().length())
{
newlist << iter2->filePath();
}
}
openFilesAndDirs0(openfiles, newlist, level-1);
}
}
}
示例3: scopeLock
bool OsmAnd::TileDB::rebuildIndex()
{
QMutexLocker scopeLock(&_indexMutex);
bool ok;
// Open index database if it's not yet
if(!_indexDb.isOpen())
{
if(!openIndex())
return false;
}
QSqlQuery q(_indexDb);
LogPrintf(LogSeverityLevel::Info, "Rebuilding index of '%s' tiledb...", dataPath.absolutePath().toStdString().c_str());
auto beginTimestamp = std::chrono::steady_clock::now();
// Recreate index db structure
if(!indexFilename.isEmpty())
{
ok = q.exec("DROP TABLE IF EXISTS tiledb_files");
assert(ok);
ok = q.exec("DROP TABLE IF EXISTS tiledb_index");
assert(ok);
ok = q.exec("DROP INDEX IF EXISTS _tiledb_index");
assert(ok);
}
ok = q.exec(
"CREATE TABLE tiledb_files ("
" id INTEGER PRIMARY KEY AUTOINCREMENT,"
" filename TEXT"
")");
assert(ok);
ok = q.exec(
"CREATE TABLE tiledb_index ("
" xMin INTEGER,"
" yMin INTEGER,"
" xMax INTEGER,"
" yMax INTEGER,"
" zoom INTEGER,"
" id INTEGER"
")");
assert(ok);
ok = q.exec(
"CREATE INDEX _tiledb_index"
" ON tiledb_index(xMin, yMin, xMax, yMax, zoom)");
assert(ok);
_indexDb.commit();
QSqlQuery registerFileQuery(_indexDb);
ok = registerFileQuery.prepare("INSERT INTO tiledb_files (filename) VALUES ( ? )");
assert(ok);
QSqlQuery insertTileQuery(_indexDb);
ok = insertTileQuery.prepare("INSERT INTO tiledb_index (xMin, yMin, xMax, yMax, zoom, id) VALUES ( ?, ?, ?, ?, ?, ? )");
assert(ok);
// Index TileDBs
QFileInfoList files;
Utilities::findFiles(dataPath, QStringList() << "*", files);
for(auto itFile = files.cbegin(); itFile != files.cend(); ++itFile)
{
const auto& file = *itFile;
const auto dbFilename = file.absoluteFilePath();
const auto connectionName = QString::fromLatin1("tiledb-sqlite:") + dbFilename;
QSqlDatabase db;
if(!QSqlDatabase::contains(connectionName))
db = QSqlDatabase::addDatabase("QSQLITE", connectionName);
else
db = QSqlDatabase::database(connectionName);
db.setDatabaseName(dbFilename);
if(!db.open())
{
LogPrintf(LogSeverityLevel::Error, "Failed to open TileDB from '%s': %s", qPrintable(dbFilename), qPrintable(db.lastError().text()));
continue;
}
// Register new file
registerFileQuery.addBindValue(dbFilename);
ok = registerFileQuery.exec();
assert(ok);
auto fileId = registerFileQuery.lastInsertId();
// For each zoom, query min-max of tile coordinates
QSqlQuery minMaxQuery("SELECT zoom, xMin, yMin, xMax, yMax FROM bounds", db);
ok = minMaxQuery.exec();
assert(ok);
while(minMaxQuery.next())
{
int32_t zoom = minMaxQuery.value(0).toInt();
int32_t xMin = minMaxQuery.value(1).toInt();
int32_t yMin = minMaxQuery.value(2).toInt();
int32_t xMax = minMaxQuery.value(3).toInt();
int32_t yMax = minMaxQuery.value(4).toInt();
insertTileQuery.addBindValue(xMin);
insertTileQuery.addBindValue(yMin);
insertTileQuery.addBindValue(xMax);
insertTileQuery.addBindValue(yMax);
//.........这里部分代码省略.........
示例4: genEmoji
bool genEmoji(QString emoji_in, const QString &emoji_out) {
QDir d(emoji_in);
if (!d.exists()) {
cout << "Could not open emoji input dir '" << emoji_in.toUtf8().constData() << "'!\n";
QCoreApplication::exit(1);
return false;
}
emoji_in = d.absolutePath() + '/';
QString emoji_in_200x = d.absolutePath() + "_200x/";
QDir d_200x(emoji_in_200x);
if (!d.exists()) {
cout << "Could not open emoji _200x input dir '" << emoji_in_200x.toUtf8().constData() << "'!\n";
QCoreApplication::exit(1);
return false;
}
int currentRow = 0, currentColumn = 0;
uint32 min1 = 0xFFFFFFFF, max1 = 0, min2 = 0xFFFFFFFF, max2 = 0;
QStringList filters;
filters << "*.png" << "*.gif";
QFileInfoList emojis = d.entryInfoList(filters, QDir::Files | QDir::NoDotAndDotDot | QDir::Readable);
for (QFileInfoList::const_iterator i = emojis.cbegin(), e = emojis.cend(); i != e; ++i) {
QString s = i->fileName();
QRegularExpressionMatch m = QRegularExpression("^([A-F0-9]+)\\.(png|gif)$").match(s);
if (m.hasMatch()) {
EmojiData data;
QString num = m.captured(1);
if (num.size() != 4 && num.size() != 8 && num.size() != 16) {
cout << "Bad name found '" << s.toUtf8().constData() << "'!\n";
continue;
}
data.code = ("0x" + num.mid(0, 8)).toUInt(0, 16);
if (num.size() > 8) {
data.code2 = ("0x" + num.mid(8)).toUInt(0, 16);
} else {
data.code2 = 0;
}
data.name = emoji_in + s;
data.name_200x = emoji_in_200x + s;
data.x = currentColumn;
data.y = currentRow;
++currentColumn;
if (currentColumn == inRow) {
++currentRow;
currentColumn = 0;
}
uint32 high = data.code >> 16;
if (!high) { // small codes
if (data.code == 169 || data.code == 174) { // two small
} else {
if (data.code < min1) min1 = data.code;
if (data.code > max1) max1 = data.code;
}
} else if (high == 35 || high >= 48 && high < 58) { // digits
} else {
if (data.code < min2) min2 = data.code;
if (data.code > max2) max2 = data.code;
}
EmojisData::const_iterator i = emojisData.constFind(data.code);
if (i != emojisData.cend()) {
cout << QString("Bad emoji code (duplicate) %1 %2 and %3 %4").arg(data.code).arg(data.code2).arg(i->code).arg(i->code2).toUtf8().constData() << "\n";
continue;
}
emojisData.insert(data.code, data);
} else {