summaryrefslogtreecommitdiffstats
path: root/tools/repc/repcodegenerator.cpp
Commit message (Collapse)AuthorAgeFilesLines
* repc: Add support for #HEADER and #FOOTER linesDominik Holland2023-10-301-0/+12
| | | | | | | | | Those are useful when the generated classes should live inside a namespace. The lines are copied as is and no additional check is done in repc. Change-Id: I95413b953e695a7bc8e95b6653a4ef22ca7c1795 Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Add support for class attributes in rep filesDominik Holland2023-10-171-4/+8
| | | | | | | | | This can be used for visibility attributes to export or hide symbols, which is useful when the autogenerated code lives inside a lib. Change-Id: I734f805947dc029929e9e21d79318f4a31be7645 Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Support QT_NO_CAST_FROM_ASCII in generated codeCarl Schwan2023-03-061-4/+7
| | | | | | | | This is needed as the generated code will be included in targets with possibly QT_NO_CAST_FROM_ASCII set. Change-Id: Ic71e729657fbe2c0c402c86439e633cf6102e358 Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Port from container::count() and length() to size()Marc Mutz2022-10-061-14/+14
| | | | | | | | | | | | | | | | | | | | | 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: Id816b39977e17712fd078900037efc45f66a0175 Reviewed-by: Sona Kurazyan <kurazyan.sona@gmail.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* repc: Fix warning in generated codeDominik Holland2022-08-271-3/+9
| | | | | | | | | | | This ammends acd888220b9d600fe057249d43bd3934ae0cbad5 and adds the same check to three other methods as well. Pick-to: 6.2 6.3 6.4 Fixes: QTBUG-97790 Change-Id: Iecad6dbd1b99842a2c8802af2d973f9eb986d81e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* repc: Fix warning in generated codeDominik Holland2022-07-281-3/+9
| | | | | | | | | | | | | | | Check the array bounds using sizeof before access to make the compiler happy. Otherwise the following warning is generated: warning: array subscript 1 is above array bounds of ‘const int [1]’ [-Warray-bounds] Pick-to: 6.2 6.3 6.4 Fixes: QTBUG-97790 Change-Id: I52b36b065b9f62188e5bfc157081650ca3ee159e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* 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: I315d7ce1d6c6c3497afdfe8b61a113fdc181c935 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* repc: add missing qmap.h to generated filesMarc Mutz2022-04-051-0/+1
| | | | | | | | The header is no longer transitively included from qvariant.h. Pick-to: 6.3 6.2 Change-Id: I44b896da19c81464eacd1adfa914a723234a973d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix metatype registration of signal-slot params of type QList/QMap/QHashSona Kurazyan2021-12-061-0/+15
| | | | | | | | | | | | | | | | | | When declaring signals/slots that take QList/QMap/QHash parameters, we register metatypes for them. However, we don't always register metatypes for the parameter types of those containers. In particular, if a parameter is declared as a POD type in a separate .rep file, metatype registration for it is skipped. Fixed the code generation for metatype registration for signal-slot parameters of type QList/QMap/QHash to also register metatypes for the contained types if required. Pick-to: 6.2 Fixes: QTBUG-97704 Change-Id: Ic81895815c380e841c04f2d1400fc2c2cf0e3814 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Allow PODs to include enums/flagsBrett Stottlemyer2021-09-071-7/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The goal is to allow a new syntax: POD myPOD{ ENUM MyEnum {FOO, BAR} MyEnum myEnum, QString myString }, in addition to the current syntax POD myPOD(QString myString) The challenge is that the parsing simplified the detection of parameter types and parameter names by grabbing everything between the parentheses and having a separate chunk of code split that up. The new POD syntax requires the parser to detect and handle parameter types (including templated types) and handle that syntax. This converts the enum parsing to use new symbol and value tokens, rather than the enum_param token, which is necessary to enable a more generic type detection. The pod2 type has comparable syntax to the previous version, but uses brackets ('{' and '}') instead of parentheses for the definition. While this code detects the parameter type and parameter name distinctly, it currently merges all of the parameter content into a single string for processing using the original postprocess method. This ensures the capture is correct and there aren't any regressions. The tests were modified for the new POD syntax. The new code normalizes whitespace, rather than keeping the source formatting. Pick-to: 6.2 Change-Id: I671b23852fc2b515bcaea1ed389cfbde122683bd Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Move class signature handling to parser.gBrett Stottlemyer2021-08-241-88/+2
| | | | | | | | | | | | | | | | | | | This refactors the signature handling so the AST knows the signatures of the included types. This, in turn, allows the parser headers to be used directly for interpreting .rep files, without needing to includes pieces from the repc tool itself just for the signature. This also augments the signatures to use more fields * Handle individual elements of template parameters. For instance, "QHash<flag, POD>" will have a signature based on the flag's signature, the POD's signature and the string "QHash". * Flags include the signature of the enum they are based on * Enum signatures will include the type (if specified) and scope. Pick-to: 6.2 Change-Id: Id4e68e61a1c2690939e368e1e8e7555eb81fd68a Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Refactor repcodegeneratorBrett Stottlemyer2021-08-221-497/+722
| | | | | | | | | | | Two changes that affect a lot of lines 1) Make m_ast and m_stream member variables rather than passing them to most functions. 2) Keep lines to less than 100 characters for readability Pick-to: 6.2 Change-Id: I0c2bd2b549001fb4e9d36d17a2582b1f9bbb81f1 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Handle enums/flags as hash/map keysBrett Stottlemyer2021-08-171-4/+9
| | | | | | | | | This extends the previous commit to allow enums in hash/map containers. Pick-to: 6.2 Change-Id: Iaea9f9ddcbf2e01a611e20800305ebbf236eeada Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Enable use of Flags in .rep filesBrett Stottlemyer2021-08-171-9/+34
| | | | | | Pick-to: 6.2 Change-Id: I511c9592a4f45b6802a75db0db564d8709f0363c Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Add ability to use class enums in .repBrett Stottlemyer2021-08-171-96/+34
| | | | | | | | | | | | This extends the pattern match for enums (NB: w/ backwards compatibility) to allow generation of class enums as well as typed enums. NB2: I didn't realize "regular" enums could be typed in C++11, but that is supported as well. Pick-to: 6.2 Fixes: QTBUG-74835 Change-Id: I8baf334041ca54eefaf9e81f5dd08d7b57819838 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Generate a qDebug output for PODsBrett Stottlemyer2021-08-101-0/+16
| | | | | | | | We have one for dynamic PODs, we should have one for compiled code too. Pick-to: 6.2 Change-Id: I7909f8e04e896e97d8d6a6f2fe7c1177682561b4 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Include Model/Class info in class signatureBrett Stottlemyer2021-08-101-8/+31
| | | | | | | | | | | | | | This patch addresses the underlying issue where a subclass mismatch was not detected. Note: this change is not backwards compatible, so any rep MODEL or CLASS members will have a different signature in Qt5, so mixing Qt5 and Qt6 will not run. Picking to 5.15 would only affect the commercial costumers, which would be more confusing. Pick-to: 6.2 Change-Id: Idd40e36285760b8c15398c38defdc58350f85c50 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Refactor decodeVariant to pass by rvalue ref/std::moveBrett Stottlemyer2021-08-041-1/+1
| | | | | | | | | | | | | | The decodeVariant calls were weird in how their parameters were pass by reference so they could be changed, but without forcing a copy. It is clearer to pass by rvalue ref, using std::move on the calling side. This rippled up to calls that called the method, including setProperties which is part of the repc generated code. Because of the repc change, this should *not* be picked to Qt5. Pick-to: 6.2 Change-Id: Ieb1b0620569ad8eb9797edc57cc189d0b426510c Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Use QStringLiteral in repc-generated codeMårten Nordheim2021-06-081-2/+2
| | | | | | | This will save some copying at runtime. Change-Id: I87ada8b8afe0e6338049135d2c3c00dd3febbe1d Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Clean-up integer conversion warningsSona Kurazyan2021-02-261-17/+17
| | | | | Change-Id: Ib1229eb973066a7500cb759082a1a3a7ce978bfa Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Clean-up warningsSona Kurazyan2021-02-221-17/+17
| | | | | | | | | | | | | Fixed the following warnings: - empty expression statement has no effect; remove unnecessary ';' - use of old-style cast - zero as null pointer constant - other minor things Change-Id: Ia672f48d2aa87c59354fc93fd19862f1875e13db Reviewed-by: Brett Stottlemyer <bstottle@ford.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Use QList instead of QVectorJarek Kobus2021-02-161-19/+19
| | | | | | | | | Task-number: QTBUG-84469 Task-number: QTBUG-90907 Change-Id: Ifc6f05fb5e17e32ec04b383770080e812c854510 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Fix QMetaType Deprecation warningsBrett Stottlemyer2021-02-151-3/+3
| | | | | Change-Id: If7de5da3e7ad6d345e8b483486bb7177bccbc0df Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix compilation with Qt 6Sona Kurazyan2021-02-151-19/+1
| | | | | | | Task-number: QTBUG-90685 Change-Id: Iba9ee0a28ec0ceeca5ae318204deb14190042533 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Fix crash with same-named subobjects or modelsMichael Brasser2020-07-281-4/+6
| | | | | | | | Differentiate between subobjects or models coming from different primary objects. Change-Id: Ic4360ae208edbe31a1130f60248a501d63e55773 Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Update dependenciesBrett Stottlemyer2020-06-011-3/+3
| | | | | | | | | | | | | | | | This required removal of QRegExp and full conversion to QRegularExpression. In 5.x, we needed QRegExp, as the "bootstrap" minimal configuration for building host tools for cross-compilation did not include the QRegularExpression components. One of the tests was also converted from using the Qt::DateFormat enum to using the Qt::DayOfWeek enum, as several of the used DateFormat enums were removed in Qt6. Fixes: QTBUG-72592 Task-number: QTBUG-84590 Change-Id: I3414e6c106407819790de9cd179914ed45ece07e Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-01-111-1/+1
|\ | | | | | | Change-Id: I560e78617aa43e44d163542eab17bfebaec3c3df
| * Merge branch '5.14' into 5.15Tony Sarajärvi2020-01-081-1/+1
| |\ | | | | | | | | | Change-Id: I4ebcca43a5306763cf6248c0621b4c50a1e76067
| | * Fix internal compiler error of MinGW 8.1 caused by generated codeFriedemann Kleint2020-01-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use QLatin1String() instead of QStringLiteral() for the default argument, fixing: rep_model_merged.h: In instantiation of 'bool QRemoteObjectHostBase::enableRemoting(ObjectType*) [with ApiDefinition = MediaSourceAPI; ObjectType = MediaSimpleSource]': tst_modelreplicatest.cpp:63:52: required from here C:\Users\qt\work\install\include/QtCore/qstringliteral.h:66:23: internal compiler error: Segmentation fault ([]() noexcept -> QString { rep_model_merged.h:309:62: note: in expansion of macro 'QStringLiteral' MediaSourceAPI(ObjectType *object, const QString &name = QStringLiteral("Media")) Task-number: QTQAINFRA-3304 Change-Id: I7237ea7fbfd009ece9eb194b892019f0d00d56ef Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-12-211-331/+331
|\| | | | | | | | | | | Change-Id: I4f31a4cd76eb9248cbb2fead7d0ff3e6df9f5f92
| * | Replace endl with Qt::endlAllan Sandfeld Jensen2019-12-191-333/+331
| | | | | | | | | | | | | | | | | | | | | | | | Getting rid of "using namespace Qt;" Change-Id: I532e926625342eaa168ccd35de89c8a6a9465f50 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| * | Fix Qt6 buildAlexandru Croitor2019-12-191-0/+2
| |/ | | | | | | | | | | | | | | Change-Id: Ia263fc2fa86c8e304e52eac81087e2377e6ec1d5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> (cherry picked from commit 2599f07d153852b28b5f9df66f6a8ca19fb43e6a) Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/wip/qt6' into devSimon Hausmann2019-10-041-0/+2
|\ \ | |/ |/| | | | | | | | | Conflicts: .qmake.conf Change-Id: I6a25cd3cb2ae94cea140b37838e3fda70f22282b
| * Fix Qt6 buildAlexandru Croitor2019-07-091-0/+2
| | | | | | | | | | | | Change-Id: Ia263fc2fa86c8e304e52eac81087e2377e6ec1d5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Support SLOTs with return values in QMLMichael Brasser2019-08-231-3/+26
| | | | | | | | | | | | | | Task-number: QTBUG-77178 Task-number: QTBUG-76893 Change-Id: I170235140b1b4e23cf1d7db3f1501d800e6f07be Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* | Cleanup generated codeBogDan Vatra2019-07-191-25/+10
|/ | | | | Change-Id: I8e7d29072aa70942f5d9c9c0f0d05078b7f552ff Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* repc: eradicate Q_FOREACH loopsMarc Mutz2019-06-191-50/+55
| | | | | | | | | | | | | | | | | Q_FOREACH is scheduled for deprecation, or at the very least banned from use in Qt code. These are almost all simple: they iterate over const containers (or containers trivially marked as const) and their bodies clearly don't cause the container to change under iteration. Just in one case, where an iteration was over the concatenation of two containers, moved the loop body into a lambda and made separate loops of the containers, each calling the lambda. Saves 3.5KiB in text size on optimized AMD64 Linux GCC 9.1 builds. Change-Id: Ice917c3afaf5b206d74f3c4b4195e82e15a6ae98 Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* More fixes for (dynamic) enums in signals and slotsBrett Stottlemyer2019-05-171-10/+17
| | | | | | | | | | | | | | | | | | | | | | | This addresses two larger issues with enums and several smaller fixes. First, unlike the recent fix for properties, we need to register enums for queued connections to work and get signal/slot updates over QtRO to work. This change adds said registration. Second, enums are identified with the class they are defined in, so passing updates through a dynamic object requires converting the typenames. The templated enableRemoting methods become interesting here, as the class name depends on the type passed as a template parameter. This change also updates the repc output so enums are properly resolved via the templates. Smaller fixes include updates to some tests and several places where enums were converted to/from int. Note: we need (and have always needed) to convert enums to ints, since the class name is passed as part of the variant serialization which cannot be changed without major digging into qvariant and QDataStream serialization internals. Change-Id: I0a77f85df6a400a7a44394a05c9c2401bee4e4a8 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Fix dynamic enums in Props and SignalsBrett Stottlemyer2019-05-071-9/+41
| | | | | | | | | | | | | | These worked with repc generated types, but can fail when going to dynamic types (such as going through a proxy). This also makes two changes to help with this change: It adds a #define to dump what is sent for dynamic type info for initialization (for debugging the protocol itself) and changes the repc regexes so that a single character enum name can be used (previously the parsing would fail if the unless the name was at least two characters). Change-Id: Ied7219c60a901ef0cb00e06ef44001c6d077af89 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Fix handling of QVariant propertiesBrett Stottlemyer2019-05-061-8/+15
| | | | | | | | | | This required adding additional checks for QVariants that contain custom types like PODs. Change-Id: I5d77a07741000975ce8c5936688eab1af068dd6f Fixes: QTBUG-75056 Fixes: QTBUG-74084 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Do not register enums from other classesBogDan Vatra2018-09-261-13/+13
| | | | | | | | | | | | | | | | | | | | | Fixes the following situation: // test.rep class ClassA { ENUM EnumA {A1, A2} PROP(EnumA enuma); }; class ClassB { ENUM EnumB {B1, B2, B3}; PROP(EunmB enumb); CLASS classA(ClassA); }; Change-Id: I1aeb3ff023c895b1ebefdf8fda44a62ef1c525e5 Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Fix issues with refactored CLASS/MODEL supportMichael Brasser2018-05-171-0/+2
| | | | | | | | | * Don't crash source with null subobjects * Don't crash replica with extra properties * Ensure QML sees property changes at node assignment Change-Id: I08c713ae86ba3ea8c75f259a31a572ae8cff6c59 Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Add a blank line after generated <Class>SourceAPIMichael Brasser2018-04-271-0/+1
| | | | | | | | A generated file may have multiple classes, and this keeps space between them. Change-Id: Ie6327038b998df1ada02cbe24948365712628faa Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Support non-CONSTANT pointer typesBrett Stottlemyer2018-04-251-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to supporting nested source objects (internally), there was no way to support changing pointed to objects. Thus repc forced MODEL and CLASS types to be CONSTANT. This change adds update support, which required a few internal changes. First of all, the Q_PROPERTY flags were extended to include a new mode, SOURCEONLYSETTER. Having a replica setter for a pointer type makes no sense (it wouldn't then be part of the API contract, and would fail if the Node containing the replica dropped off the bus). So READWRITE didn't make sense for pointer types. That left READONLY, but that mode generated a protected, not public, setter on the Source side (the idea being that something internal to the source class, not public, would change the values). This would limit the functionality of pointer types, as they could only be updated by inheriting from a Source class. Adding SOURCEONLYSETTER addresses this, making the property read-only on the replica-side, but read/write (with a public setter) on the source-side. MODEL/CLASS now use SOURCEONLYSETTER. Another internal impact is that templated acquire calls (where metaobject data does not need to be sent from the source to define the type) can now be updated, which requires storing the compile-time generated metaobject for re-use. Thus a staticTypes member was added to the node metaoject- manager. Several tests (the ones with pointer-to-qobject properties) needed updating since those properties are not constant anymore, and thus don't have (or require) constructor parameters for setting the values. Change-Id: If20cb0fb673d5e91613f9c238b514ed05380f975 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Fix handling of CONSTANT propertiesBrett Stottlemyer2018-04-251-3/+14
| | | | | | | | Previously there was no notify signal on the replica side, so the default value could be updated, but no signal for the change would be emitted. Change-Id: I22650988dda7d89c353db5999fcc3870cd73f7ce Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Allow nodes to proxy (or convert) replicasBrett Stottlemyer2018-04-251-5/+5
| | | | | | | | | | | | This would support, for example, using the "local" (or "qnx") backend on a target, while still supporting debug via proxying the same objects over a single tcp connection. It should also, in theory, support converting to other marshalling formats (maybe CBOR?). Change-Id: Ib3c536d0c99b7a722c1c6ed145c8b5b567453f76 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Address repc generated override warningBrett Stottlemyer2018-04-051-1/+1
| | | | | Change-Id: I43b994d34530c3ad624a5c0cf5c91c8a7b49c8c4 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Make (internal) Source objects hierarchicalBrett Stottlemyer2018-04-041-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | QRemoteObjectSource is the class used to handle forwarding QObject changes over QtRO, internally storing the listener pointers and managing the send and receive of packets when changes occur. Previously, MODEL and CLASS objects in a parent class were handled by calling enableRemoting separately for each nested pointer type, resulting in separate (and independent) QRemoteObjectSource instances. This change defines a "Root" object (tied to the object enableRemoting() is called on), and any nested QObject types are then created as child source objects of the root object. The implementation creates an abstract QRemoteObjectSourceBase class, with QRemoteObjectRootSource and QRemoteObjectSource types derived from it. Only the Root objects become "known" types on the bus (and thus only Root objects can be acquired. A Private class instance is created by the Root object and the pointer passed to all child sources, providing a mechanism for sharing needed information (such as the list of listeners) amonst all members of the hierarchy. Change-Id: I632e847cad288b4540c7de6676f791ca2e675f46 Reviewed-by: Konstantin Tokarev <annulen@yandex.ru> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Rework REPC QObject* handlingv5.11.0-beta3Brett Stottlemyer2018-04-041-189/+129
| | | | | | | | | | | | | | | | | | | | | | | | | The MODEL and CLASS types were originally tacked on top of repc's property handling mechanism. That is, separate lists for models and subclasses were created instead of including the types in repc's list of property metadata. This was convenient for proving out the functionality, but led to a bunch of one-off code (generating Q_PROPERTY code manually, needing separate replica getter functions, etc). This change incorporates the pointer types back into the property list in repc, simplifying the code. This does require extensions because pointer types are not symmetric (i.e., for MODEL, the type is QAbstractItemModel* on the source side, QAbstractItemModelReplica* on the replica side). The generated SourceApi code is enhanced to compile-time check subclass types as well as take an optional name parameter (which allows a class to have multiple subclass pointers). SimpleSource handling of CONSTANT properties is also extended, providing constructor parameters to set the initial values. Change-Id: I91f542ef936abe4459962ae759ba3b0571464d5f Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Add metatype registrations for POD attributesv5.11.0-beta2Michael Brasser2018-03-081-1/+4
| | | | | Change-Id: Ia2a3b1e81d6f855c7e77741607a885f4a75d18a2 Reviewed-by: Brett Stottlemyer <bstottle@ford.com>