diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp index bfa705b3cca..f919a598b2b 100644 --- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp +++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp @@ -182,18 +182,18 @@ static QString moc(const QString &name) static QTextStream &writeHeader(QTextStream &ts, bool changesWillBeLost) { ts << "/*\n" - << " * This file was generated by " PROGRAMNAME " version " PROGRAMVERSION "\n" - << " * Command line was: " << commandLine << "\n" - << " *\n" - << " * " PROGRAMNAME " is " PROGRAMCOPYRIGHT "\n" - << " *\n" - << " * This is an auto-generated file.\n"; + " * This file was generated by " PROGRAMNAME " version " PROGRAMVERSION "\n" + " * Command line was: " << commandLine << "\n" + " *\n" + " * " PROGRAMNAME " is " PROGRAMCOPYRIGHT "\n" + " *\n" + " * This is an auto-generated file.\n"; if (changesWillBeLost) ts << " * Do not edit! All changes made to it will be lost.\n"; else ts << " * This file may have been hand-edited. Look for HAND-EDIT comments\n" - << " * before re-generating it.\n"; + " * before re-generating it.\n"; ts << " */\n\n"; @@ -484,7 +484,7 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf } hs << "#ifndef " << includeGuard << "\n" - << "#define " << includeGuard << "\n\n"; + "#define " << includeGuard << "\n\n"; // include our stuff: hs << "#include \n" @@ -492,8 +492,8 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf #if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) hs << "#include \n"; #else - hs << "#include \n"; - hs << "#include \n"; + hs << "#include \n" + "#include \n"; #endif for (const QString &include : std::as_const(includes)) { @@ -520,33 +520,33 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf // comment: hs << "/*\n" - << " * Proxy class for interface " << interface->name << "\n" - << " */\n"; + " * Proxy class for interface " << interface->name << "\n" + " */\n"; cs << "/*\n" - << " * Implementation of interface class " << className << "\n" - << " */\n\n"; + " * Implementation of interface class " << className << "\n" + " */\n\n"; // class header: hs << "class " << className << ": public QDBusAbstractInterface\n" - << "{\n" - << " Q_OBJECT\n"; + "{\n" + " Q_OBJECT\n"; // the interface name hs << "public:\n" - << " static inline const char *staticInterfaceName()\n" - << " { return \"" << interface->name << "\"; }\n\n"; + " static inline const char *staticInterfaceName()\n" + " { return \"" << interface->name << "\"; }\n\n"; // constructors/destructors: hs << "public:\n" - << " " << className << "(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = nullptr);\n\n" - << " ~" << className << "();\n\n"; + " " << className << "(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = nullptr);\n\n" + " ~" << className << "();\n\n"; cs << className << "::" << className << "(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)\n" - << " : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)\n" - << "{\n" - << "}\n\n" + " : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)\n" + "{\n" + "}\n\n" << className << "::~" << className << "()\n" - << "{\n" - << "}\n\n"; + "{\n" + "}\n\n"; // properties: for (const QDBusIntrospection::Property &property : interface->properties) { @@ -571,14 +571,14 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf // getter: if (property.access != QDBusIntrospection::Property::Write) { hs << " inline " << type << " " << getter << "() const\n" - << " { return qvariant_cast< " << type << " >(property(\"" - << property.name << "\")); }\n"; + " { return qvariant_cast< " << type << " >(property(\"" + << property.name << "\")); }\n"; } // setter: if (property.access != QDBusIntrospection::Property::Read) { hs << " inline void " << setter << "(" << constRefArg(type) << "value)\n" - << " { setProperty(\"" << property.name + " { setProperty(\"" << property.name << "\", QVariant::fromValue(value)); }\n"; } @@ -620,8 +620,8 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf writeArgList(hs, argNames, method.annotations, method.inputArgs); hs << ")\n" - << " {\n" - << " QList argumentList;\n"; + " {\n" + " QList argumentList;\n"; if (!method.inputArgs.isEmpty()) { hs << " argumentList"; @@ -632,7 +632,7 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf if (isNoReply) hs << " callWithArgumentList(QDBus::NoBlock, " - << "QStringLiteral(\"" << method.name << "\"), argumentList);\n"; + "QStringLiteral(\"" << method.name << "\"), argumentList);\n"; else hs << " return asyncCallWithArgumentList(QStringLiteral(\"" << method.name << "\"), argumentList);\n"; @@ -652,8 +652,8 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf writeArgList(hs, argNames, method.annotations, method.inputArgs, method.outputArgs); hs << ")\n" - << " {\n" - << " QList argumentList;\n"; + " {\n" + " QList argumentList;\n"; qsizetype argPos = 0; if (!method.inputArgs.isEmpty()) { @@ -664,7 +664,7 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf } hs << " QDBusMessage reply = callWithArgumentList(QDBus::Block, " - << "QStringLiteral(\"" << method.name << "\"), argumentList);\n"; + "QStringLiteral(\"" << method.name << "\"), argumentList);\n"; argPos++; hs << " if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().size() == " @@ -677,8 +677,8 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf method.annotations, i, "Out")) << ">(reply.arguments().at(" << i << "));\n"; hs << " }\n" - << " return reply;\n" - << " }\n"; + " return reply;\n" + " }\n"; } hs << "\n"; @@ -747,7 +747,7 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf QString mocName = moc(filename); if (includeMocs && !mocName.isEmpty()) cs << "\n" - << "#include \"" << mocName << "\"\n"; + "#include \"" << mocName << "\"\n"; cs.flush(); hs.flush(); @@ -795,18 +795,18 @@ static void writeAdaptor(const QString &filename, const QDBusIntrospection::Inte } hs << "#ifndef " << includeGuard << "\n" - << "#define " << includeGuard << "\n\n"; + "#define " << includeGuard << "\n\n"; // include our stuff: hs << "#include \n"; if (cppName == headerName) hs << "#include \n" - << "#include \n"; + "#include \n"; #if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) hs << "#include \n"; #else - hs << "#include \n"; - hs << "#include \n"; + hs << "#include \n" + "#include \n"; #endif for (const QString &include : std::as_const(includes)) { @@ -844,39 +844,39 @@ static void writeAdaptor(const QString &filename, const QDBusIntrospection::Inte // comment: hs << "/*\n" - << " * Adaptor class for interface " << interface->name << "\n" - << " */\n"; + " * Adaptor class for interface " << interface->name << "\n" + " */\n"; cs << "/*\n" - << " * Implementation of adaptor class " << className << "\n" - << " */\n\n"; + " * Implementation of adaptor class " << className << "\n" + " */\n\n"; // class header: hs << "class " << className << ": public QDBusAbstractAdaptor\n" - << "{\n" - << " Q_OBJECT\n" - << " Q_CLASSINFO(\"D-Bus Interface\", \"" << interface->name << "\")\n" - << " Q_CLASSINFO(\"D-Bus Introspection\", \"\"\n" + "{\n" + " Q_OBJECT\n" + " Q_CLASSINFO(\"D-Bus Interface\", \"" << interface->name << "\")\n" + " Q_CLASSINFO(\"D-Bus Introspection\", \"\"\n" << stringify(interface->introspection) << " \"\")\n" - << "public:\n" - << " " << className << "(" << parent << " *parent);\n" - << " virtual ~" << className << "();\n\n"; + "public:\n" + " " << className << "(" << parent << " *parent);\n" + " virtual ~" << className << "();\n\n"; if (!parentClassName.isEmpty()) hs << " inline " << parent << " *parent() const\n" - << " { return static_cast<" << parent << " *>(QObject::parent()); }\n\n"; + " { return static_cast<" << parent << " *>(QObject::parent()); }\n\n"; // constructor/destructor cs << className << "::" << className << "(" << parent << " *parent)\n" - << " : QDBusAbstractAdaptor(parent)\n" - << "{\n" - << " // constructor\n" - << " setAutoRelaySignals(true);\n" - << "}\n\n" + " : QDBusAbstractAdaptor(parent)\n" + "{\n" + " // constructor\n" + " setAutoRelaySignals(true);\n" + "}\n\n" << className << "::~" << className << "()\n" - << "{\n" - << " // destructor\n" - << "}\n\n"; + "{\n" + " // destructor\n" + "}\n\n"; hs << "public: // PROPERTIES\n"; for (const QDBusIntrospection::Property &property : interface->properties) { @@ -897,23 +897,23 @@ static void writeAdaptor(const QString &filename, const QDBusIntrospection::Inte hs << " " << type << " " << getter << "() const;\n"; cs << type << " " << className << "::" << getter << "() const\n" - << "{\n" - << " // get the value of property " << property.name << "\n" - << " return qvariant_cast< " << type <<" >(parent()->property(\"" << property.name << "\"));\n" - << "}\n\n"; + "{\n" + " // get the value of property " << property.name << "\n" + " return qvariant_cast< " << type <<" >(parent()->property(\"" << property.name << "\"));\n" + "}\n\n"; } // setter if (property.access != QDBusIntrospection::Property::Read) { hs << " void " << setter << "(" << constRefType << "value);\n"; cs << "void " << className << "::" << setter << "(" << constRefType << "value)\n" - << "{\n" - << " // set the value of property " << property.name << "\n" - << " parent()->setProperty(\"" << property.name << "\", QVariant::fromValue(value"; + "{\n" + " // set the value of property " << property.name << "\n" + " parent()->setProperty(\"" << property.name << "\", QVariant::fromValue(value"; if (constRefType.contains("QDBusVariant"_L1)) cs << ".variant()"; cs << "));\n" - << "}\n\n"; + "}\n\n"; } hs << "\n"; @@ -954,8 +954,8 @@ static void writeAdaptor(const QString &filename, const QDBusIntrospection::Inte hs << ");\n"; // finished for header cs << ")\n" - << "{\n" - << " // handle method call " << interface->name << "." << methodName(method) << "\n"; + "{\n" + " // handle method call " << interface->name << "." << methodName(method) << "\n"; // make the call bool usingInvokeMethod = false; @@ -1040,7 +1040,7 @@ static void writeAdaptor(const QString &filename, const QDBusIntrospection::Inte QString mocName = moc(filename); if (includeMocs && !mocName.isEmpty()) cs << "\n" - << "#include \"" << mocName << "\"\n"; + "#include \"" << mocName << "\"\n"; cs.flush(); hs.flush();