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
qqmldomfilewriter_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
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 QQMLDOMFILEWRITER_P
5#define QQMLDOMFILEWRITER_P
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "qqmldom_global.h"
20
21#include <QtCore/QFile>
22#include <QtCore/QStringList>
23#include <QtCore/QCoreApplication>
24
26namespace QQmlJS {
27namespace Dom {
28
30{
33public:
34 enum class Status { ShouldWrite, DidWrite, SkippedEqual, SkippedDueToFailure };
35
36 FileWriter() = default;
37
39 {
40 if (!silentWarnings) {
41 for (const QString &w : std::as_const(warnings))
42 qWarning() << w;
43 }
44 if (shouldRemoveTempFile)
45 tempFile.remove();
46 }
47
48 Status write(const QString &targetFile, function_ref<bool(QTextStream &)> write, int nBk = 2);
49
50 bool shouldRemoveTempFile = false;
51 bool silentWarnings = false;
52 Status status = Status::SkippedDueToFailure;
57
58private:
59 Q_DISABLE_COPY_MOVE(FileWriter)
60};
61
62} // namespace Dom
63} // namespace QQmlJS
65#endif
\inmodule QtCore
Definition qfile.h:93
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Combined button and popup list for selecting options.
static QT_BEGIN_NAMESPACE const char tempFile[]
#define Q_DECLARE_TR_FUNCTIONS(context)
#define qWarning
Definition qlogging.h:166
GLfloat GLfloat GLfloat w
[0]
#define QMLDOM_EXPORT
#define Q_GADGET
gzip write("uncompressed data")