File indexing completed on 2026-09-21 09:21:41
0001
0002
0003
0004
0005 #ifndef QTEMPORARYDIR_H
0006 #define QTEMPORARYDIR_H
0007
0008 #include <QtCore/qglobal.h>
0009 #include <QtCore/qdir.h>
0010 #include <QtCore/qscopedpointer.h>
0011
0012 QT_BEGIN_NAMESPACE
0013
0014
0015 #if QT_CONFIG(temporaryfile)
0016
0017 class QTemporaryDirPrivate;
0018
0019 class Q_CORE_EXPORT QTemporaryDir
0020 {
0021 public:
0022 QTemporaryDir();
0023 explicit QTemporaryDir(const QString &templateName);
0024 QTemporaryDir(QTemporaryDir &&other) noexcept
0025 : d_ptr{std::exchange(other.d_ptr, nullptr)}
0026 { }
0027
0028 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QTemporaryDir)
0029
0030 ~QTemporaryDir();
0031
0032 void swap(QTemporaryDir &other) noexcept
0033 { qt_ptr_swap(d_ptr, other.d_ptr); }
0034
0035 bool isValid() const;
0036 QString errorString() const;
0037
0038 bool autoRemove() const;
0039 void setAutoRemove(bool b);
0040 bool remove();
0041
0042 QString path() const;
0043 QString filePath(const QString &fileName) const;
0044
0045 private:
0046 QTemporaryDirPrivate *d_ptr;
0047
0048 Q_DISABLE_COPY(QTemporaryDir)
0049 };
0050
0051 inline void swap(QTemporaryDir &lhs, QTemporaryDir &rhs) noexcept
0052 {
0053 lhs.swap(rhs);
0054 }
0055
0056 #endif
0057
0058 QT_END_NAMESPACE
0059
0060 #endif