Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
// Qt-Security score:significant reason:header-decls-only
4
5
#
ifndef
QSAVEFILE_H
6
#
define
QSAVEFILE_H
7
8
#
include
<
QtCore
/
qglobal
.
h
>
9
10
#
if
QT_CONFIG
(
temporaryfile
)
11
12
#
include
<
QtCore
/
qfiledevice
.
h
>
13
#
include
<
QtCore
/
qstring
.
h
>
14
15
#
ifdef
open
16
#
error
qsavefile
.
h
must
be
included
before
any
header
file
that
defines
open
17
#
endif
18
19
QT_BEGIN_NAMESPACE
20
21
class
QAbstractFileEngine;
22
class
QSaveFilePrivate;
23
24
class
Q_CORE_EXPORT QSaveFile :
public
QFileDevice
25
{
26
Q_OBJECT
27
Q_DECLARE_PRIVATE(QSaveFile)
28
29
public
:
30
#
if
QT_CORE_REMOVED_SINCE
(
6
,
11
)
31
explicit
QSaveFile(
const
QString &name);
32
#
endif
33
explicit
QSaveFile(QObject *parent =
nullptr
);
34
explicit
QSaveFile(
const
QString &name, QObject *parent =
nullptr
);
35
~QSaveFile();
36
37
QString fileName()
const
override;
38
void
setFileName(
const
QString &name);
39
40
#
ifdef
Q_QDOC
41
Permissions permissions()
const
override;
42
bool
setPermissions(Permissions permissionSpec) override;
43
#
endif
// Q_QDOC
44
45
QFILE_MAYBE_NODISCARD
bool
open(OpenMode flags) override;
46
bool
commit();
47
48
void
cancelWriting();
49
50
void
setDirectWriteFallback(
bool
enabled);
51
bool
directWriteFallback()
const
;
52
53
#
if
QT_CONFIG
(
cxx17_filesystem
)
||
defined
(
Q_QDOC
)
54
Q_WEAK_OVERLOAD QSaveFile(
const
std::filesystem::path &path, QObject *parent =
nullptr
)
55
: QSaveFile(QtPrivate::fromFilesystemPath(path), parent)
56
{
57
}
58
59
std::filesystem::path filesystemFileName()
const
60
{
return
QtPrivate::toFilesystemPath(fileName()); }
61
Q_WEAK_OVERLOAD
void
setFileName(
const
std::filesystem::path &name)
62
{
63
setFileName(QtPrivate::fromFilesystemPath(name));
64
}
65
#
endif
// QT_CONFIG(cxx17_filesystem)
66
67
protected
:
68
qint64 writeData(
const
char
*data, qint64 len) override;
69
70
private
:
71
void
close() override;
72
#
if
!
QT_CONFIG
(
translation
)
73
static
QString tr(
const
char
*string) {
return
QString::fromLatin1(string); }
74
#
endif
75
76
private
:
77
Q_DISABLE_COPY(QSaveFile)
78
friend
class
QFilePrivate;
79
};
80
81
QT_END_NAMESPACE
82
83
#
endif
// QT_CONFIG(temporaryfile)
84
85
#
endif
// QSAVEFILE_H
file_already_open
static Q_DECL_COLD_FUNCTION bool file_already_open(QFile &file, const char *where=nullptr)
Definition
qfile.cpp:33
qtbase
src
corelib
io
qsavefile.h
Generated on
for Qt by
1.18.0