diff options
author | João Abecasis <joao@abecasis.name> | 2009-07-17 10:31:29 (GMT) |
---|---|---|
committer | João Abecasis <joao@abecasis.name> | 2009-07-22 12:36:17 (GMT) |
commit | eabc4109a2703aa761eff7a26cfa7001af8577a3 (patch) | |
tree | 6b428032fef5aee81fe9754bedd4ccb18bc592a4 | |
parent | 919e6f1ba2a6441c554bdb1b2c7d8ca78e33c557 (diff) | |
download | Qt-eabc4109a2703aa761eff7a26cfa7001af8577a3.zip Qt-eabc4109a2703aa761eff7a26cfa7001af8577a3.tar.gz Qt-eabc4109a2703aa761eff7a26cfa7001af8577a3.tar.bz2 |
QDirIterator refactoring
Moving member data around and marking immutable data as such.
Reviewed-by: Marius Storm-Olsen
-rw-r--r-- | src/corelib/io/qdiriterator.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp index ea54941..371e822 100644 --- a/src/corelib/io/qdiriterator.cpp +++ b/src/corelib/io/qdiriterator.cpp @@ -112,16 +112,19 @@ public: void checkAndPushDirectory(const QFileInfo &); bool matchesFilters(const QString &fileName, const QFileInfo &fi) const; - QSet<QString> visitedLinks; - QAbstractFileEngine *engine; + QAbstractFileEngine * const engine; + + const QString path; + const QStringList nameFilters; + const QDir::Filters filters; + const QDirIterator::IteratorFlags iteratorFlags; + QStack<QAbstractFileEngineIterator *> fileEngineIterators; - QString path; - QFileInfo nextFileInfo; - //This fileinfo is the current that we will return from the public API QFileInfo currentFileInfo; - QDirIterator::IteratorFlags iteratorFlags; - QDir::Filters filters; - QStringList nameFilters; + QFileInfo nextFileInfo; + + // Loop protection + QSet<QString> visitedLinks; QDirIterator *q; }; @@ -131,12 +134,12 @@ public: */ QDirIteratorPrivate::QDirIteratorPrivate(const QString &path, const QStringList &nameFilters, QDir::Filters filters, QDirIterator::IteratorFlags flags) - : engine(QAbstractFileEngine::create(path)), path(path), iteratorFlags(flags), - filters(filters), nameFilters(nameFilters) + : engine(QAbstractFileEngine::create(path)) + , path(path) + , nameFilters(nameFilters) + , filters(QDir::NoFilter == filters ? QDir::AllEntries : filters) + , iteratorFlags(flags) { - if (QDir::NoFilter == filters) - this->filters = QDir::AllEntries; - // Populate fields for hasNext() and next() pushDirectory(QFileInfo(path)); advance(); |