Libksieve

xmlprintingscriptbuilder.h
1 /*
2  SPDX-FileCopyrightText: 2013-2017 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #ifndef KSIEVE_KSIEVEUI_XMLPRINTINGSCRIPTBUILDER_H
8 #define KSIEVE_KSIEVEUI_XMLPRINTINGSCRIPTBUILDER_H
9 
10 #include "ksieveui_private_export.h"
11 #include <QString>
12 #include <ksieve/scriptbuilder.h>
13 class QXmlStreamWriter;
14 namespace KSieveUi
15 {
16 class KSIEVEUI_TESTS_EXPORT XMLPrintingScriptBuilder : public KSieve::ScriptBuilder
17 {
18 public:
19  XMLPrintingScriptBuilder();
20  XMLPrintingScriptBuilder(int indent);
21  ~XMLPrintingScriptBuilder() override;
22 
23  void taggedArgument(const QString &tag) override;
24  void stringArgument(const QString &string, bool multiLine, const QString & /*fixme*/) override;
25  void numberArgument(unsigned long number, char quantifier) override;
26  void commandStart(const QString &identifier, int lineNumber) override;
27  void commandEnd(int lineNumber) override;
28  void testStart(const QString &identifier) override;
29  void testEnd() override;
30  void testListStart() override;
31  void testListEnd() override;
32  void blockStart(int lineNumber) override;
33  void blockEnd(int lineNumber) override;
34  void stringListArgumentStart() override;
35  void stringListArgumentEnd() override;
36  void stringListEntry(const QString &string, bool multiline, const QString &hashComment) override;
37  void hashComment(const QString &comment) override;
38  void bracketComment(const QString &comment) override;
39 
40  void lineFeed() override;
41  void error(const KSieve::Error &error) override;
42  void finished() override;
43 
44  Q_REQUIRED_RESULT QString result() const;
45  Q_REQUIRED_RESULT QString error() const;
46  Q_REQUIRED_RESULT bool hasError() const;
47 
48  void clear();
49 
50 private:
51  void initialize(int indent = 0);
52  void write(const QString &key, const QString &value);
53  void write(const QString &key, const QString &qualifiedName, const QString &attribute, const QString &value);
54 
55  QXmlStreamWriter *mStream = nullptr;
56  QString mResult;
57  QString mError;
58 };
59 }
60 #endif
KCRASH_EXPORT void initialize()
void error(QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Notify)
bool hasError()
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Apr 11 2021 23:09:37 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.