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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
<?xml version="1.0" encoding="UTF-8"?>
<typesystem package="smart">
<rejection class="*" argument-type="^std::nullptr_t&?$"/>
<template name="cpplist_to_pylist_convertion">
PyObject *%out = PyList_New(int(%in.size()));
int idx = 0;
for (const auto &cppItem : %in)
PyList_SET_ITEM(%out, idx++, %CONVERTTOPYTHON[%INTYPE_0](cppItem));
return %out;
</template>
<template name="pyseq_to_cpplist_convertion">
Shiboken::AutoDecRef seq(PySequence_Fast(%in, 0));
for (int i = 0, size = PySequence_Fast_GET_SIZE(seq.object()); i < size; ++i) {
PyObject* pyItem = PySequence_Fast_GET_ITEM(seq.object(), i);
%OUTTYPE_0 cppItem = %CONVERTTOCPP[%OUTTYPE_0](pyItem);
%out.push_back(cppItem);
}
</template>
<!-- Used in tests to check what C++ objects are allocated. -->
<object-type name="Registry" />
<!-- Current limitation: shared pointer python objects can only be instantiated from API usage,
like when they are returned as a result of a method, or passed as arguments. It is not
possible to explicitly instantiate a new shared pointer in python e.g. o = SharedPtr_Foo()
won't work.
-->
<smart-pointer-type name="SharedPtr" type="shared" getter="data" ref-count-method="useCount"
null-check-method="isNull"
instantiations="Integer,Smart::Integer2=Test::SmartInteger2Ptr,Obj"/>
<object-type name="Obj" />
<value-type name="Integer" />
<namespace-type name="Smart" generate="no">
<value-type name="Integer2" />
</namespace-type>
<!-- Just used to silence the warnings that shiboken doens't know what to do with this type -->
<custom-type name="RefData" />
<value-type name="StdOptionalTestBench"/>
<system-include file-name="memory"/>
<namespace-type name="std">
<include file-name="memory" location="global"/>
<modify-function signature="^.*$" remove="all"/>
<enum-type name="pointer_safety"/>
<smart-pointer-type name="shared_ptr" type="shared" getter="get"
value-check-method="operator bool"
ref-count-method="use_count"
reset-method="reset"
instantiations="Integer,int">
<include file-name="memory" location="global"/>
</smart-pointer-type>
<smart-pointer-type name="unique_ptr" type="unique" getter="get"
value-check-method="operator bool"
reset-method="reset"
instantiations="Integer,Smart::Integer2,int">
<include file-name="memory" location="global"/>
</smart-pointer-type>
<smart-pointer-type name="optional" type="value-handle" getter="value"
value-check-method="has_value"
instantiations="Integer,int">
<include file-name="optional" location="global"/>
</smart-pointer-type>
</namespace-type>
<object-type name="StdSharedPtrTestBench"/>
<object-type name="StdSharedPtrVirtualMethodTester"/>
<object-type name="StdUniquePtrTestBench"/>
<object-type name="StdUniquePtrVirtualMethodTester"/>
<namespace-type name="Test">
<enum-type name="DummyEnum"/>
</namespace-type>
</typesystem>
|