diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-03-01 17:28:27 -0300 |
---|---|---|
committer | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-03-02 14:44:59 -0300 |
commit | 42154013b5ecd075288c7ccc9fe341875ad3431b (patch) | |
tree | c015b51327a7c5776872daac5e618f52e3e83a84 /libshiboken | |
parent | a6c665dd07b5841e033f1558b2fcf391d5fba403 (diff) |
Wrapper meta type can now point to converter extensions.
The SbkBaseWrapperType structure now stores pointers to functions
that extend the type Converter methods 'isConvertible' and 'toCpp'.
This is used when a module is extended by another module that defines
a conversion operator for a class in the first module.
Diffstat (limited to 'libshiboken')
-rw-r--r-- | libshiboken/basewrapper.cpp | 6 | ||||
-rw-r--r-- | libshiboken/basewrapper.h | 7 |
2 files changed, 12 insertions, 1 deletions
diff --git a/libshiboken/basewrapper.cpp b/libshiboken/basewrapper.cpp index fe9b73b1d..358d6b249 100644 --- a/libshiboken/basewrapper.cpp +++ b/libshiboken/basewrapper.cpp @@ -231,6 +231,8 @@ SbkBaseWrapperType_TpNew(PyTypeObject* metatype, PyObject* args, PyObject* kwds) newType->mi_init = parentType->mi_init; newType->mi_specialcast = parentType->mi_specialcast; newType->type_name_func = parentType->type_name_func; + newType->ext_isconvertible = parentType->ext_isconvertible; + newType->ext_tocpp = parentType->ext_tocpp; return reinterpret_cast<PyObject*>(newType); } @@ -357,7 +359,9 @@ SbkBaseWrapperType SbkBaseWrapper_Type = { { { /*mi_offsets*/ 0, /*mi_init*/ 0, /*mi_specialcast*/ 0, - /*type_name_func*/ 0 + /*type_name_func*/ 0, + /*ext_isconvertible*/ 0, + /*ext_tocpp*/ 0 }; void initShiboken() diff --git a/libshiboken/basewrapper.h b/libshiboken/basewrapper.h index ca876fccc..6383a7686 100644 --- a/libshiboken/basewrapper.h +++ b/libshiboken/basewrapper.h @@ -79,6 +79,9 @@ typedef void* (*SpecialCastFunction)(PyObject*, SbkBaseWrapperType*); typedef const char* (*TypeNameFunction)(const void*); typedef void* (*ObjectCopierFunction)(const void*); +typedef void* (*ExtendedToCppFunc)(PyObject*); +typedef bool (*ExtendedIsConvertibleFunc)(PyObject*); + LIBSHIBOKEN_API PyAPI_DATA(PyTypeObject) SbkBaseWrapperType_Type; LIBSHIBOKEN_API PyAPI_DATA(SbkBaseWrapperType) SbkBaseWrapper_Type; @@ -92,6 +95,10 @@ struct LIBSHIBOKEN_API SbkBaseWrapperType SpecialCastFunction mi_specialcast; TypeNameFunction type_name_func; ObjectCopierFunction obj_copier; + /// Extended "isConvertible" function to be used when a conversion operator is defined in another module. + ExtendedIsConvertibleFunc ext_isconvertible; + /// Extended "toCpp" function to be used when a conversion operator is defined in another module. + ExtendedToCppFunc ext_tocpp; }; /// Base Python object for all the wrapped C++ classes. |