diff options
Diffstat (limited to 'src/corelib/io/qfileinfo.h')
-rw-r--r-- | src/corelib/io/qfileinfo.h | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/corelib/io/qfileinfo.h b/src/corelib/io/qfileinfo.h index 1cb36495ef..72c8519446 100644 --- a/src/corelib/io/qfileinfo.h +++ b/src/corelib/io/qfileinfo.h @@ -4,11 +4,13 @@ #ifndef QFILEINFO_H #define QFILEINFO_H +#include <QtCore/qcompare.h> #include <QtCore/qfile.h> #include <QtCore/qlist.h> #include <QtCore/qshareddata.h> #include <QtCore/qmetatype.h> #include <QtCore/qdatetime.h> +#include <QtCore/qtimezone.h> QT_BEGIN_NAMESPACE @@ -20,6 +22,7 @@ class QFileInfoPrivate; class Q_CORE_EXPORT QFileInfo { friend class QDirIteratorPrivate; + friend class QDirListingPrivate; public: explicit QFileInfo(QFileInfoPrivate *d); @@ -34,7 +37,7 @@ public: QFILEINFO_MAYBE_EXPLICIT QFileInfo(const QFileDevice &file); QFILEINFO_MAYBE_EXPLICIT QFileInfo(const QDir &dir, const QString &file); QFileInfo(const QFileInfo &fileinfo); -#ifdef Q_CLANG_QDOC +#ifdef Q_QDOC QFileInfo(const std::filesystem::path &file); QFileInfo(const QDir &dir, const std::filesystem::path &file); #elif QT_CONFIG(cxx17_filesystem) @@ -57,13 +60,15 @@ public: void swap(QFileInfo &other) noexcept { d_ptr.swap(other.d_ptr); } +#if QT_CORE_REMOVED_SINCE(6, 8) bool operator==(const QFileInfo &fileinfo) const; inline bool operator!=(const QFileInfo &fileinfo) const { return !(operator==(fileinfo)); } +#endif void setFile(const QString &file); void setFile(const QFileDevice &file); void setFile(const QDir &dir, const QString &file); -#ifdef Q_CLANG_QDOC +#ifdef Q_QDOC void setFile(const std::filesystem::path &file); #elif QT_CONFIG(cxx17_filesystem) template<typename T, QtPrivate::ForceFilesystemPath<T> = 0> @@ -77,7 +82,7 @@ public: QString filePath() const; QString absoluteFilePath() const; QString canonicalFilePath() const; -#if QT_CONFIG(cxx17_filesystem) || defined(Q_CLANG_QDOC) +#if QT_CONFIG(cxx17_filesystem) || defined(Q_QDOC) std::filesystem::path filesystemFilePath() const { return QtPrivate::toFilesystemPath(filePath()); } std::filesystem::path filesystemAbsoluteFilePath() const @@ -95,7 +100,7 @@ public: QString path() const; QString absolutePath() const; QString canonicalPath() const; -#if QT_CONFIG(cxx17_filesystem) || defined(Q_CLANG_QDOC) +#if QT_CONFIG(cxx17_filesystem) || defined(Q_QDOC) std::filesystem::path filesystemPath() const { return QtPrivate::toFilesystemPath(path()); } std::filesystem::path filesystemAbsolutePath() const { return QtPrivate::toFilesystemPath(absolutePath()); } @@ -126,12 +131,16 @@ public: bool isBundle() const; QString symLinkTarget() const; + QString readSymLink() const; QString junctionTarget() const; -#if QT_CONFIG(cxx17_filesystem) || defined(Q_CLANG_QDOC) +#if QT_CONFIG(cxx17_filesystem) || defined(Q_QDOC) std::filesystem::path filesystemSymLinkTarget() const { return QtPrivate::toFilesystemPath(symLinkTarget()); } + std::filesystem::path filesystemReadSymLink() const + { return QtPrivate::toFilesystemPath(readSymLink()); } + std::filesystem::path filesystemJunctionTarget() const { return QtPrivate::toFilesystemPath(junctionTarget()); } #endif // QT_CONFIG(cxx17_filesystem) @@ -152,6 +161,12 @@ public: QDateTime lastRead() const { return fileTime(QFile::FileAccessTime); } QDateTime fileTime(QFile::FileTime time) const; + QDateTime birthTime(const QTimeZone &tz) const { return fileTime(QFile::FileBirthTime, tz); } + QDateTime metadataChangeTime(const QTimeZone &tz) const { return fileTime(QFile::FileMetadataChangeTime, tz); } + QDateTime lastModified(const QTimeZone &tz) const { return fileTime(QFile::FileModificationTime, tz); } + QDateTime lastRead(const QTimeZone &tz) const { return fileTime(QFile::FileAccessTime, tz); } + QDateTime fileTime(QFile::FileTime time, const QTimeZone &tz) const; + bool caching() const; void setCaching(bool on); void stat(); @@ -160,6 +175,8 @@ protected: QSharedDataPointer<QFileInfoPrivate> d_ptr; private: + friend Q_CORE_EXPORT bool comparesEqual(const QFileInfo &lhs, const QFileInfo &rhs); + Q_DECLARE_EQUALITY_COMPARABLE(QFileInfo) QFileInfoPrivate* d_func(); inline const QFileInfoPrivate* d_func() const { |