aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/generator/shiboken2/headergenerator.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Sort writing of type indices when generating module header fileAlexandru Croitor2018-10-231-1/+8
| | | | | | | | | | | | | | | | Due to some unknown determinism, sometimes the type indices written to the generated module header file have a slightly different order, which means that many cpp files need to be rebuilt for no reason (semantically the content of the header file does not change). Make sure to sort the class list by type indices, to try and make the generated header file as deterministic as possible. This is a pre-requisite for improved incremental builds. Change-Id: Ie6a334453cdbfbb601fbac4b6be9291a746650f4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Add a typedef typesystem entryFriedemann Kleint2018-09-051-0/+30
| | | | | | | | | | | | | The intention is be able to specify typedef std::optional<int> OptionalInt in the typesystem file and generate code for it (without having a typedef in C++). Task-number: PYSIDE-725 Change-Id: I5847a3c3f68556ac1d0ea3635f65a29caa6cb208 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Reduce generated include statementsFriedemann Kleint2018-08-221-8/+0
| | | | | | | | Remove shiboken.h from the wrappers and some unneeded headers from the module header. Change-Id: Ib05433e77686e544e3dcae27f5256ae1bbf146e1 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Expose Shiboken generated Python module objectTilman Roeder2018-08-221-0/+2
| | | | | | | | | | | | | This change exposes the module object (a PyObject*) to the global namespace as Sbk[TYPESYSTEM NAME]ModuleObject. This is useful when generating bindings for cases where Python will run embedded into a host application. This variable is also included in the headers, where it is declared as `extern PyObject* Sbk[TYPESYSTEM NAME]ModuleObject;` for the convenience of developers reading the generated sources. Change-Id: Iaaa38b66b5d3aabc0fb8f995f964cd7aef2a11da Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken: Generate anonymous int-type enums instead of index macrosFriedemann Kleint2018-07-301-39/+38
| | | | | | | | | | | | | | | | | | | | | | #define SBK_QMETAOBJECT_CONNECTION_IDX 158 #define SBK_QTEXTCODEC_CONVERTERSTATE_IDX 246 becomes: enum : int { SBK_QMETAOBJECT_CONNECTION_IDX = 158, SBK_QTEXTCODEC_CONVERTERSTATE_IDX = 246, which is more pleasing to the eye. Rename the helper _writeTypeIndexDefineLine() to _writeTypeIndexValue() for the enum values and split out a function that writes the value only so that some code duplication can be avoided. Change-Id: I0d51afbbe93e515ba1dce1275fa5a01a6bcd95ca Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix some clang-tidy warnings in shibokenFriedemann Kleint2018-07-231-9/+8
| | | | | | | | | | | | | | | | | - 'else if' after return/break/continue - Use const ref for complex arguments passed by value where possible - Fix 'if (foo) delete foo' to 'delete foo' - Use container.isEmpty() instead of container.size() in checks - Use ' = default' for trivial constructors/destructors - Use range based for where possible - Complete constructor initializer lists - Fix invocations of static methods - Replace some reinterpret_cast by static_cast - Remove unused variables/fields - Use initializer lists for return types Change-Id: Id5b44a2f9d429f66ef069d532a1cd31df796d38e Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Make revision and SBK index a member of TypeEntryFriedemann Kleint2018-07-131-1/+1
| | | | | | | | | | | | | | | | | | They were previously stored in a global hash, apparently due to BC issues. Replace the global set/getTypeIndex/Revision functions by member functions of TypeEntry in typedatabase.cpp. As a drive-by change, simplify the code assigning the SBK numbers to use a flat list of entries ordered by revision and name instead of a grouped hash (bearing in mind that revision is rarely used) and might be removed one day). Also replace the use of std::unique() by the !contains()/append() pattern since std::unique() assumes an ordered list which is likely not the case. Task-number: PYSIDE-725 Task-number: PYSIDE-743 Change-Id: I9356acf1f5795446c08f266c1323f1db65cd490c Reviewed-by: Christian Tismer <tismer@stackless.com>
* Change license from all the filesCristian Maureira-Fredes2018-05-031-1/+1
| | | | | | | | | | | | | | | | | Removing the word 'project' from all the headers, and changing the PySide reference from the examples to Qt for Python: The following line was used inside the source/ and build_scripts/ directory: for i in $(grep -r "the Qt for Python project" * |grep -v "pyside2-tools" | awk '{print $1}' | sed 's/:.*//g');do sed -i 's/the\ Qt\ for\ Python\ project/Qt\ for\ Python/g' $i;done and the following line was used inside the examples/ directory: for i in $(grep -r "of the PySide" * |grep -v "pyside2-tools" | awk '{print $1}' | sed 's/:.*//g');do sed -i 's/of\ the\ PySide/of\ the\ Qt\ for\ Python/g' $i;done Change-Id: Ic480714686ad62ac4d81c670f87f1c2033d4ffa1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Rename PySide references to Qt for PythonCristian Maureira-Fredes2018-04-271-1/+1
| | | | | | | | | When referring to the project one should use "Qt for Python" and for the module "PySide2" Change-Id: I36497df245c9f6dd60d6e160e2fc805e48cefcae Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Rename Generator::fileNamePrefix() to fileNameSuffix()Friedemann Kleint2018-03-211-3/+3
| | | | | | Change-Id: If7464f643fca74aa06099ca4b9905b34bd077193 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Shiboken: Handle private abstract methodsFriedemann Kleint2018-01-191-2/+3
| | | | | | | | | Remove the exclusion. Required for Qt3dExtras::QAbstractCameraController::moveCamera() in 5.10. Task-number: PYSIDE-487 Change-Id: I67ae24d4cda2d90ac30c97f77457c2eaf65099ab Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Fix some clazy warningsFriedemann Kleint2018-01-171-1/+1
| | | | | | | | | | | | - Mixing const/non-const iterators - Do not use operator[] on temporaries of type QVector - Remove unused nontrivial variables - Add Q_FALLTHROUGH() - Potential detach in range-based for Change-Id: I89391fdda616f119eadd7de529eb6cee69343f85 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Generate override instead of virtualFriedemann Kleint2017-12-051-11/+8
| | | | | Change-Id: Ifcbabe09665c33daf5dd8d5df52036598c9f428f Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Do not generate wrapper methods for final C++ methodsFriedemann Kleint2017-12-021-1/+2
| | | | | | | | | This will result in a compilation error (overriding final method). Final methods appear in Qt3DInput::QMouse/QKeyboardDevice. Task-number: PYSIDE-487 Change-Id: I6eb300c91327c587b6bfe530fdafb519817171c4 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2017-11-061-1/+1
|\ | | | | | | Change-Id: I72583df407fc5b3caa8bf35fd997889a4ac86512
| * Remove dead / unused code regarding conversionsAlexandru Croitor2017-11-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's a lot of code that was previously used for doing conversions between C++ / Python types (apparently relying on extensive RTTI / typeid manipulations), which got superseded by a cleaner templated approach. The old code was left behind, and there were a few instances where it was still used even though it wasn't needed, like in QtScript typesystem XML and shiboken's enum handling. Remove the old code, apply the small changes needed to make it work with new the code. This is cleanup to reduce the confusion regarding conversion behavior, and also preparation for a proper implementation of handling "void*" types. Change-Id: I8f16bb31436f9a677bb2d64c7197c4375005b656 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2017-06-091-7/+32
|\| | | | | | | Change-Id: I73f39966a2af7aa935e1890e29c9b71573aae97c
| * Fix missing headers in PySide custom buildChristian Tismer2017-06-091-7/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PySide itself built fine after the additional includes were added for inheritance. But when a smaller project is built, suddenly header files are not found, because the inherited names are not expected by the deployment. Therefore, we do no longer add more includes, but insert recursive headers for the few relevant cases. So the includes become a little longer, but the names of the include files are those as before the enhanced inheritance. Task-number: PYSIDE-500 Change-Id: Iab456307a3c2365dfe1964dbe222b7d0efac7878 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
| * move everying into sources/shiboken2Oswald Buddenhagen2017-05-221-0/+558
| | | | | | in preparation for a subtree merge. this should not be necessary to do in a separate commit, but git is a tad stupid about following history correctly without it.
* move everying into sources/shiboken2 (5.9 edition)Oswald Buddenhagen2017-05-221-0/+569
in preparation for a subtree merge. this should not be necessary to do in a separate commit, but git is a tad stupid about following history correctly without it.