本文整理汇总了C++中qfileinfolist::const_iterator::isFile方法的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator::isFile方法的具体用法?C++ const_iterator::isFile怎么用?C++ const_iterator::isFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qfileinfolist::const_iterator
的用法示例。
在下文中一共展示了const_iterator::isFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dir
QVector<QString> FileUtils::getAllFiles(const QString &path)
{
QVector<QString> result;
QDir dir(path);
QFileInfoList fileInfoLists = dir.entryInfoList();
QFileInfoList::const_iterator iterator = fileInfoLists.constBegin();
for(; iterator != fileInfoLists.constEnd(); iterator++)
{
QString filename = iterator->fileName();
if (!filename.startsWith("."))
{
if (iterator->isDir())
{
result += getAllFiles(iterator->absoluteFilePath());
}
else if (iterator->isFile())
{
result.push_back(iterator->absoluteFilePath());
}
else
{
//
}
}
}
return result;
}
示例2: getDataSizeByAbsolutePath
int FmDriveDetailsContent::getDataSizeByAbsolutePath( const QString &driveName,
const FmDriveDetailsDataGroup &dataGroup,
QList<FmDriveDetailsSize*> &detailsSizeList, volatile bool *isStopped )
{
quint64 totalSize = 0;
QStringList typeFilter = dataGroup.pathList();
for( QStringList::const_iterator it = typeFilter.begin();
it!= typeFilter.end(); ++it ) {
if ( *isStopped ){
return FmErrCancel;
}
QString driver(FmUtils::removePathSplash(FmUtils::getDriveNameFromPath(driveName)));
QFileInfo fileInfo(QString(driver + (*it)));
if (fileInfo.exists()) {
if (fileInfo.isFile()) {
totalSize += fileInfo.size();
} else if (fileInfo.isDir()) {
QList<QDir> dirs;
dirs.append(QDir(fileInfo.absolutePath()));
// traverse the whole path
while (!dirs.isEmpty()) {
QDir::Filters filter = QDir::NoDotAndDotDot | QDir::AllEntries;
QFileInfoList infoList = dirs.first().entryInfoList( filter );
for ( QFileInfoList::const_iterator it = infoList.begin(); it != infoList.end(); ++it ) {
if ( *isStopped ){
return FmErrCancel;
}
if ( it->isFile() ) {
totalSize += it->size();
}
else if ( it->isDir() ) {
dirs.append( QDir( it->absoluteFilePath() ) );
}
}
dirs.removeFirst();
}
}
}
}
detailsSizeList.append( new FmDriveDetailsSize( dataGroup.dataType(), totalSize ) );
return FmErrNone;
}
示例3: getDataSizeByTraversePath
int FmDriveDetailsContent::getDataSizeByTraversePath( const QString &driveName,
QList<FmDriveDetailsSize*> &detailsSizeList, volatile bool *isStopped )
{
qint64 imageSize( 0 );
qint64 soundSize( 0 );
qint64 midpJavaSize( 0 );
qint64 nativeAppsSize( 0 );
qint64 videoSize( 0 );
qint64 documentsSize( 0 );
FmFileTypeRecognizer fileTypeRecognizer;
QList<QDir> dirs;
dirs.append( QDir( driveName ) );
// traverse the whole drive
while (!dirs.isEmpty()) {
QDir::Filters filter = QDir::NoDotAndDotDot | QDir::AllEntries;
// do not summarize system and hidden files, these size will go into others category
// if( isSysHiddenIncluded ) {
// filter = filter | QDir::Hidden | QDir::System;
// }
QFileInfoList infoList = dirs.first().entryInfoList( filter );
for ( QFileInfoList::const_iterator it = infoList.begin(); it != infoList.end(); ++it ) {
if ( *isStopped ){
return FmErrCancel;
}
if ( it->isFile() ) {
FmFileTypeRecognizer::FileType fileType =
fileTypeRecognizer.getType( it->absoluteFilePath() );
switch ( fileType )
{
case FmFileTypeRecognizer::FileTypeImage:
imageSize += it->size();
break;
case FmFileTypeRecognizer::FileTypeTone:
soundSize += it->size();
break;
case FmFileTypeRecognizer::FileTypeJava:
midpJavaSize += it->size();
break;
case FmFileTypeRecognizer::FileTypeSisx:
nativeAppsSize += it->size();
break;
case FmFileTypeRecognizer::FileTypeVideo:
videoSize += it->size();
break;
case FmFileTypeRecognizer::FileTypeText:
documentsSize += it->size();
break;
default:
// do not need handle other type
break;
}
}
else if ( it->isDir() ) {
dirs.append( QDir( it->absoluteFilePath() ) );
}
}
dirs.removeFirst();
}
// store result to detailsSizeList.
detailsSizeList.append( new FmDriveDetailsSize( FmDriveDetailsSize::ETypeImages, imageSize ) ) ;
detailsSizeList.append( new FmDriveDetailsSize( FmDriveDetailsSize::ETypeSoundFiles, soundSize ) );
detailsSizeList.append( new FmDriveDetailsSize( FmDriveDetailsSize::ETypeMidpJava, midpJavaSize ) );
detailsSizeList.append( new FmDriveDetailsSize( FmDriveDetailsSize::ETypeNativeApps, nativeAppsSize ) );
detailsSizeList.append( new FmDriveDetailsSize( FmDriveDetailsSize::ETypeVideos, videoSize ) );
detailsSizeList.append( new FmDriveDetailsSize( FmDriveDetailsSize::ETypeDocuments, documentsSize ) );
return FmErrNone;
}