aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/tests/samplebinding/typesystem_sample.xml
Commit message (Collapse)AuthorAgeFilesLines
* Rename shiboken2 to shiboken6Friedemann Kleint2020-10-281-2466/+0
| | | | | | | | Adapt CMake files, build scripts, tests and examples. Task-number: PYSIDE-904 Change-Id: I4cb5ee4c8df539546014b08202a7b1e98ed3ff07 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* remove traces of Python2 from C codeChristian Tismer2020-10-271-5/+0
| | | | | | | | | | | | It will be assumed that Python is always Python 3. All checks for Python 2 are removed. This is the second part of cleaning up the C code from references to Python 2. Task-number: PYSIDE-904 Change-Id: I3006412c2a5bb65402101b0aac5a5f2fc79ce2f8 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-10-161-0/+6
|\ | | | | | | Change-Id: I27beffe4a6e2fc2f818960c3b9f5ffbfaac4a670
| * Add a test for typesystem typedefsFriedemann Kleint2020-10-151-0/+6
| | | | | | | | | | | | | | | | | | Mimicks some template which might be used trying to enforce correctness of units by type checking. Task-number: PYSIDE-725 Change-Id: Ia7008d7db5638920eee3d0ef36cc32a63796b98e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-10-011-0/+1
|\| | | | | | | Change-Id: Idaf124ad5e1d6a41d52918cecba47499be5e7324
| * shiboken2: Generate functions from invisible top level namespaces as global ↵Friedemann Kleint2020-09-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | functions Mainly add those in ShibokenGenerator::getGlobalFunctionGroups() with some adaptions. Task-number: PYSIDE-1075 Change-Id: I6dabac72c204904e76162542b5aa3ea1ac3b56ec Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Add QStringView/QByteArrayViewFriedemann Kleint2020-09-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | View types as function parameters cannot be converted in the standard way shiboken does it: QStringView cppArg0; pythonToCpp(pyArg, &cppArg0); since they reference some other data. Introduce a new "viewOn" member to type system entry for them. It causes the function arguments to be replaced by their viewed-on types (stringview->string) via metatype. Add a test in libsample and a test for QUuid::fromString(QStringView). Test returning QStringView via QRegularExpressionMatch::capturedView(). Task-number: QTBUG-84319 Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Task-number: PYSIDE-487 Change-Id: Iddb4ea268a54928d290e29012e2738772fae83f0 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-09-301-5/+1
|\| | | | | | | Change-Id: I13721e13d2fab13945385fe529afe4ab431e0532
| * shiboken2: Consolidate tests for invisible namespacesFriedemann Kleint2020-09-291-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | Move the tests for PYSIDE-1074 from samplenamespace.h to removednamespaces.h. The latter has also a test case for an invisible namespace under a visible namespace besides the invisible top level namespace test. Task-number: PYSIDE-1074 Task-number: PYSIDE-1075 Change-Id: I5d1c6428f6ceadf929063c2c69723a7871173f4e Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-09-291-3/+4
|\| | | | | | | Change-Id: Ie6da3938b82f5ebe96dd12bd65a3ccc4180d2fba
| * shiboken2: Fix the tests for enums in removed namespacesFriedemann Kleint2020-09-281-3/+3
| | | | | | | | | | | | | | | | | | Change the formatting for better readability and use the "visible" attribute instead of the deprecated "generate". Task-number: PYSIDE-1075 Change-Id: Ibbb33d2482c1d682f74d2edce2dd7d3bb1a50821 Reviewed-by: Christian Tismer <tismer@stackless.com>
| * shiboken2: Generate properties as fieldsFriedemann Kleint2020-09-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add an XML attribute specifying whether code is to be generated to the XML properties. - Split the generator functions for field setters and getters apart so that they can be used for generating property setters and getters. - Generate code for all properties from XML when the PySide extension is not used, otherwise only for those with the attribute set. Task-number: PYSIDE-1019 Change-Id: Iab2ba38b90038edc667a233c23c7113fdc6fb438 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-09-221-0/+5
|\| | | | | | | Change-Id: Id0fc76666bbdb254a833eeb6909a0874b2611bf3
| * shiboken2: Allow specifying the sequence of overloadsFriedemann Kleint2020-09-211-0/+5
| | | | | | | | | | | | | | | | | | | | | | Add an attribute to specify a number by which the functions will be sorted. This deactivates the default sorting which tries to avoid implicit conversions. Fixes: PYSIDE-1366 Change-Id: I9a891e21f86152b2fdfda9a48d685f19aa936508 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Remove Python2 from C++ codeFriedemann Kleint2020-09-031-26/+4
|/ | | | | | | Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Change-Id: I7e4ffaeabb2ac8a5ffe165d43b3475a7e5d57447 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Enable adding operators ==, != as functions without code injectionFriedemann Kleint2020-07-221-0/+17
| | | | | | | | | | | | | As of Qt 6, there is a trend of hiding bool returns of comparison operators of container classes behind some template expression which the clang parser cannot identify. To work arouind such cases, make it possible to add them as functions without code injection which will generate the default code. Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Change-Id: Ia7bf5d583e0f80505fe1b759347955fec5dca600 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* typesystem_sample.xml: Expand tabsFriedemann Kleint2020-06-191-11/+11
| | | | | Change-Id: I64479f27828cfb574427b457223c97176c8646ad Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15Friedemann Kleint2020-06-111-0/+1
|\ | | | | | | Change-Id: I6cf604e1ae7234ce4f0d99169e9269a7dde07a4a
| * shiboken: Fix default-initialized function argumentsFriedemann Kleint2020-06-111-0/+1
| | | | | | | | | | | | | | | | Specifying {} causes it to be qualified, check this. Change-Id: Idd23c8a5af01cd7fbb63a2e5a01bb349c530fe54 Fixes: PYSIDE-1325 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Enable injecting raw code for setattro/getattroFriedemann Kleint2020-05-041-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | Setattro/getattro functions can be added. As shiboken also uses these functions internally, the code blocks are inserted into those implementations. As those are special functions, only raw code is injected. No macros are replaced for arguments or instances. Fixes: PYSIDE-1280 Change-Id: I207dcf70b3a9f5edc51ff6566b31a2a8aa4776ed Reviewed-by: Christian Tismer <tismer@stackless.com>
* | shiboken: Fix classes in hidden namespacesFriedemann Kleint2019-12-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There was an existing functionality to hide namespaces when specifying generate="no" on namespace-type which did not work for classes. In addition, it was implemented using the generation attributes of TypeEntry. This is problematic since dependent typesystems are loaded with generate="no", which actually means that no code should be generated for them. To fix this, introduce a new "visible" attribute for namespaces which also accommodates for hiding C++ 11 inline namespaces. Some projects uses the namespaces as packagename while creating python bindings, and to avoid duplicate names they ignore the original c++ namespace. For example a class like that: namespace Qt3D { class Vector; } The namespace "Qt3D" will be used as package name so the namespace "Qt3D" should be ignored during the generation, otherwise the 'Vector' type will be represented by 'Qt3D.Qt3D.Vector' and that is not what we want. Initial-patch-by: Renato Araujo Oliveira Filho <renato.araujo@kdab.com> Fixes: PYSIDE-1074 Change-Id: I3fd391ac3d839d3f8f510c6a4d4000f7d92eacff Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | libsample: Test renaming via "target-lang-name" attributeFriedemann Kleint2019-12-031-0/+3
|/ | | | | | | | | | | | | | | | | | | | | | | Rename a class and test repr and signatures of users. The test fails F ====================================================================== FAIL test (__main__.RenamingTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "renaming_test.py", line 46, in test "(self, v 'sample.RenamedValue')") AssertionError "(self, v: 'sample.ToBeRenamedValue')" != "(self, v: 'sample.RenamedValue')" - (self, v 'sample.ToBeRenamedValue') ? ---- + (self, v 'sample.RenamedValue') Task-number: PYSIDE-1133 Task-number: PYSIDE-990 Task-number: PYSIDE-1074 Change-Id: I402439fd202c33cac281c4628ceba79406198a27 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Merge remote-tracking branch 'origin/5.13' into 5.14Friedemann Kleint2019-10-081-0/+6
|\ | | | | | | Change-Id: Ibe15176ae36ea31bd1799d9bf8a39b57f9338ca0
| * shiboken: Fix handling of modified default expressionsFriedemann Kleint2019-10-041-0/+6
| | | | | | | | | | | | | | | | | | | | - Do not try to resolve modified default expressions (add enumeration scopes or similar) - Fix the signature parser to handle arbitrary expressions Fixes: PYSIDE-1095 Change-Id: I059c3a1f066687d7c2f0dad9ea7f0d93e292b1b5 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | shiboken/Sample test: Remove ambiguous modificationFriedemann Kleint2019-10-031-1/+0
|/ | | | | | | The default expression should either be removed or replaced. Change-Id: I54fcf1f4890610f5f5e87f191832deee33dd0561 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Declare XML files to be in encoding UTF-8Friedemann Kleint2019-04-181-1/+1
| | | | | | | | Some XML tools trip over the missing character set. Change-Id: Icbe1b2485325b70c4772b6a370a98fd529437a8a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Handle <array> modifications in template inheritanceFriedemann Kleint2019-03-011-2/+11
| | | | | | | | | | | | | | | | | | | | Array modifications did not work in template specializations (like typedef QGenericMatrix<2,2,int> QMatrix2x2> causing warnings like: There's no user provided way (conversion rule, argument removal, custom code, etc) to handle the primitive type 'const float *' of argument 1 in function 'QMatrix2x2::QMatrix2x2(const float * values)'. Rewrite the array modification code to operate on AbstractMetaType only instead of requiring code model data types and add the missing handling to AbstractMetaBuilderPrivate::inheritTemplate(). Add a test. Note that the warning was fixed by another change removing the array modification since it did not take effect due to the presence of a manually added PySequence constructor. Change-Id: Ie4a1092fbef7237f8858790a74e2f75070ef6586 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Check whether enum should be converted to int for the protected hackFriedemann Kleint2018-10-011-0/+1
| | | | | | | | | | | Find the AbstractMetaEnum belonging to the type entry and perform some checks. Generally do not use int for public enums. Warn when a protected scoped enum is encountered as this cannot be converted. Task-number: PYSIDE-817 Change-Id: I02b566093b331ea2ea627bf72964aad0a1a51c83 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* Add exception handlingFriedemann Kleint2018-09-271-0/+2
| | | | | | | | | | | | | Add XML elements specifying an exception handling mode to type system, complex type entries (classes) and function modifications. From the mode and the exception specification as detected by Clang, deduce whether to generate try/catch code. Task-number: PYSIDE-62 Change-Id: Ib76adc21cefd81bf9f82f819a3c151056c33a3b7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Improve handling of non-type template integer parametersFriedemann Kleint2018-09-131-0/+4
| | | | | | | | | | | | | | When trying to specify the base class template<int R, int C> QGenericMatrix of the QMatrixRxN classes, clashes of the SBK..IDX enumeration values occurred since the integers were not part of the type name. Fix that by dynamically adding dummy entries of EnumValueTypeEntry for the integer values encountered on the fly. Task-number: PYSIDE-725 Change-Id: Ie6b4489b5293e04b7c2c76861341c99b136cd558 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Merge remote-tracking branch 'origin/5.11' into devFriedemann Kleint2018-07-241-2/+2
|\ | | | | | | Change-Id: Ie90b31ed1b88f1353261fc4040db2d788df279e6
| * Pep 384 Final Cut: Remove PepTypeChristian Tismer2018-07-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While trying to document the Limited API Project, it suddenly struck me: We can make the patch much much simpler and implement it without the necessity to have an extra PepType! Now I am happy to continue the documentation, because it is now no more improvable. This version will last as long as the layout of PyTypeObject does not change substantially. When that happens, then we need to rewrite stuff with the according PyType_GetSlot() access functions. These access functions will until then be complete enough so that we can live without the tricks like inventing a reduced PyTypeObject as was done in the current implementation. Task-number: PYSIDE-560 Change-Id: I49849cc377baa6794a5b53292691e21d6e2853ab Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | shiboken: Improve const handlingFriedemann Kleint2018-07-111-1/+1
|/ | | | | | | | | | | | | | - Use new enum in code. - Rewrite the Clang type parsing to make use of it. - Adapt some typesystem files. This enables the distinction between "int *" and "int *const" and fixes the signatures from "int const &" to the more common "const int&". Task-number: PYSIDE-672 Change-Id: Ic1bff0015188c32f53d0e6f347b1523254cb7e4f Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* PEP 384-squash: Implement PEP 384Christian Tismer2018-05-301-2/+2
| | | | | | | | | | This is the condensed checkin of 18 commits which created the implementation of PEP 384. Task-number: PYSIDE-560 Change-Id: I834c659af4c2b55b268f8e8dc4cfa53f02502409 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Detect class enums by Clang entirelyFriedemann Kleint2018-04-191-1/+1
| | | | | | | | | | | | | | The Clang function clang_EnumDecl_isScoped() tells whether an enum is a class, so, there is no need to specify that in the typesystem. Use that information to pass it up to the metalang classes and revert the parts of 44cb6c51e6c3b43376f284941454dc8c13b81c3f that added it to the type system. Task-number: PYSIDE-487 Change-Id: Ie10885f74168821d0307e91b6f1f7f3f30dd074b Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Type system: Add attribute indicating C++ 11 enum classesFriedemann Kleint2018-02-281-0/+1
| | | | | | | | | | | | | Introduce enumeration for the type to EnumTypeEntry which can be specified by the boolean "class" attribute. For the enum classes, the value names need to be qualified by the enum name to match the C++ API. For the C++ generator, add an overload to Shiboken::createScopedEnumItem() that takes a PyTypeObject and add the enum items to the enum so that the name is in the enum scope. Change-Id: Ia0e469d13b08c196b9ddd965b9cf3cc62a38630b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Fix generated initialization code for enum classesFriedemann Kleint2018-02-261-0/+1
| | | | | | | | | | Wrap value in int(), which is required for enum classes. Add a compile test to libsample. Task-number: PYSIDE-487 Change-Id: I78f07ae66da64caad1f75722308256e40e91eded Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Do not generate wrappers for final classesFriedemann Kleint2017-12-041-0/+2
| | | | | | | Check the attributes and add test. Change-Id: I6c3d76ed32b5d20b6940849dd4895f98abd62fca Reviewed-by: Christian Tismer <tismer@stackless.com>
* Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2017-11-061-11/+1
|\ | | | | | | Change-Id: I72583df407fc5b3caa8bf35fd997889a4ac86512
| * Implement proper void pointer (void*) supportAlexandru Croitor2017-11-061-11/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change introduces a new type into the shiboken2 module which is imported by calling "import PySide2.support.VoidPtr". The type takes care of conversions from / to void* values in function signatures. Creating an instance can be done by passing either a shiboken wrapped object, or an integer representing an address, or a python object that implements the buffer interface. For example, this is useful for passing numpy arrays to C OpenGL functions that take void* parameters. First you convert the array into a bytestring (using numpy.array.tobytes(), then you instantiate a VoidPtr from that bytestring, and finally you pass it along to a GL function. One corner case that is currently not supported is void** parameters. Change-Id: I01e291d6856cb6bd8b5175adc3ead6b728036535 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2017-10-271-3/+3
|\| | | | | | | Change-Id: I94cb5a7dab97cff3591bac534228bfd3e3ad5938
| * Fix the signature of the Q*Application constructorChristian Tismer2017-09-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Q*Application had PySequence as Parameter, although only QStringList is accepted. That resulted in an implausible error message when a list of, say, Integers was given. This patch - replaces PySequence by QStringList (one more tuple layer), - fixes QCoreApplication to give the same kind of error messages, - renames the shiboken function sequenceToArgcArgv to listToArgcArgv and changes it to only allow list descendents. We also changed signature.typing in one line to display List[str] correctly. I think this belongs more to PySide-331, a fixed qApp. Task-number: PYSIDE-510 Task-number: PYSIDE-331 Change-Id: Ib256c6a2db05a3db826454e1bf1b4729d59a240b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| * move everying into sources/shiboken2Oswald Buddenhagen2017-05-221-0/+2426
| | | | | | 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.
* Add numpy supportFriedemann Kleint2017-08-031-0/+2
| | | | | | | | | Add simple array converters giving access to NumPy arrays. Task-number: PYSIDE-354 Task-number: PYSIDE-516 Change-Id: I2446b0f1ef98eaf12df95e4bd0e03d73e0cd7126 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add new <array> argument modification indicating array usageFriedemann Kleint2017-08-031-0/+6
| | | | | | | | | | | | The modification can be used to indicate that for example int* is meant to be used as int[]. This is reflected in the NativePointerAsArrayPattern usage pattern of AbstractMetaType. Task-number: PYSIDE-354 Task-number: PYSIDE-516 Change-Id: Icaeb3cce4be9ce06caa2cab628d4e8fc1b684819 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* libshiboken: Add Array convertersFriedemann Kleint2017-08-031-0/+2
| | | | | | | | | | | | | | | | Add a SbkArrayConverter struct which provides a list of check functions that return a converter function for an array of matching size. Add simple array converters for arrays of C++ primitive types. Instances of the ArrayHandle<>, Array2Handle<> templates will be generated which may point to internal data or allocated arrays. Task-number: PYSIDE-354 Task-number: PYSIDE-516 Change-Id: I157606891fad345ccd7af6d4a9d4dcb0c634b2f4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Shiboken: No longer change arrays[] to pointer typesFriedemann Kleint2017-08-031-2/+2
| | | | | | | | | | In AbstractMetaBuilder, no longer change array types like "int[]" to "int*". Task-number: PYSIDE-354 Task-number: PYSIDE-516 Change-Id: Ia9e15ae3fca895bf179275eb31a94323d91f4941 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* move everying into sources/shiboken2 (5.9 edition)Oswald Buddenhagen2017-05-221-0/+2426
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.