aboutsummaryrefslogtreecommitdiffstats
path: root/libshiboken/basewrapper.h
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-08-30 11:19:22 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2010-08-30 17:44:16 -0300
commit1eda671a34eba38e7e74e592e4ae88fa6803bcba (patch)
treea7abd551d478f100579067b948e1a17103aedcfb /libshiboken/basewrapper.h
parent3dc673c7bcbad1613b9d3d6ff3dd4a73be41915d (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/basewrapper.h')
-rw-r--r--libshiboken/basewrapper.h15
1 files changed, 4 insertions, 11 deletions
diff --git a/libshiboken/basewrapper.h b/libshiboken/basewrapper.h
index 703c46532..e65a5b3fa 100644
--- a/libshiboken/basewrapper.h
+++ b/libshiboken/basewrapper.h
@@ -56,6 +56,7 @@ extern "C"
/// Function signature for the multiple inheritance information initializers that should be provided by classes with multiple inheritance.
typedef int* (*MultipleInheritanceInitFunction)(const void*);
struct SbkBaseWrapperType;
+
/**
* Special cast function is used to correctly cast an object when it's
* part of a multiple inheritance hierarchy.
@@ -64,7 +65,6 @@ struct SbkBaseWrapperType;
typedef void* (*SpecialCastFunction)(void*, SbkBaseWrapperType*);
typedef void* (*ObjectCopierFunction)(const void*);
typedef SbkBaseWrapperType* (*TypeDiscoveryFunc)(void*, SbkBaseWrapperType*);
-typedef std::list<TypeDiscoveryFunc> TypeDiscoveryFuncList;
typedef void* (*ExtendedToCppFunc)(PyObject*);
typedef bool (*ExtendedIsConvertibleFunc)(PyObject*);
@@ -75,14 +75,6 @@ typedef void (*DeleteUserDataFunc)(void*);
extern LIBSHIBOKEN_API PyTypeObject SbkBaseWrapperType_Type;
extern LIBSHIBOKEN_API SbkBaseWrapperType SbkBaseWrapper_Type;
-class LIBSHIBOKEN_API TypeDiscovery {
-public:
- SbkBaseWrapperType* getType(const void* cptr, SbkBaseWrapperType* instanceType) const;
- void addTypeDiscoveryFunction(TypeDiscoveryFunc func);
-private:
- TypeDiscoveryFuncList m_discoveryFunctions;
-};
-
/// PyTypeObject extended with C++ multiple inheritance information.
struct LIBSHIBOKEN_API SbkBaseWrapperType
{
@@ -91,7 +83,7 @@ struct LIBSHIBOKEN_API SbkBaseWrapperType
MultipleInheritanceInitFunction mi_init;
/// Special cast function, null if this class doesn't have multiple inheritance.
SpecialCastFunction mi_specialcast;
- TypeDiscovery* type_discovery;
+ TypeDiscoveryFunc type_discovery;
ObjectCopierFunction obj_copier;
/// Extended "isConvertible" function to be used when a conversion operator is defined in another module.
ExtendedIsConvertibleFunc ext_isconvertible;
@@ -221,7 +213,8 @@ LIBSHIBOKEN_API PyObject*
SbkBaseWrapper_New(SbkBaseWrapperType* instanceType,
void* cptr,
bool hasOwnership = true,
- bool isExactType = false);
+ bool isExactType = false,
+ const char* typeName = 0);
LIBSHIBOKEN_API PyObject*
SbkBaseWrapper_TpNew(PyTypeObject* subtype, PyObject*, PyObject*);