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