aboutsummaryrefslogtreecommitdiffstats
path: root/tests/minimalbinding/typesystem_minimal.xml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/minimalbinding/typesystem_minimal.xml')
-rw-r--r--tests/minimalbinding/typesystem_minimal.xml42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/minimalbinding/typesystem_minimal.xml b/tests/minimalbinding/typesystem_minimal.xml
index be52d191c..86af78d11 100644
--- a/tests/minimalbinding/typesystem_minimal.xml
+++ b/tests/minimalbinding/typesystem_minimal.xml
@@ -48,4 +48,46 @@
</value-type>
<value-type name="ListUser"/>
<value-type name="MinBoolUser"/>
+
+ <container-type name="std::vector" type="vector">
+ <include file-name="vector" location="global"/>
+ <conversion-rule>
+ <native-to-target>
+ PyObject* %out = PyList_New((int) %in.size());
+ %INTYPE::const_iterator it = %in.begin();
+ for (int idx = 0; it != %in.end(); ++it, ++idx) {
+ %INTYPE_0 cppItem(*it);
+ PyList_SET_ITEM(%out, idx, %CONVERTTOPYTHON[%INTYPE_0](cppItem));
+ }
+ return %out;
+ </native-to-target>
+ <target-to-native>
+ <add-conversion type="PySequence">
+ Shiboken::AutoDecRef seq(PySequence_Fast(%in, 0));
+ int the_size = PySequence_Fast_GET_SIZE(seq.object());
+ %out.reserve(the_size);
+ for (int i = 0; i &lt; the_size; i++) {
+ PyObject* pyItem = PySequence_Fast_GET_ITEM(seq.object(), i);
+ %OUTTYPE_0 cppItem = %CONVERTTOCPP[%OUTTYPE_0](pyItem);
+ %out.push_back(cppItem);
+ }
+ </add-conversion>
+ </target-to-native>
+ </conversion-rule>
+ </container-type>
+ <!-- Test wrapping of a typedef -->
+ <function signature="arrayFuncInt(std::vector&lt;int&gt;)" />
+ <!-- Note manual expansion of the typedef -->
+ <function signature="arrayFuncIntTypedef(std::vector&lt;int&gt;)" />
+
+ <function signature="arrayFuncIntReturn(int)" />
+ <function signature="arrayFuncIntReturnTypedef(int)" />
+
+ <!-- Test wrapping of a typedef of a typedef -->
+ <function signature="arrayFunc(std::vector&lt;int&gt;)" />
+ <!-- Note manual expansion of the typedef -->
+ <function signature="arrayFuncTypedef(std::vector&lt;int&gt;)" />
+
+ <function signature="arrayFuncReturn(int)" />
+ <function signature="arrayFuncReturnTypedef(int)" />
</typesystem>