Qt 6.x
The Qt SDK
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#ifndef QT_NO_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
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 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_NO_TEMPORARYFILE
66
67#endif // QSAVEFILE_H
\inmodule QtCore \reentrant
\inmodule QtCore
Definition qfiledevice.h:16
qint64 writeData(const char *data, qint64 len) override
\reimp
virtual QString fileName() const
Returns the name of the file.
void close() override
Calls QFileDevice::flush() and closes the file.
virtual bool open(QIODeviceBase::OpenMode mode)
Opens the device and sets its OpenMode to mode.
\inmodule QtCore
Definition qobject.h:90
\inmodule QtCore
Definition qsavefile.h:24
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:5710
Combined button and popup list for selecting options.
GLint GLint GLint GLint GLsizei GLsizei GLsizei GLboolean commit
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLbitfield flags
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLuint name
GLenum GLsizei len
#define tr(X)
#define Q_OBJECT
long long qint64
Definition qtypes.h:55
file setFileName("readme.txt")
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent