Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qfsfileengine_iterator.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
6#include "qfileinfo_p.h"
7#include "qvariant.h"
8
9#ifndef QT_NO_FILESYSTEMITERATOR
10
12
13QFSFileEngineIterator::QFSFileEngineIterator(const QString &path, QDir::Filters filters,
14 const QStringList &filterNames)
15 : QAbstractFileEngineIterator(path, filters, filterNames),
16 nativeIterator(new QFileSystemIterator(QFileSystemEntry(path), filters))
17{
18}
19
20QFSFileEngineIterator::QFSFileEngineIterator(const QString &path, QDirListing::IteratorFlags filters,
21 const QStringList &filterNames)
24{
25}
26
30
32{
33 if (!nativeIterator)
34 return false;
35
36 QFileSystemEntry entry;
38 if (nativeIterator->advance(entry, data)) {
39 m_fileInfo = QFileInfo(new QFileInfoPrivate(entry, data));
40 return true;
41 } else {
42 nativeIterator.reset();
43 return false;
44 }
45}
46
48{
49 return m_fileInfo.fileName();
50}
51
53{
54 return m_fileInfo;
55}
56
57QT_END_NAMESPACE
58
59#endif // QT_NO_FILESYSTEMITERATOR
QString currentFileName() const override
This pure virtual function returns the name of the current directory entry, excluding the path.
QFileInfo currentFileInfo() const override
The virtual function returns a QFileInfo for the current directory entry.
QFSFileEngineIterator(const QString &path, QDir::Filters filters, const QStringList &filterNames)
bool advance() override
This pure virtual function advances the iterator to the next directory entry; if the operation was su...