diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-11-30 18:39:25 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-12-07 12:31:15 +0000 |
commit | ed87e710dd14bc9612dcfdba2e09143201768556 (patch) | |
tree | 0c7dd4b49e4a891c57d514fca39642abfaad91f6 /sources/shiboken6/doc/typesystem_specifying_types.rst | |
parent | eb16797b9a54970dbc0c461ebeddda57b060af22 (diff) |
shiboken6: Add support for a snake case typesystem attribute
Add a snake case attribute to type system, complex type entry,
function type entry as well as to function and field modifications.
Add a function definitionNames() to AbstractMetaFunction/Field
returning the names under which the function/field will be registered.
Change the code writing the registration accordingly.
Fixes: PYSIDE-1441
Change-Id: I178390bb80fa25aad9f8a56e99e4cc70064178eb
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken6/doc/typesystem_specifying_types.rst')
-rw-r--r-- | sources/shiboken6/doc/typesystem_specifying_types.rst | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/sources/shiboken6/doc/typesystem_specifying_types.rst b/sources/shiboken6/doc/typesystem_specifying_types.rst index 405469ea2..243af9603 100644 --- a/sources/shiboken6/doc/typesystem_specifying_types.rst +++ b/sources/shiboken6/doc/typesystem_specifying_types.rst @@ -35,7 +35,8 @@ typesystem .. code-block:: xml - <typesystem package="..." default-superclass="..." allow-thread="..." exception-handling="..."> + <typesystem package="..." default-superclass="..." allow-thread="..." + exception-handling="..." snake-case="yes | no | both" > </typesystem> The **package** attribute is a string describing the package to be used, @@ -47,6 +48,22 @@ typesystem specify the default handling for the corresponding function modification (see :ref:`modify-function`). + The *optional* **snake-case** attribute specifies whether function + and field names will be automatically changed to the snake case + style that is common in Python (for example, ``snakeCase`` will be + changed to ``snake_case``). + + The value ``both`` means that the function or field will be exposed + under both its original name and the snake case version. There are + limitations to this though: + + - When overriding a virtual function of a C++ class in Python, + the snake case name must be used. + + - When static and non-static overloads of a class member function + exist (as is the case for example for ``QFileInfo::exists()``), + the snake case name must be used. + load-typesystem ^^^^^^^^^^^^^^^ @@ -280,7 +297,8 @@ value-type hash-function="..." stream="yes | no" default-constructor="..." - revision="..." /> + revision="..." + snake-case="yes | no | both" /> </typesystem> The **name** attribute is the fully qualified C++ class name, such as @@ -310,6 +328,9 @@ value-type specify the default handling for the corresponding function modification (see :ref:`modify-function`). + The *optional* **snake-case** attribute allows for overriding the value + specified on the **typesystem** element. + .. _object-type: object-type @@ -330,7 +351,8 @@ object-type exception-handling="..." hash-function="..." stream="yes | no" - revision="..." /> + revision="..." + snake-case="yes | no | both" /> </typesystem> The **name** attribute is the fully qualified C++ class name. If there is no @@ -360,6 +382,9 @@ object-type specify the default handling for the corresponding function modification (see :ref:`modify-function`). + The *optional* **snake-case** attribute allows for overriding the value + specified on the **typesystem** element. + interface-type ^^^^^^^^^^^^^^ @@ -480,7 +505,7 @@ function .. code-block:: xml <typesystem> - <function signature="..." rename="..." since="..."/> + <function signature="..." rename="..." since="..." snake-case="yes | no | both" /> </typesystem> This tag has some limitations, it doesn't support function modifications, besides you @@ -490,6 +515,9 @@ function The function tag has two *optional* attributes: **since**, whose value is used to specify the API version of this function, and **rename**, to modify the function name. + The *optional* **snake-case** attribute allows for overriding the value + specified on the **typesystem** element. + .. _system_include: system-include |