Qt 6.x
The Qt SDK
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 (QString w : warnings)
42 qWarning() << w;
43 if (shouldRemoveTempFile)
44 tempFile.remove();
45 }
46
47 Status write(QString targetFile, function_ref<bool(QTextStream &)> write, int nBk = 2);
48
49 bool shouldRemoveTempFile = false;
50 bool silentWarnings = false;
51 Status status = Status::SkippedDueToFailure;
56
57private:
58 Q_DISABLE_COPY_MOVE(FileWriter)
59};
60
61} // namespace Dom
62} // namespace QQmlJS
64#endif
\inmodule QtCore
Definition qfile.h:93
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
\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:162
GLfloat GLfloat GLfloat w
[0]
#define QMLDOM_EXPORT
#define Q_GADGET
gzip write("uncompressed data")