summaryrefslogtreecommitdiffstats
path: root/libshiboken
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2011-11-01 18:40:18 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2011-12-09 20:28:08 -0300
commit741142d29716de26b1630aca70d93227811ab579 (patch)
tree484c87185f967cd4b65139a046c898f5cd16d20c /libshiboken
parentfa1a61ace11dce4422554ba5ed4cb9d0e3c5d9fd (diff)
downloadshiboken-741142d29716de26b1630aca70d93227811ab579.tar.gz
shiboken-741142d29716de26b1630aca70d93227811ab579.tar.xz
shiboken-741142d29716de26b1630aca70d93227811ab579.zip
Added a "to Python" converter function that gets a SbkConverter object.
Diffstat (limited to 'libshiboken')
-rw-r--r--libshiboken/sbkconverter.cpp11
-rw-r--r--libshiboken/sbkconverter.h1
2 files changed, 9 insertions, 3 deletions
diff --git a/libshiboken/sbkconverter.cpp b/libshiboken/sbkconverter.cpp
index 202ba264..ef332831 100644
--- a/libshiboken/sbkconverter.cpp
+++ b/libshiboken/sbkconverter.cpp
@@ -165,11 +165,16 @@ PyObject* pointerToPython(SbkConverter* converter, const void* cppIn)
PyObject* referenceToPython(SbkObjectType* type, const void* cppIn)
{
+ return referenceToPython(type->d->converter, cppIn);
+}
+
+PyObject* referenceToPython(SbkConverter* converter, const void* cppIn)
+{
assert(cppIn);
// If it is a Object Type, produce a wrapper for it.
- if (!type->d->converter->copyToPython)
- return type->d->converter->pointerToPython(cppIn);
+ if (!converter->copyToPython)
+ return converter->pointerToPython(cppIn);
// If it is a Value Type, try to find an existing wrapper, otherwise copy it as value to Python.
PyObject* pyOut = (PyObject*)BindingManager::instance().retrieveWrapper(cppIn);
@@ -177,7 +182,7 @@ PyObject* referenceToPython(SbkObjectType* type, const void* cppIn)
Py_INCREF(pyOut);
return pyOut;
}
- return type->d->converter->copyToPython(cppIn);
+ return converter->copyToPython(cppIn);
}
static inline PyObject* CopyCppToPython(SbkConverter* converter, const void* cppIn)
diff --git a/libshiboken/sbkconverter.h b/libshiboken/sbkconverter.h
index c400693b..a5b8d113 100644
--- a/libshiboken/sbkconverter.h
+++ b/libshiboken/sbkconverter.h
@@ -154,6 +154,7 @@ LIBSHIBOKEN_API PyObject* pointerToPython(SbkConverter* converter, const void* c
* PyObject* pyVar = referenceToPython(SBKTYPE, &var);
*/
LIBSHIBOKEN_API PyObject* referenceToPython(SbkObjectType* type, const void* cppIn);
+LIBSHIBOKEN_API PyObject* referenceToPython(SbkConverter* converter, const void* cppIn);
/**
* Retrieves the Python wrapper object for the given C++ value pointed by \p cppIn.