Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qsavefile.h
Go to the documentation of this file.
1// Copyright (C) 2012 David Faure <faure@kde.org>
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QSAVEFILE_H
5#define QSAVEFILE_H
6
7#include <QtCore/qglobal.h>
8
9#if QT_CONFIG(temporaryfile)
10
11#include <QtCore/qfiledevice.h>
12#include <QtCore/qstring.h>
13
14#ifdef open
15#error qsavefile.h must be included before any header file that defines open
16#endif
17
19
21class QSaveFilePrivate;
22
23class Q_CORE_EXPORT QSaveFile : public QFileDevice
24{
25#ifndef QT_NO_QOBJECT
27#endif
28 Q_DECLARE_PRIVATE(QSaveFile)
29
30public:
31
32 explicit QSaveFile(const QString &name);
33#ifndef QT_NO_QOBJECT
34 explicit QSaveFile(QObject *parent = nullptr);
35 explicit QSaveFile(const QString &name, QObject *parent);
36#endif
37 ~QSaveFile();
38
39 QString fileName() const override;
40 void setFileName(const QString &name);
41
42 QFILE_MAYBE_NODISCARD bool open(OpenMode flags) override;
43 bool commit();
44
45 void cancelWriting();
46
47 void setDirectWriteFallback(bool enabled);
48 bool directWriteFallback() const;
49
50protected:
51 qint64 writeData(const char *data, qint64 len) override;
52
53private:
54 void close() override;
55#if !QT_CONFIG(translation)
56 static QString tr(const char *string) { return QString::fromLatin1(string); }
57#endif
58
59private:
60 Q_DISABLE_COPY(QSaveFile)
61};
62
64
65#endif // QT_CONFIG(temporaryfile)
66
67#endif // QSAVEFILE_H
\inmodule QtCore \reentrant
\inmodule QtCore
Definition qfiledevice.h:32
\inmodule QtCore
Definition qobject.h:103
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:5871
Combined button and popup list for selecting options.
#define QFILE_MAYBE_NODISCARD
Definition qfiledevice.h:26
GLint GLint GLint GLint GLsizei GLsizei GLsizei GLboolean commit
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLbitfield flags
GLuint name
GLenum GLsizei len
#define tr(X)
#define Q_OBJECT
long long qint64
Definition qtypes.h:60
file setFileName("readme.txt")
file open(QIODevice::ReadOnly)
void writeData(const QByteArray &data)