File indexing completed on 2024-04-21 03:52:04

0001 /*
0002  * BluezQt - Asynchronous BlueZ wrapper library
0003  *
0004  * SPDX-FileCopyrightText: 2019 Manuel Weichselbaumer <mincequi@web.de>
0005  *
0006  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007  */
0008 
0009 #ifndef XMLGENERATOR_H
0010 #define XMLGENERATOR_H
0011 
0012 class BluezApiParser;
0013 class Method;
0014 class Parameter;
0015 class QString;
0016 class QTextStream;
0017 
0018 class XmlGenerator
0019 {
0020 public:
0021     struct Config {
0022         bool useOptional = false;
0023         bool useDeprecated = false;
0024         bool useExperimental = false;
0025     };
0026     XmlGenerator(const Config &config);
0027 
0028     bool generate(const BluezApiParser &parser);
0029 
0030 private:
0031     static void writeHeader(QTextStream &stream);
0032     static void writeFooter(QTextStream &stream);
0033     static void writeInterface(QTextStream &stream, const QString &name);
0034     static void closeInterface(QTextStream &stream);
0035     static bool writeMethod(QTextStream &stream, const Method &method);
0036     static bool writeArg(QTextStream &stream, const Parameter &param, const QString &dir);
0037     static void writeAnnotation(QTextStream &stream, const Parameter &param, const QString &dir, int i);
0038 
0039     Config m_config;
0040 };
0041 
0042 #endif // XMLGENERATOR_H