1 | /* |
2 | * BluezQt - Asynchronous BlueZ wrapper library |
3 | * |
4 | * SPDX-FileCopyrightText: 2019 Manuel Weichselbaumer <mincequi@web.de> |
5 | * |
6 | * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
7 | */ |
8 | |
9 | #ifndef CPPGENERATOR_H |
10 | #define CPPGENERATOR_H |
11 | |
12 | #include <QTextStream> |
13 | |
14 | class BluezApiParser; |
15 | class Method; |
16 | |
17 | class CppGenerator |
18 | { |
19 | public: |
20 | struct Config { |
21 | bool useOptional = false; |
22 | bool useDeprecated = false; |
23 | bool useExperimental = false; |
24 | bool useLowercaseFileNames = false; |
25 | QString author = QStringLiteral("John Doe <info@mail.com>" ); |
26 | QString year = QStringLiteral("2019" ); |
27 | }; |
28 | CppGenerator(const Config &config); |
29 | |
30 | bool generate(const BluezApiParser &parser); |
31 | |
32 | protected: |
33 | void (const BluezApiParser &parser); |
34 | void writeAdaptorSource(const BluezApiParser &parser); |
35 | |
36 | static QString interfaceToClassName(const QString &interface); |
37 | static QString lowerFirstChars(const QString &string); |
38 | static void (QTextStream &stream); |
39 | static void writeInterface(QTextStream &stream, const QString &name); |
40 | static void closeInterface(QTextStream &stream); |
41 | static bool writeMethod(QTextStream &stream, const Method &method); |
42 | static bool writeArg(QTextStream &stream, const QString ¶m, const QString &dir); |
43 | static void writeAnnotation(QTextStream &stream, const QString ¶m, const QString &dir, int i); |
44 | |
45 | void (QTextStream &stream); |
46 | |
47 | private: |
48 | Config m_config; |
49 | }; |
50 | |
51 | #endif // CPPGENERATOR_H |
52 | |