Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
filedocumentwriter.h
Go to the documentation of this file.
1// Copyright (C) 2026 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4#ifndef FILEDOCUMENTWRITER_H
5#define FILEDOCUMENTWRITER_H
6
9
10#include <QtCore/qfile.h>
11#include <QtCore/qtextstream.h>
12
13#include <memory>
14
15QT_BEGIN_NAMESPACE
16
17class FileDocumentWriter : public DocumentWriter
18{
19public:
20 explicit FileDocumentWriter(OutputContext context);
21 ~FileDocumentWriter() override;
22
23 FileDocumentWriter(const FileDocumentWriter &) = delete;
24 FileDocumentWriter &operator=(const FileDocumentWriter &) = delete;
25 FileDocumentWriter(FileDocumentWriter &&) noexcept = default;
26 FileDocumentWriter &operator=(FileDocumentWriter &&) noexcept = default;
27
28 void beginDocument(const QString &fileName);
29
30 void endDocument();
31
32 void write(QStringView content) override;
33 void writeLine(QStringView content) override;
34 [[nodiscard]] bool isOpen() const override;
35 [[nodiscard]] QString currentFileName() const override;
36
37 [[nodiscard]] const OutputContext &context() const { return m_context; }
38
39private:
40 OutputContext m_context;
41 std::unique_ptr<QFile> m_file;
42 std::unique_ptr<QTextStream> m_stream;
43 QString m_currentFileName;
44};
45
46QT_END_NAMESPACE
47
48#endif // FILEDOCUMENTWRITER_H
The Location class provides a way to mark a location in a file.
Definition location.h:20
Location()
Constructs an empty location.
Definition location.cpp:48
Combined button and popup list for selecting options.
Bundles output configuration without static variables.