aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/doc/typesystem_builtin_types.rst
blob: dea253930fb07e89d00920cf9754b41768e20101 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
.. _builtin-types:

Built-in Types
--------------

.. _primitive-cpp-types:

Primitive C++ Types
^^^^^^^^^^^^^^^^^^^

Shiboken knows the C++ primitive types like int and float and gathers
information about typedefs like `int32_t` and `size_t` at runtime while
parsing C++ headers. Function overloads using these types will be
automatically generated. To suppress a primitive type, use the
:ref:`rejection` tag.

In principle, there is no need to specify them in the typesystem
file using the :ref:`primitive-type` tag.

However, specifying a type means that the type name is used for
matching signatures of functions for :ref:`modification <modify-function>`.
So, it might make sense to specify architecture-dependent types like `size_t`
to avoid having to spell out the resolved type, which might differ depending
on platform.

`std::string`, `std::wstring` and their associated view types
`std::string_view`, `std::wstring_view` are also supported.


.. _builtin-cpp-container-types:

C++ Container Types
^^^^^^^^^^^^^^^^^^^

The C++ containers ``std::list``\, ``std::vector``\,
``std::pair``\, ``std::map``\, ``std::span`` and ``std::unordered_map`` are
built-in.
To specify :ref:`opaque-containers`, use the :ref:`opaque-container` element.
:ref:`container-type` can still be specified to modify the built-in behavior.
For this case, a number of pre-defined conversion templates
are provided (see :ref:`predefined_templates`).

.. _cpython-types:

CPython Types
^^^^^^^^^^^^^

Python types like `str` match types like `PyUnicode` in the *Concrete Objects
Layer* of CPython. They have check functions like `PyUnicode_Check()`, which
Shiboken generates into the code checking the function arguments.

These types occur as parameters when :ref:`adding functions <add-function>`
or :ref:`modifying types <replace-type>`, as type on `add-conversion`
within a :ref:`conversion-rule` or as target language API types on
:ref:`primitive-type`.

They are built into Shiboken as :ref:`custom types <custom-type>` along
with their check functions.