| 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 QFILESYSTEMITERATOR_P_H | 
| 5 | #define QFILESYSTEMITERATOR_P_H | 
| 6 |  | 
| 7 | // | 
| 8 | //  W A R N I N G | 
| 9 | //  ------------- | 
| 10 | // | 
| 11 | // This file is not part of the Qt API.  It exists purely as an | 
| 12 | // implementation detail.  This header file may change from version to | 
| 13 | // version without notice, or even be removed. | 
| 14 | // | 
| 15 | // We mean it. | 
| 16 | // | 
| 17 |  | 
| 18 | #include <QtCore/qglobal.h> | 
| 19 |  | 
| 20 | #ifndef QT_NO_FILESYSTEMITERATOR | 
| 21 |  | 
| 22 | #include <QtCore/qdir.h> | 
| 23 | #include <QtCore/qstringlist.h> | 
| 24 |  | 
| 25 | #include <QtCore/private/qfilesystementry_p.h> | 
| 26 | #include <QtCore/private/qfilesystemmetadata_p.h> | 
| 27 |  | 
| 28 | #if !defined(Q_OS_WIN) | 
| 29 | #include <private/qstringconverter_p.h> | 
| 30 | #endif | 
| 31 |  | 
| 32 | #include <memory> | 
| 33 |  | 
| 34 | QT_BEGIN_NAMESPACE | 
| 35 |  | 
| 36 | class QFileSystemIterator | 
| 37 | { | 
| 38 | public: | 
| 39 |     QFileSystemIterator(const QFileSystemEntry &entry, QDir::Filters filters); | 
| 40 |     QFileSystemIterator(const QFileSystemEntry &entry); | 
| 41 |     QFileSystemIterator(const QFileSystemEntry &entry, QDirListing::IteratorFlags filters); | 
| 42 |     ~QFileSystemIterator(); | 
| 43 |  | 
| 44 |     bool advance(QFileSystemEntry &fileEntry, QFileSystemMetaData &metaData); | 
| 45 |  | 
| 46 | private: | 
| 47 |     QString dirPath; | 
| 48 |  | 
| 49 |     // Platform-specific data | 
| 50 | #if defined(Q_OS_WIN) | 
| 51 |     QFileSystemEntry::NativePath nativePath; | 
| 52 |     HANDLE findFileHandle; | 
| 53 |     QStringList uncShares; | 
| 54 |     bool uncFallback; | 
| 55 |     int uncShareIndex; | 
| 56 |     bool onlyDirs; | 
| 57 | #else | 
| 58 |     struct DirStreamCloser { | 
| 59 |         void operator()(QT_DIR *dir) { if (dir) QT_CLOSEDIR(dirp: dir); } | 
| 60 |     }; | 
| 61 |     using DirPtr = std::unique_ptr<QT_DIR, DirStreamCloser>; | 
| 62 |     DirPtr dir; | 
| 63 |  | 
| 64 |     QT_DIRENT *dirEntry = nullptr; | 
| 65 |     int lastError = 0; | 
| 66 |     QStringDecoder toUtf16; | 
| 67 | #endif | 
| 68 |  | 
| 69 |     Q_DISABLE_COPY_MOVE(QFileSystemIterator) | 
| 70 | }; | 
| 71 |  | 
| 72 | QT_END_NAMESPACE | 
| 73 |  | 
| 74 | #endif // QT_NO_FILESYSTEMITERATOR | 
| 75 |  | 
| 76 | #endif // include guard | 
| 77 |  |