summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfile.cpp
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2020-02-07 14:03:43 +0100
committerMårten Nordheim <marten.nordheim@qt.io>2020-03-24 16:20:03 +0100
commit737fe89691a3d8dfa779862c9daaa002e00f3dca (patch)
treedf7498f54d2a5d57ff5de93bd8630fe2b3ecaa3a /src/corelib/io/qfile.cpp
parentc4ef0b92d5fb2c621e880347bd48d01b6f31eb24 (diff)
Q{File,FileInfo,Dir}: add std::filesystem::path overloads
Add some overloads where (I thought) it makes sense for QDir and QFile to accept std::filesystem::path objects. Currently my thinking is to not add overloads for static functions where std::filesystem can already do the same job, e.g. create directory or file. Template and enable_if is needed due to both QString and std::filesystem::path being able to be constructed from string literals. The common shared code is currently in QFile because QDir had an implicit include of QFile, made explicit in this patch, and QFileInfo has an include to QFile as well. The QT_HAS_STD_FILESYSTEM macro is visible in user-code which I currently take advantage of in the tests, and users could too. Change-Id: I8d05d3c34c6c17e20972a6a2053862b8891d6c3c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io/qfile.cpp')
-rw-r--r--src/corelib/io/qfile.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp
index 0cdc5bd6d3..2a9c24bbd5 100644
--- a/src/corelib/io/qfile.cpp
+++ b/src/corelib/io/qfile.cpp
@@ -1210,6 +1210,56 @@ qint64 QFile::size() const
return QFileDevice::size(); // for now
}
+/*!
+ \fn QFile::QFile(const std::filesystem::path &name)
+ \since 6.0
+
+ Constructs a new file object to represent the file with the given \a name.
+*/
+/*!
+ \fn QFile::QFile(const std::filesystem::path &name, QObject *parent)
+ \since 6.0
+
+ Constructs a new file object with the given \a parent to represent the
+ file with the specified \a name.
+*/
+/*!
+ \fn std::filesystem::path QFile::filesystemFileName() const
+ \since 6.0
+ Returns fileName() as \c{std::filesystem::path}.
+*/
+/*!
+ \fn void QFile::setFileName(const std::filesystem::path &name)
+ \since 6.0
+ \overload
+*/
+/*!
+ \fn bool QFile::rename(const std::filesystem::path &newName)
+ \since 6.0
+ \overload
+*/
+/*!
+ \fn bool QFile::link(const std::filesystem::path &newName)
+ \since 6.0
+ \overload
+*/
+/*!
+ \fn bool QFile::copy(const std::filesystem::path &newName)
+ \since 6.0
+ \overload
+*/
+/*!
+ \fn QFile::Permissions QFile::permissions(const std::filesystem::path &filename)
+ \since 6.0
+ \overload
+*/
+/*!
+ \fn bool QFile::setPermissions(const std::filesystem::path &filename, Permissions permissionSpec)
+ \since 6.0
+ \overload
+*/
+
+
QT_END_NAMESPACE
#ifndef QT_NO_QOBJECT