diff options
Diffstat (limited to 'src/corelib/io/qdir.h')
-rw-r--r-- | src/corelib/io/qdir.h | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/src/corelib/io/qdir.h b/src/corelib/io/qdir.h index 45a40995f8..f0dda73ebb 100644 --- a/src/corelib/io/qdir.h +++ b/src/corelib/io/qdir.h @@ -41,13 +41,13 @@ #define QDIR_H #include <QtCore/qstring.h> +#include <QtCore/qfile.h> #include <QtCore/qfileinfo.h> #include <QtCore/qstringlist.h> #include <QtCore/qshareddata.h> QT_BEGIN_NAMESPACE - class QDirIterator; class QDirPrivate; @@ -102,6 +102,22 @@ public: QDir(const QString &path = QString()); QDir(const QString &path, const QString &nameFilter, SortFlags sort = SortFlags(Name | IgnoreCase), Filters filter = AllEntries); +#ifdef Q_CLANG_QDOC + QDir(const std::filesystem::path &path); + QDir(const std::filesystem::path &path, const QString &nameFilter, + SortFlags sort = SortFlags(Name | IgnoreCase), Filters filter = AllEntries); +#elif QT_CONFIG(cxx17_filesystem) + template<typename T, QtPrivate::ForceFilesystemPath<T> = 0> + QDir(const T &path) : QDir(QtPrivate::fromFilesystemPath(path)) + { + } + template<typename T, QtPrivate::ForceFilesystemPath<T> = 0> + QDir(const T &path, const QString &nameFilter, + SortFlags sort = SortFlags(Name | IgnoreCase), Filters filter = AllEntries) + : QDir(QtPrivate::fromFilesystemPath(path), nameFilter, sort, filter) + { + } +#endif // QT_CONFIG(cxx17_filesystem) ~QDir(); QDir &operator=(const QDir &); @@ -115,9 +131,26 @@ public: { qSwap(d_ptr, other.d_ptr); } void setPath(const QString &path); +#ifdef Q_CLANG_QDOC + void setPath(const std::filesystem::path &path); +#elif QT_CONFIG(cxx17_filesystem) + template<typename T, QtPrivate::ForceFilesystemPath<T> = 0> + void setPath(const T &path) + { + setPath(QtPrivate::fromFilesystemPath(path)); + } +#endif // QT_CONFIG(cxx17_filesystem) QString path() const; QString absolutePath() const; QString canonicalPath() const; +#if QT_CONFIG(cxx17_filesystem) + std::filesystem::path filesystemPath() const + { return QtPrivate::toFilesystemPath(path()); } + std::filesystem::path filesystemAbsolutePath() const + { return QtPrivate::toFilesystemPath(absolutePath()); } + std::filesystem::path filesystemCanonicalPath() const + { return QtPrivate::toFilesystemPath(canonicalPath()); } +#endif // QT_CONFIG(cxx17_filesystem) #if QT_DEPRECATED_SINCE(5, 13) QT_DEPRECATED_X("Use QDir::addSearchPath() instead") @@ -126,6 +159,15 @@ public: static void setSearchPaths(const QString &prefix, const QStringList &searchPaths); static void addSearchPath(const QString &prefix, const QString &path); +#ifdef Q_CLANG_QDOC + static void addSearchPath(const QString &prefix, const std::filesystem::path &path); +#elif QT_CONFIG(cxx17_filesystem) + template<typename T, QtPrivate::ForceFilesystemPath<T> = 0> + static void addSearchPath(const QString &prefix, const T &path) + { + addSearchPath(prefix, QtPrivate::fromFilesystemPath(path)); + } +#endif // QT_CONFIG(cxx17_filesystem) static QStringList searchPaths(const QString &prefix); QString dirName() const; |