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
9QT_BEGIN_NAMESPACE
10
11class QDirIteratorPrivate;
12class Q_CORE_EXPORT QDirIterator
13{
14public:
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
44private:
45 Q_DISABLE_COPY(QDirIterator)
46
47 QScopedPointer<QDirIteratorPrivate> d;
48 friend class QDir;
49};
50
51Q_DECLARE_OPERATORS_FOR_FLAGS(QDirIterator::IteratorFlags)
52
53QT_END_NAMESPACE
54
55#endif
56

source code of qtbase/src/corelib/io/qdiriterator.h