From 37747423e5d3bd419fa1d413c7d545a2d4e5552f Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 28 Nov 2016 17:13:37 +0100 Subject: Reduce the public API exposed in qscxmlinvokableservice.h We inline QScxmlInvokableService::finalize into the only place where it is used. Furthermore we construct static SCXML state machines through their metaobjects rather than directly calling the constructor. This way we can drop the template, make all the service factories QObjects, drop the intermediate QScxmlScxmlServiceFactory class, and greatly reduce the API exposed in qscxmlinvokableservice.h. In addition, as some of the structs in QScxmlExecutableContent are fairly large, we return them as const references, rather than by value. Change-Id: Ia9ee61b5668b8af44307787339c08f3c6f23f713 Reviewed-by: Erik Verbruggen --- tools/qscxmlc/decl.t | 2 +- tools/qscxmlc/scxmlcppdumper.cpp | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/qscxmlc/decl.t b/tools/qscxmlc/decl.t index 7c27f1d..09d6f72 100644 --- a/tools/qscxmlc/decl.t +++ b/tools/qscxmlc/decl.t @@ -6,7 +6,7 @@ public: ${properties} public: - ${classname}(QObject *parent = 0); + Q_INVOKABLE ${classname}(QObject *parent = 0); ~${classname}(); private: diff --git a/tools/qscxmlc/scxmlcppdumper.cpp b/tools/qscxmlc/scxmlcppdumper.cpp index 53988cf..aa207bb 100644 --- a/tools/qscxmlc/scxmlcppdumper.cpp +++ b/tools/qscxmlc/scxmlcppdumper.cpp @@ -387,7 +387,7 @@ int createFactoryId(QStringList &factories, const QString &className, QString line = QStringLiteral("case %1: return new ").arg(QString::number(idx)); if (invokeInfo.expr == QScxmlExecutableContent::NoInstruction) { - line += QStringLiteral("QScxmlStaticScxmlServiceFactory< %1::%2 >(") + line += QStringLiteral("QScxmlStaticScxmlServiceFactory(&%1::%2::staticMetaObject,") .arg(namespacePrefix, className); } else { line += QStringLiteral("QScxmlDynamicScxmlServiceFactory("); @@ -729,6 +729,20 @@ QString CppDumper::generateMetaObject(const QString &className, classDef.qualified = classDef.classname; classDef.superclassList << qMakePair(QByteArray("QScxmlStateMachine"), FunctionDef::Public); classDef.hasQObject = true; + FunctionDef constructor; + constructor.name = className.toUtf8(); + constructor.access = FunctionDef::Public; + constructor.isInvokable = true; + constructor.isConstructor = true; + + ArgumentDef arg; + arg.type.name = "QObject *"; + arg.type.rawName = arg.type.name; + arg.normalizedType = arg.type.name; + arg.name = "parent"; + arg.typeNameForCast = arg.type.name + "*"; + constructor.arguments.append(arg); + classDef.constructorList.append(constructor); // stateNames: int stateIdx = 0; -- cgit v1.2.3 From fd91566ac98e300725a161de40a4feba427e1fa8 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 29 Nov 2016 11:46:30 +0100 Subject: Fix header guards They should reflect the file name. Change-Id: I4f1ba1b98b673cfcb9ccacc8d83a42e06b1f2a3d Reviewed-by: Jarek Kobus --- tools/qscxmlc/scxmlcppdumper.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/qscxmlc/scxmlcppdumper.h b/tools/qscxmlc/scxmlcppdumper.h index 95fa48a..bd49cea 100644 --- a/tools/qscxmlc/scxmlcppdumper.h +++ b/tools/qscxmlc/scxmlcppdumper.h @@ -26,8 +26,8 @@ ** ****************************************************************************/ -#ifndef CPPDUMPER_H -#define CPPDUMPER_H +#ifndef SCXMLCPPDUMPER_H +#define SCXMLCPPDUMPER_H #include "qscxmlglobals.h" @@ -95,4 +95,4 @@ private: QT_END_NAMESPACE -#endif // CPPDUMPER_H +#endif // SCXMLCPPDUMPER_H -- cgit v1.2.3 From 51db93cf783662a155ced91dceef7508ffa955a6 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 24 Nov 2016 16:17:20 +0100 Subject: Resolve the mixup of various ID types We should not compare instances of different IDs with one another. Change-Id: I830d747ffde4c162c73475a600cef23e10c898e5 Reviewed-by: Erik Verbruggen --- tools/qscxmlc/scxmlcppdumper.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/qscxmlc/scxmlcppdumper.cpp b/tools/qscxmlc/scxmlcppdumper.cpp index b539e0d..81b9dcf 100644 --- a/tools/qscxmlc/scxmlcppdumper.cpp +++ b/tools/qscxmlc/scxmlcppdumper.cpp @@ -374,7 +374,7 @@ int createFactoryId(QStringList &factories, const QString &className, const int idx = factories.size(); QString line = QStringLiteral("case %1: return new ").arg(QString::number(idx)); - if (invokeInfo.expr == QScxmlExecutableContent::NoInstruction) { + if (invokeInfo.expr == QScxmlExecutableContent::NoEvaluator) { line += QStringLiteral("QScxmlStaticScxmlServiceFactory< %1::%2 >(") .arg(namespacePrefix, className); } else { @@ -445,7 +445,7 @@ void CppDumper::dump(TranslationUnit *unit) const QVector ¶meters, const QSharedPointer &content) -> int { QString className; - if (invokeInfo.expr == QScxmlExecutableContent::NoInstruction) { + if (invokeInfo.expr == QScxmlExecutableContent::NoEvaluator) { className = mangleIdentifier(classnameForDocument.value(content.data())); } return createFactoryId(factories[i], className, namespacePrefix, -- cgit v1.2.3 From c575eb524bc26fc4af3711d634110c226c9e11c0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 17 Jan 2017 17:51:12 +0100 Subject: remove obsolete host build declarations from subdirs projects follows up qtbase/4eb2feb2. Change-Id: I967126f8ae400f9cf8d49683920e71df960b1763 Reviewed-by: Joerg Bornemann --- tools/tools.pro | 2 -- 1 file changed, 2 deletions(-) (limited to 'tools') diff --git a/tools/tools.pro b/tools/tools.pro index f96987d..1854cfc 100644 --- a/tools/tools.pro +++ b/tools/tools.pro @@ -1,4 +1,2 @@ TEMPLATE = subdirs SUBDIRS = qscxmlc - -qscxmlc.CONFIG = host_build -- cgit v1.2.3