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 | |
4 | #ifndef QDIRITERATOR_H |
5 | #define QDIRITERATOR_H |
6 | |
7 | #include <QtCore/qdir.h> |
8 | |
9 | QT_BEGIN_NAMESPACE |
10 | |
11 | class QDirIteratorPrivate; |
12 | class Q_CORE_EXPORT QDirIterator |
13 | { |
14 | public: |
15 | enum IteratorFlag { |
16 | NoIteratorFlags = 0x0, |
17 | FollowSymlinks = 0x1, |
18 | Subdirectories = 0x2 |
19 | }; |
20 | Q_DECLARE_FLAGS(IteratorFlags, IteratorFlag) |
21 | |
22 | QDirIterator(const QDir &dir, IteratorFlags flags = NoIteratorFlags); |
23 | QDirIterator(const QString &path, |
24 | IteratorFlags flags = NoIteratorFlags); |
25 | QDirIterator(const QString &path, |
26 | QDir::Filters filter, |
27 | IteratorFlags flags = NoIteratorFlags); |
28 | QDirIterator(const QString &path, |
29 | const QStringList &nameFilters, |
30 | QDir::Filters filters = QDir::NoFilter, |
31 | IteratorFlags flags = NoIteratorFlags); |
32 | |
33 | ~QDirIterator(); |
34 | |
35 | QString next(); |
36 | QFileInfo nextFileInfo(); |
37 | bool hasNext() const; |
38 | |
39 | QString fileName() const; |
40 | QString filePath() const; |
41 | QFileInfo fileInfo() const; |
42 | QString path() const; |
43 | |
44 | private: |
45 | Q_DISABLE_COPY(QDirIterator) |
46 | |
47 | QScopedPointer<QDirIteratorPrivate> d; |
48 | friend class QDir; |
49 | }; |
50 | |
51 | Q_DECLARE_OPERATORS_FOR_FLAGS(QDirIterator::IteratorFlags) |
52 | |
53 | QT_END_NAMESPACE |
54 | |
55 | #endif |
56 | |