diff options
author | John Cummings <jcummings2@users.sf.net> | 2012-06-14 15:30:27 -0500 |
---|---|---|
committer | Hugo Parente Lima <hugo.lima@openbossa.org> | 2012-06-14 22:43:12 +0200 |
commit | f92ea511050786900ee9b648fdd7cefae13e3973 (patch) | |
tree | a6789c4e17c19591e8fd4c7948b81acb0cb3a9ac /tests/minimalbinding | |
parent | 22b6e8243784aa57c820d01b73ed16e604d7bca8 (diff) |
Update vector conversion
Incorporate Hugo's comments from change Id2ea1a5f
Change-Id: I5f0c93b7036f5d2908cd2ee2038eb570f9889b58
Reviewed-by: Hugo Parente Lima <hugo.lima@openbossa.org>
Diffstat (limited to 'tests/minimalbinding')
-rw-r--r-- | tests/minimalbinding/typesystem_minimal.xml | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/minimalbinding/typesystem_minimal.xml b/tests/minimalbinding/typesystem_minimal.xml index 86af78d11..968b27c53 100644 --- a/tests/minimalbinding/typesystem_minimal.xml +++ b/tests/minimalbinding/typesystem_minimal.xml @@ -53,10 +53,10 @@ <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); + %INTYPE::size_type vectorSize = %in.size(); + PyObject* %out = PyList_New((int) vectorSize); + for (%INTYPE::size_type idx = 0; idx < vectorSize; ++idx) { + %INTYPE_0 cppItem(%in[idx]); PyList_SET_ITEM(%out, idx, %CONVERTTOPYTHON[%INTYPE_0](cppItem)); } return %out; @@ -64,10 +64,10 @@ <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 < the_size; i++) { - PyObject* pyItem = PySequence_Fast_GET_ITEM(seq.object(), i); + int vectorSize = PySequence_Fast_GET_SIZE(seq.object()); + %out.reserve(vectorSize); + for (int idx = 0; idx < vectorSize; ++idx ) { + PyObject* pyItem = PySequence_Fast_GET_ITEM(seq.object(), idx); %OUTTYPE_0 cppItem = %CONVERTTOCPP[%OUTTYPE_0](pyItem); %out.push_back(cppItem); } |