From f777b33b8ad41ebdd833045d798ab86861e07e4c Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 18 Nov 2016 13:53:11 +0100 Subject: Remove redundant "public:" from generated headers Conventionally Q_OBJECT and Q_PROPERTY is before the first access specifier. Change-Id: I4d93c08ada356d1a3695141852095224a215793b Reviewed-by: Kevin Funk Reviewed-by: Jan Arne Petersen Reviewed-by: Jarek Kobus --- tools/qscxmlc/decl.t | 1 - 1 file changed, 1 deletion(-) (limited to 'tools') diff --git a/tools/qscxmlc/decl.t b/tools/qscxmlc/decl.t index 7c27f1d..9482885 100644 --- a/tools/qscxmlc/decl.t +++ b/tools/qscxmlc/decl.t @@ -1,6 +1,5 @@ class ${classname}: public QScxmlStateMachine { -public: /* qmake ignore Q_OBJECT */ Q_OBJECT ${properties} -- cgit v1.2.3 From 30db0289dd354aec9cb0f81a2e6c71cbbc5aeb0c Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 23 Nov 2016 16:07:55 +0100 Subject: Fix qscxmlc documentation The arguments have been renamed. Change-Id: If8d504f5ce859cfd5600a37cc754be5106de49ca Reviewed-by: Jarek Kobus Reviewed-by: Leena Miettinen --- tools/qscxmlc/doc/qscxmlc.qdoc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'tools') diff --git a/tools/qscxmlc/doc/qscxmlc.qdoc b/tools/qscxmlc/doc/qscxmlc.qdoc index f0d6726..eaa6406 100644 --- a/tools/qscxmlc/doc/qscxmlc.qdoc +++ b/tools/qscxmlc/doc/qscxmlc.qdoc @@ -65,23 +65,24 @@ \li Option \li Description \row - \li \c -no-c++11 + \li \c --no-c++11 \li Use no C++11 features in the generated code. \row - \li \c {-namespace } - \li Put the generated class(es) in the specified namespace. + \li \c {--namespace } + \li Put the generated class(es) in the specified namespace. You can use the + \c QSCXMLC_NAMESPACE variable to specify this in your project file. \row \li \c {-o } \li The base name of the output files. This can include a path. If none is specified, the basename of the input file is used. \row - \li \c {-oh
} + \li \c {--header
} \li The name of the output header file. If none is specified, .h is added to the base name. \row - \li \c {-ocpp } + \li \c {--impl } \li The name of the output header file. If none is specified, .cpp is added to the base name. \row - \li \c {-classname } + \li \c {--classname } \li The class name of the generated state machine. If none is specified, the value of the name attribute of the tag is taken. If that attribute is not specified either, the basename (excluding path) is taken from the input file name. -- cgit v1.2.3 From 6fa9b98c7d67b4ffd7d859ad54b8213675c0e4bb Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 23 Nov 2016 16:21:45 +0100 Subject: Drop the --no-c++11 parameter from qscxmlc We don't support C++98 anymore, so this is useless. Change-Id: Ie918567253af6d9309b601c7cfbc0205ec888048 Reviewed-by: Jarek Kobus --- tools/qscxmlc/doc/qscxmlc.qdoc | 3 --- tools/qscxmlc/qscxmlc.cpp | 4 ---- tools/qscxmlc/scxmlcppdumper.cpp | 31 ++++++++----------------------- tools/qscxmlc/scxmlcppdumper.h | 4 +--- 4 files changed, 9 insertions(+), 33 deletions(-) (limited to 'tools') diff --git a/tools/qscxmlc/doc/qscxmlc.qdoc b/tools/qscxmlc/doc/qscxmlc.qdoc index eaa6406..07b5c8d 100644 --- a/tools/qscxmlc/doc/qscxmlc.qdoc +++ b/tools/qscxmlc/doc/qscxmlc.qdoc @@ -64,9 +64,6 @@ \header \li Option \li Description - \row - \li \c --no-c++11 - \li Use no C++11 features in the generated code. \row \li \c {--namespace } \li Put the generated class(es) in the specified namespace. You can use the diff --git a/tools/qscxmlc/qscxmlc.cpp b/tools/qscxmlc/qscxmlc.cpp index de97a18..89abdaa 100644 --- a/tools/qscxmlc/qscxmlc.cpp +++ b/tools/qscxmlc/qscxmlc.cpp @@ -107,8 +107,6 @@ int run(const QStringList &arguments) cmdParser.setApplicationDescription(QCoreApplication::translate("main", "Compiles the given input.scxml file to a header and a cpp file.")); - QCommandLineOption optionNoCxx11(QLatin1String("no-c++11"), - QCoreApplication::translate("main", "Don't use C++11 in generated code.")); QCommandLineOption optionNamespace(QLatin1String("namespace"), QCoreApplication::translate("main", "Put generated code into ."), QCoreApplication::translate("main", "namespace")); @@ -127,7 +125,6 @@ int run(const QStringList &arguments) cmdParser.addPositionalArgument(QLatin1String("input"), QCoreApplication::translate("main", "Input SCXML file.")); - cmdParser.addOption(optionNoCxx11); cmdParser.addOption(optionNamespace); cmdParser.addOption(optionOutputBaseName); cmdParser.addOption(optionOutputHeaderName); @@ -152,7 +149,6 @@ int run(const QStringList &arguments) const QString scxmlFileName = inputFiles.at(0); TranslationUnit options; - options.useCxx11 = !cmdParser.isSet(optionNoCxx11); if (cmdParser.isSet(optionNamespace)) options.namespaceName = cmdParser.value(optionNamespace); QString outFileName = cmdParser.value(optionOutputBaseName); diff --git a/tools/qscxmlc/scxmlcppdumper.cpp b/tools/qscxmlc/scxmlcppdumper.cpp index 53988cf..b539e0d 100644 --- a/tools/qscxmlc/scxmlcppdumper.cpp +++ b/tools/qscxmlc/scxmlcppdumper.cpp @@ -143,28 +143,17 @@ static const char *headerStart = using namespace DocumentModel; -QString createContainer(const QString &baseType, const QString &elementType, - const QStringList &elements, bool useCxx11) +QString createContainer(const QStringList &elements) { QString result; - if (useCxx11) { - if (elements.isEmpty()) { - result += QStringLiteral("{}"); - } else { - result += QStringLiteral("{ ") + elements.join(QStringLiteral(", ")) + QStringLiteral(" }"); - } + if (elements.isEmpty()) { + result += QStringLiteral("{}"); } else { - result += QStringLiteral("%1< %2 >()").arg(baseType, elementType); - if (!elements.isEmpty()) { - result += QStringLiteral(" << ") + elements.join(QStringLiteral(" << ")); - } + result += QStringLiteral("{ ") + elements.join(QStringLiteral(", ")) + QStringLiteral(" }"); } return result; } -QString createVector(const QString &elementType, const QStringList &elements, bool useCxx11) -{ return createContainer(QStringLiteral("QVector"), elementType, elements, useCxx11); } - static void generateList(QString &out, std::function next) { const int maxLineLength = 80; @@ -380,8 +369,7 @@ int createFactoryId(QStringList &factories, const QString &className, const QString &namespacePrefix, const QScxmlExecutableContent::InvokeInfo &invokeInfo, const QVector &namelist, - const QVector ¶meters, - bool useCxx11) + const QVector ¶meters) { const int idx = factories.size(); @@ -405,8 +393,7 @@ int createFactoryId(QStringList &factories, const QString &className, for (auto name : namelist) { l.append(QString::number(name)); } - line += QStringLiteral("%1, ").arg( - createVector(QStringLiteral("QScxmlExecutableContent::StringId"), l, useCxx11)); + line += QStringLiteral("%1, ").arg(createContainer(l)); } { QStringList l; @@ -416,9 +403,7 @@ int createFactoryId(QStringList &factories, const QString &className, QString::number(parameter.expr), QString::number(parameter.location)); } - line += QStringLiteral("%1);").arg( - createVector(QStringLiteral("QScxmlExecutableContent::ParameterInfo"), l, - useCxx11)); + line += QStringLiteral("%1);").arg(createContainer(l)); } factories.append(line); @@ -464,7 +449,7 @@ void CppDumper::dump(TranslationUnit *unit) className = mangleIdentifier(classnameForDocument.value(content.data())); } return createFactoryId(factories[i], className, namespacePrefix, - invokeInfo, names, parameters, m_translationUnit->useCxx11); + invokeInfo, names, parameters); }); classNames.append(mangleIdentifier(classnameForDocument.value(doc))); } diff --git a/tools/qscxmlc/scxmlcppdumper.h b/tools/qscxmlc/scxmlcppdumper.h index 2d6b12c..95fa48a 100644 --- a/tools/qscxmlc/scxmlcppdumper.h +++ b/tools/qscxmlc/scxmlcppdumper.h @@ -41,14 +41,12 @@ QT_BEGIN_NAMESPACE struct TranslationUnit { TranslationUnit() - : useCxx11(true) - , mainDocument(Q_NULLPTR) + : mainDocument(Q_NULLPTR) {} QString scxmlFileName; QString outHFileName, outCppFileName; QString namespaceName; - bool useCxx11; DocumentModel::ScxmlDocument *mainDocument; QList allDocuments; QHash classnameForDocument; -- cgit v1.2.3