aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/doc/typesystem_codegeneration.rst
blob: fb41e28e1dfae25f316327ba7402cfe591a06026 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
.. _codegenerationterminology:

***************************
Code Generation Terminology
***************************

Types of generated code
=======================


**Python Wrapper**
  The code that exports the C++ wrapped class to Python. **Python wrapper**
  refers to all the code needed to export a C++ class to Python, and
  **Python method/function wrapper** means the specific function that calls
  the C++ method/function on behalf of Python. This code is invoked from
  the Python side.

**C++ Wrapper**
  This term refers to a generated C++ class that extends a class from the
  wrapped library. It is generated only when a wrapped C++ class is
  polymorphic, i.e. it has or inherits any virtual methods.
  The **C++ Wrapper** overrides the virtual methods of the wrapped C++ class
  with code that allows for overriding the method with a Python implementation.
  It checks whether a corresponding method in the Python instance exists and
  calls it. This code is invoked from the C++ side.


Specifying a target for modifications
=====================================

In the typesystem files, the ``class`` attribute is used to which class a
modification is applied (see :ref:`codeinjectionsemantics`,
:ref:`objectownership`).
The value **Target** means the modification is applied to the
**Python Wrapper**. The value **Native** means the modification is applied to
the **C++ Wrapper**.