diff options
Diffstat (limited to 'PySide/typesystem_templates.xml')
-rw-r--r-- | PySide/typesystem_templates.xml | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/PySide/typesystem_templates.xml b/PySide/typesystem_templates.xml index afad4bcb5..bf7abd14e 100644 --- a/PySide/typesystem_templates.xml +++ b/PySide/typesystem_templates.xml @@ -381,5 +381,21 @@ %PYARG_0 = Py_BuildValue("%TT_FORMAT", %TT_ARGS); </template> -</typesystem> + <template name="cpplist_to_pylist_convertion"> + 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; + </template> + <template name="pyseq_to_cpplist_convertion"> + for (int i = 0; i < PySequence_Size(%in); i++) { + Shiboken::AutoDecRef pyItem(PySequence_GetItem(%in, i)); + %OUTTYPE_0 cppItem = %CONVERTTOCPP[%OUTTYPE_0](pyItem); + %out << cppItem; + } + </template> +</typesystem> |