diff options
author | João Abecasis <joao@abecasis.name> | 2009-07-16 19:17:38 (GMT) |
---|---|---|
committer | João Abecasis <joao@abecasis.name> | 2009-07-22 12:36:16 (GMT) |
commit | 3d5b6f694f477a3529e79e72d66824b8befa0dc2 (patch) | |
tree | e87c84dc62e54a315dc532a0c2c57a92e8420215 | |
parent | 0ba33d83108f21abbd98cde1accdbba5bce625d2 (diff) | |
download | Qt-3d5b6f694f477a3529e79e72d66824b8befa0dc2.zip Qt-3d5b6f694f477a3529e79e72d66824b8befa0dc2.tar.gz Qt-3d5b6f694f477a3529e79e72d66824b8befa0dc2.tar.bz2 |
QDirIterator refactoring
Some pointless renaming and mashing up...
Actually, some of it sets the stage for (yes, you guessed it!) more
refactoring!
Reviewed-by: Marius Storm-Olsen
-rw-r--r-- | src/corelib/io/qdiriterator.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp index 0e4d563..ae5318f 100644 --- a/src/corelib/io/qdiriterator.cpp +++ b/src/corelib/io/qdiriterator.cpp @@ -106,9 +106,10 @@ public: QDir::Filters filters, QDirIterator::IteratorFlags flags); ~QDirIteratorPrivate(); - void pushSubDirectory(const QFileInfo &fileInfo); void advance(); - bool shouldFollowDirectory(const QFileInfo &); + + void pushDirectory(const QFileInfo &fileInfo); + bool checkAndPushDirectory(const QFileInfo &); bool matchesFilters(const QString &fileName, const QFileInfo &fi) const; QSet<QString> visitedLinks; @@ -137,7 +138,7 @@ QDirIteratorPrivate::QDirIteratorPrivate(const QString &path, const QStringList this->filters = QDir::AllEntries; // Populate fields for hasNext() and next() - pushSubDirectory(QFileInfo(path)); + pushDirectory(QFileInfo(path)); advance(); } @@ -152,7 +153,7 @@ QDirIteratorPrivate::~QDirIteratorPrivate() /*! \internal */ -void QDirIteratorPrivate::pushSubDirectory(const QFileInfo &fileInfo) +void QDirIteratorPrivate::pushDirectory(const QFileInfo &fileInfo) { QString path = fileInfo.filePath(); @@ -193,14 +194,12 @@ void QDirIteratorPrivate::advance() currentFileInfo = nextFileInfo; nextFileInfo = info; - if(shouldFollowDirectory(nextFileInfo)) - pushSubDirectory(nextFileInfo); + checkAndPushDirectory(nextFileInfo); //We found a matching entry. return; - } else if (shouldFollowDirectory(info)) { - pushSubDirectory(info); + } else if (checkAndPushDirectory(info)) { foundDirectory = true; break; } @@ -215,7 +214,7 @@ void QDirIteratorPrivate::advance() /*! \internal */ -bool QDirIteratorPrivate::shouldFollowDirectory(const QFileInfo &fileInfo) +bool QDirIteratorPrivate::checkAndPushDirectory(const QFileInfo &fileInfo) { // If we're doing flat iteration, we're done. if (!(iteratorFlags & QDirIterator::Subdirectories)) @@ -242,6 +241,7 @@ bool QDirIteratorPrivate::shouldFollowDirectory(const QFileInfo &fileInfo) if (visitedLinks.contains(fileInfo.canonicalFilePath())) return false; + pushDirectory(fileInfo); return true; } |