summaryrefslogtreecommitdiffstats
path: root/tools/qscxmlc/scxmlcppdumper.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Update mocUlf Hermann2024-02-061-1/+5
| | | | | | | | | | The actual moc hasn't changed since 6.7 was branched off. We can pick the change back. Pick-to: 6.7 Fixes: QTBUG-121344 Change-Id: Ied2406ccfdd8307e8f142ff68e45a27786089cc1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Update the moc copyUlf Hermann2023-08-221-1/+3
| | | | | | | | | | | | We need to explicitly cast the string data to char now because we want to use the moc helper functions that expect char*. Previously we got away with unsigned char* by declaring the members ourselves. Since we always want to cast to char anyway when retrieving the data, it doesn't matter. Task-number: QTBUG-116255 Change-Id: I1ca017b5b434942606675514eddceb1f725a8bd7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix ecmascript model memory leak with qscxmlc generated statemachinesJuha Vuolle2023-02-041-3/+3
| | | | | | | | | | When models are set to statemachines with QScxmlStateMachine::setDataModel(), the state machine does not assume ownership of the model. Pick-to: 6.5 Change-Id: I18e69f8c34906719b7f729eab7d46d271cfdf950 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-071-2/+2
| | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: I4b4548c9d4a13337731159c1e1184e48bb0a328b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Port from container::count() and length() to size()Marc Mutz2022-10-071-3/+3
| | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8: auto QtContainerClass = anyOf( expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o), expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)); makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container', with the extended set of container classes recognized. Change-Id: Iaf46b2ba54f3b125aee087c2cacb702d8d564201 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-141-27/+2
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: Ic435d3a484be01542f27431068419a2c252bd1f6 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QtScxml: Move ecmascript data model to a pluginTamas Martinec2021-02-171-3/+6
| | | | | | | | | | Move qscxmlecmascriptdatamodel to a plugin to remove the build time qml dependency. Task-number: QTBUG-89831 Change-Id: Ibac93cfe39e35c084ed9811a113c88cc660c0436 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
* Qt6: Port QtScxml to QStringViewKarsten Heimrich2020-07-011-8/+7
| | | | | | Task-number: QTBUG-84319 Change-Id: Ibb3af127a50adba9345540ea39c1c8cc17b72d06 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Update QtScxml module towards Qt6 changesKarsten Heimrich2020-07-011-1/+0
| | | | | | | | Fixes: QTBUG-85089 Change-Id: I78f8b1061f5dd75e435f9725fb6387670c1d2bf3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Use QList instead of QVectorJarek Kobus2020-06-261-8/+8
| | | | | | Task-number: QTBUG-84469 Change-Id: Ibaf2524e49e75ec660889261347eddbae9ccdbc6 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix compilation after string data changes in qtbaseSimon Hausmann2020-01-241-2/+2
| | | | | | | | | | Adjust the moc copied code to generate the same byte arrays for string literals and simplified the unicode string tables to just store offsets and size so that we can use QString::fromRawData (just like in qtdeclarative). Change-Id: Id19c165454451192e0764b5d889a1275e92417ac Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Merge remote-tracking branch 'origin/wip/qt6' into devSimon Hausmann2019-10-041-23/+23
|\ | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I1a52012a6e2c438a795222d687c33df6189962d2
| * Bump Qt version to Qt 6Alexandru Croitor2019-07-101-23/+23
| | | | | | | | | | | | | | | | Also fix usages of text stream operators. Change-Id: I53cf87bb4bb055d56f2332d7737f205ec9560774 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Fix compilation with explicit QChar(*int*) ctorsMarc Mutz2019-07-151-2/+2
|/ | | | | | | | | | The QChar ctors from integral non-char types are under consideration for adding explicit. Fix users of these ctors ahead of the change. Change-Id: I3f3480336ba30a368034bb15b67ada854115e374 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* qscxmlc: Don't compress the templatesThiago Macieira2019-06-201-6/+3
| | | | | | | | | Those files are small, so we may as well not bother. Fixes: QTBUG-76521 Change-Id: Ief874765cd7b43798de3fffd15a9f511bc9c723a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Merge remote-tracking branch 'origin/5.8' into devv5.9.0-alpha1Liang Qi2017-01-251-3/+17
|\ | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I639eb3acef7004a20447bbb66fb44661bf8e952e
| * Merge remote-tracking branch 'origin/5.8.0' into 5.8Liang Qi2017-01-041-1/+15
| |\ | | | | | | | | | | | | | | | | | | | | | Conflicts: src/scxml/qscxmlinvokableservice.cpp tools/qscxmlc/scxmlcppdumper.cpp Change-Id: Iadbe84d8eae7ccdf8dd9a0109af236a3747976c8
| | * Merge 5.8 into 5.8.0Oswald Buddenhagen2016-11-291-23/+8
| | |\ | | | | | | | | | | | | Change-Id: I8fa59d8b2559aa620eb533ed4274ea1b7374d2c7
| | * | Reduce the public API exposed in qscxmlinvokableservice.hUlf Hermann2016-11-291-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <erik.verbruggen@qt.io>
| * | | Resolve the mixup of various ID typesUlf Hermann2016-12-191-2/+2
| | |/ | |/| | | | | | | | | | | | | | | | We should not compare instances of different IDs with one another. Change-Id: I830d747ffde4c162c73475a600cef23e10c898e5 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* / | Optionally generate accessor and signal methods for statesUlf Hermann2016-12-131-7/+57
|/ / | | | | | | | | | | | | | | | | | | | | | | We can easily do this and provide a much nicer API. These methods are not available for dynamically loaded state machines. By default we provide the same API for compiled and loaded state machines. The new methods are only generated if you pass the "--statemethods" parameter to qscxmlc. A new qmake variable called "QSCXMLC_ARGUMENTS" is added for any extra arguments to qscxmlc such as this one. Change-Id: Ie7a4eb4890c9d42f89093f3cf3ea917ef2793518 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* / Drop the --no-c++11 parameter from qscxmlcUlf Hermann2016-11-231-23/+8
|/ | | | | | | We don't support C++98 anymore, so this is useless. Change-Id: Ie918567253af6d9309b601c7cfbc0205ec888048 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Drop the NOTIFY part from generated Q_PROPERTY macrosUlf Hermann2016-11-181-5/+2
| | | | | | | | | | They are unnecessary for code completion and somewhat wrong because the signal methods don't actually exist. Change-Id: Ie5326791aaf574fffc9f38b3c6bc786c1204ab45 Task-number: QTBUG-57174 Reviewed-by: Kevin Funk <kevin.funk@kdab.com> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Further clean up qscxmlinvokableservice.hv5.8.0-beta1Ulf Hermann2016-10-271-38/+26
| | | | | | | | We can group the various parameters passed around between the factories into a struct and we can move some methods into the private interface. Change-Id: I579ced7d501bdb617d4aefd47ced49746c9a5b94 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Do not accidentally generate <::Erik Verbruggen2016-10-181-2/+2
| | | | | | | | | C/C++ uses <: as a digraph (for an opening bracket), so templateName<::namespaceName::className> would generate errors. Task-number: QTBUG-53719 Change-Id: I32890db75e56470befeae0866307a6421ca3f911 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
* Clean up qscxmlinvokableservice.hUlf Hermann2016-10-141-2/+2
| | | | | | | | | | | | | | | | This is public API, so it should follow some minimal standards: * Use QObject's d pointer where possible * Follow the FooPrivate naming scheme for private classes * Don't expose any data members in the public interface * Give the various service classes somewhat logical names * Drop some #ifdefs (qscxmlinvokableservice.h isn't used for qscxmlc) Unfortunately we cannot drop any actual functionality from this header as we need all of it for the generated C++ code. Change-Id: Idd2698f7a331548eb1bf2d20da405a0fe05a92f0 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Simplify qscxmlexecutablecontent.hUlf Hermann2016-10-141-4/+4
| | | | | | | | | The only things we actually have to export are a few structs and typedefs. As we have to keep this binary compatible we should strive to make it as simple as possible. Change-Id: I54d365530800c86ecc3d859d6daea94e05b893a0 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Replace Q_FOREACH/foreach with ranged-forErik Verbruggen2016-09-251-8/+8
| | | | | Change-Id: I7b4d13a49577a7d984727722ff2ae4458eab2d6e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Clean up includesUlf Hermann2016-09-221-7/+8
| | | | | | | | This will hopefully enable us to build qscxmlc with force_bootstrap on macOS. Change-Id: Ib5d9494fae86b9bb12625aadb9ae3fac0a234520 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Don't generate empty switch statements for C++ data modelsUlf Hermann2016-09-141-21/+40
| | | | | | | Some compilers will complain about them. Change-Id: I82bee601480e43ce00657d609d30179fe17e6bdb Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Get rid of qt modeJarek Kobus2016-08-231-159/+8
| | | | | Change-Id: Id8cc29a9a27f571f063b1cec51e534a3c762f2c6 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* In Qt mode reject documents with events that cannot be mapped to slotsUlf Hermann2016-08-181-12/+0
| | | | | | | | | | | This severely limits the use of Qt mode, as hierarchical events like done.state.foo cannot appear in the document anymore. However, it makes the rules about what is and what is not legal in Qt mode more consistent. Task-number: QTBUG-53435 Change-Id: I08b90f34c651a57d86607eea2a38f5bd1f73b8b3 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Make generated signals publicUlf Hermann2016-08-091-1/+1
| | | | | | | | | | | Access control for signals cannot be enforced anyway and QML has a bug that makes the type compiler crash if anything tries to connect to a private signal. Besides, they should be accessible from other code. Change-Id: I9af527f012e3ea8538107b74ce20157f01fef6ae Task-number: QTBUG-51817 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Don't generate properties and getters for sub state machinesJarek Kobus2016-07-291-67/+0
| | | | | | | Now we have a generic API for it. Change-Id: I5e48f52b9d27ba3913db92ba238d64a732bb1bd8 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Generate forward declarations for all submachinesJarek Kobus2016-07-281-5/+3
| | | | | | | Before, we've skipped the first machine twice. Change-Id: Ia85f01139bd948aec0b2422b9f9bedfa6261148d Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Ensure sub machines are generated always in the same orderJarek Kobus2016-07-281-5/+4
| | | | | Change-Id: I116af61b6843d4e6e6877d77be662cd9828ef8ba Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Avoid compile warnings about empty switch statementsUlf Hermann2016-07-121-2/+9
| | | | | | | | MSVC 2015 doesn't like switch statements with nothing but a default clause. Change-Id: Iddce723fef54b61ae52d9256160c2fc44844bd0b Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Drop unnecessary semicolon after Q_DECLARE_METATYPEUlf Hermann2016-07-081-1/+1
| | | | | Change-Id: I25e991215774f879ad3f948143d337eaf38aa4a7 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Restore Q_PROPERTY macrosUlf Hermann2016-07-081-0/+31
| | | | | | | | | | | | This is still almost for free, and vastly easier to do than a solution with plugins.qmltypes. The plugins.qmltypes format is tailored for actual plugins, identifyable by a fixed URL. However, in the workflow we suggest right now, the URL is controlled by the user. Resolving it from the code would require the same guesswork as we have to do to resolve Q_PROPERTY macros from the headers. Change-Id: Iec916e7e91de096a38b61e6b76794b3dca3139d5 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Replace the QStateMachine-based implementation.Erik Verbruggen2016-06-091-1307/+730
| | | | | | | | | | | | Under the 'hood a table-based state machine is now used instead of the QStateMachine. The advantage is that states and transitions are no longer QObjects but integers (so no (private) object allocations), and we're no longer hijacking the QStateMachinePrivate to work around some implementation details. Change-Id: I47ab47ab01cbb2204b9ca0e4cdd6a72faf724ce3 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Implement srcexpr in <invoke>Jarek Kobus2016-06-071-0/+3
| | | | | Change-Id: I572342eb4952a6a0777a7503d374da6536ba052d Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Remove old, obsolete, dead codeJarek Kobus2016-04-191-31/+0
| | | | | Change-Id: I384cafc47b43cdc96d02cd98179503150af35758 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Allow history states for <scxml>'s "initial" attributeUlf Hermann2016-04-191-3/+3
| | | | | | | | The standard doesn't seem to prohibit this and QStateMachine can handle it. Change-Id: Ia22f564c9657582199c3c67318fafd21ec4a8770 Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
* Don't mangle service namesUlf Hermann2016-04-181-2/+2
| | | | | | | We want to look the services up by their original name later. Change-Id: I8a8061bccb064a779e50aefdc6cf348806b417cd Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
* Don't generate calls to setInitialState for parallel statesJarek Kobus2016-04-161-5/+7
| | | | | | | ScxmlVerifier also doesn't allow for it. Change-Id: I303bd6b81b4690acc2e7a2379e07b703e32a7a06 Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
* Detect clashes in event and state namesJarek Kobus2016-04-141-10/+7
| | | | | Change-Id: I6df9f73965442b7866c8912ac8a0a0858640bb62 Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
* Validate IDs and event names, and handle them well in C++ generation.Erik Verbruggen2016-04-131-71/+153
| | | | | | Change-Id: I2e4e15496e7b2adc2f452745b1341f8fa0140b12 Task-number: QTBUG-51818 Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
* Write generated string literals as array of numbersUlf Hermann2016-04-131-9/+12
| | | | | | | | | Having UTF-8 literals in source code is notoriously brittle, as compilers interpret them differently. Let's just write every byte or qunicodechar as a number. That should remove any ambguity. Change-Id: I3d79c7f15dc58a3b74b3a79e9186a612d38cb5a5 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Use C escaping instead of hex encoding for generated metadataUlf Hermann2016-04-051-17/+3
| | | | | | | | | Hex-encoding characters above 0xff is hard to do in a cross-platform way. However, using C++11, we should be able to get portable wide character literals. Change-Id: I9b4faa7f443c00b43c8f15e5d1411b2d82609623 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* Use a plain QIODevice for dumping the C++Ulf Hermann2016-04-051-2/+3
| | | | | | | All the strings are converted to byte arrays already before. Change-Id: Ibdd565e0560fe97ff9347f8153a03cd60c21a508 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>