diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2010-08-30 11:19:22 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2010-08-30 17:44:16 -0300 |
commit | 1eda671a34eba38e7e74e592e4ae88fa6803bcba (patch) | |
tree | a7abd551d478f100579067b948e1a17103aedcfb /libshiboken/conversions.h | |
parent | 3dc673c7bcbad1613b9d3d6ff3dd4a73be41915d (diff) |
Fix the type resolver algorithm.
The new algorithm do the following:
- Try to use type_info on the object the get the object real name.
- Try to find a type resolver with the name returned by type_info.
- If a type resolver was found, get the python type.
- Else, ask binding manager to resolve the type walking on all possible
subclasses found in the inheritance tree.
The binding manager has a graph representing the class inheritance tree.
Note: This commit break the libshiboken ABI, but not the API.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
Renato Araújo <renato.araujo@openbossa.org>
Diffstat (limited to 'libshiboken/conversions.h')
-rw-r--r-- | libshiboken/conversions.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libshiboken/conversions.h b/libshiboken/conversions.h index 6247c55d8..8caa56c84 100644 --- a/libshiboken/conversions.h +++ b/libshiboken/conversions.h @@ -38,6 +38,7 @@ #include <Python.h> #include <limits> #include <memory> +#include <typeinfo> #include "pyenum.h" #include "basewrapper.h" @@ -119,8 +120,11 @@ struct CppObjectCopier<T, true> template<typename T> inline PyObject* createWrapper(const T* cppobj, bool hasOwnership = false, bool isExactType = false) { + const char* typeName = 0; + if (!isExactType) + typeName = typeid(*const_cast<T*>(cppobj)).name(); return SbkBaseWrapper_New(reinterpret_cast<SbkBaseWrapperType*>(SbkType<T>()), - const_cast<T*>(cppobj), hasOwnership, isExactType); + const_cast<T*>(cppobj), hasOwnership, isExactType, typeName); } // Base Conversions ---------------------------------------------------------- |