File indexing completed on 2025-01-18 10:07:35
0001
0002
0003
0004 #ifndef QSAVEFILE_H
0005 #define QSAVEFILE_H
0006
0007 #include <QtCore/qglobal.h>
0008
0009 #ifndef QT_NO_TEMPORARYFILE
0010
0011 #include <QtCore/qfiledevice.h>
0012 #include <QtCore/qstring.h>
0013
0014 #ifdef open
0015 #error qsavefile.h must be included before any header file that defines open
0016 #endif
0017
0018 QT_BEGIN_NAMESPACE
0019
0020 class QAbstractFileEngine;
0021 class QSaveFilePrivate;
0022
0023 class Q_CORE_EXPORT QSaveFile : public QFileDevice
0024 {
0025 #ifndef QT_NO_QOBJECT
0026 Q_OBJECT
0027 #endif
0028 Q_DECLARE_PRIVATE(QSaveFile)
0029
0030 public:
0031
0032 explicit QSaveFile(const QString &name);
0033 #ifndef QT_NO_QOBJECT
0034 explicit QSaveFile(QObject *parent = nullptr);
0035 explicit QSaveFile(const QString &name, QObject *parent);
0036 #endif
0037 ~QSaveFile();
0038
0039 QString fileName() const override;
0040 void setFileName(const QString &name);
0041
0042 bool open(OpenMode flags) override;
0043 bool commit();
0044
0045 void cancelWriting();
0046
0047 void setDirectWriteFallback(bool enabled);
0048 bool directWriteFallback() const;
0049
0050 protected:
0051 qint64 writeData(const char *data, qint64 len) override;
0052
0053 private:
0054 void close() override;
0055 #if !QT_CONFIG(translation)
0056 static QString tr(const char *string) { return QString::fromLatin1(string); }
0057 #endif
0058
0059 private:
0060 Q_DISABLE_COPY(QSaveFile)
0061 };
0062
0063 QT_END_NAMESPACE
0064
0065 #endif
0066
0067 #endif