Exemplo n.º 1
0
/*!
    \internal
*/
void QDirIteratorPrivate::advance()
{
    while (!fileEngineIterators.isEmpty()) {

        // Find the next valid iterator that matches the filters.
        while (fileEngineIterators.top()->hasNext()) {
            QAbstractFileEngineIterator *it = fileEngineIterators.top();
            it->next();

            const QFileInfo info = it->currentFileInfo();
            checkAndPushDirectory(it->currentFileInfo());

            if (matchesFilters(it->currentFileName(), info)) {
                currentFileInfo = nextFileInfo;
                nextFileInfo = info;

                //We found a matching entry.
                return;
            }
        }

        delete fileEngineIterators.pop();
    }

    currentFileInfo = nextFileInfo;
    nextFileInfo = QFileInfo();
}
Exemplo n.º 2
0
/*!
    \internal
*/
void QDirIteratorPrivate::advance()
{
    if (engine) {
        while (!fileEngineIterators.isEmpty()) {
            // Find the next valid iterator that matches the filters.
            QAbstractFileEngineIterator *it;
            while (it = fileEngineIterators.top(), it->hasNext()) {
                it->next();
                if (entryMatches(it->currentFileName(), it->currentFileInfo()))
                    return;
            }

            fileEngineIterators.pop();
            delete it;
        }
    } else {
#ifndef QT_NO_FILESYSTEMITERATOR
        QFileSystemEntry nextEntry;
        QFileSystemMetaData nextMetaData;

        while (!nativeIterators.isEmpty()) {
            // Find the next valid iterator that matches the filters.
            QFileSystemIterator *it;
            while (it = nativeIterators.top(), it->advance(nextEntry, nextMetaData)) {
                QFileInfo info(new QFileInfoPrivate(nextEntry, nextMetaData));

                if (entryMatches(nextEntry.fileName(), info))
                    return;
            }

            nativeIterators.pop();
            delete it;
        }
#endif
    }

    currentFileInfo = nextFileInfo;
    nextFileInfo = QFileInfo();
}