aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2022-03-17 17:13:20 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2022-03-17 19:27:13 +0100
commite188311347c071629d78627ad16f47a8096a1cce (patch)
tree83577722649a8c05167277e204263eaefb992f3f
parent64f4fcdfcfd9a6869e8f0ad42c02051b663e61ad (diff)
shiboken6/Documentation: Add an example for a type entry for std::shared_ptr
Pick-to: 6.2 Task-number: PYSIDE-454 Change-Id: I1bbbce48a95609abcc3046bae75f5bfa82dd1f0f Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r--sources/shiboken6/doc/typesystem_specifying_types.rst26
1 files changed, 26 insertions, 0 deletions
diff --git a/sources/shiboken6/doc/typesystem_specifying_types.rst b/sources/shiboken6/doc/typesystem_specifying_types.rst
index c1d25cc15..329300680 100644
--- a/sources/shiboken6/doc/typesystem_specifying_types.rst
+++ b/sources/shiboken6/doc/typesystem_specifying_types.rst
@@ -588,6 +588,32 @@ smart-pointer-type
The *optional* attribute **reset-method** specifies a method
that can be used to clear the pointer.
+ The example below shows an entry for a ``std::shared_ptr`` found in
+ the standard library of ``g++`` version 9:
+
+ .. code-block:: xml
+
+ <system-include file-name="memory"/>
+ <system-include file-name="shared_ptr.h"/>
+
+ <namespace-type name="std">
+ <include file-name="memory" location="global"/>
+ <custom-type name="__shared_ptr"/>
+ <smart-pointer-type name="shared_ptr" type="shared" getter="get"
+ ref-count-method="use_count"
+ instantiations="Integer">
+ <include file-name="memory" location="global"/>
+ </smart-pointer-type>
+ </namespace-type>
+
+ First, shiboken is told to actually parse the system include files
+ containing the class definition using the :ref:`system_include`
+ element. For the ``namespace-type`` and ``smart-pointer-type``, the
+ standard include files are given to override the internal implementation
+ header ``shared_ptr.h``.
+ This creates some wrapper sources which need to be added to the
+ ``CMakeLists.txt`` of the module.
+
.. _function:
function