diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2010-11-10 11:42:46 -0200 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:08:57 -0300 |
commit | 4c0e03c6fefefd75c270b2b47eb0d240301ade0e (patch) | |
tree | 937d41e0ede39b1cfdaef4a1524c5ff7912b7716 /libshiboken/basewrapper.h | |
parent | 4de6fd579daeb965871713d1da0625bd684758c3 (diff) |
SbkBaseWrapperType and some other functions used by Python C-API moved outside C++ namespaces.
Diffstat (limited to 'libshiboken/basewrapper.h')
-rw-r--r-- | libshiboken/basewrapper.h | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/libshiboken/basewrapper.h b/libshiboken/basewrapper.h index d8511dd82..9702992ab 100644 --- a/libshiboken/basewrapper.h +++ b/libshiboken/basewrapper.h @@ -46,22 +46,21 @@ struct LIBSHIBOKEN_API SbkObject SbkBaseWrapperPrivate* d; }; -} -namespace Shiboken -{ +/// Dealloc the python object \p pyObj and the C++ object represented by it. +LIBSHIBOKEN_API void SbkDeallocWrapper(PyObject* pyObj); +LIBSHIBOKEN_API void SbkDeallocWrapperWithPrivateDtor(PyObject* self); + +struct SbkBaseWrapperType; -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. -* The implementation of this function is auto generated by the generator and you don't need to care about it. -*/ + * Special cast function is used to correctly cast an object when it's + * part of a multiple inheritance hierarchy. + * The implementation of this function is auto generated by the generator and you don't need to care about it. + */ typedef void* (*SpecialCastFunction)(void*, SbkBaseWrapperType*); typedef void* (*ObjectCopierFunction)(const void*); typedef SbkBaseWrapperType* (*TypeDiscoveryFunc)(void*, SbkBaseWrapperType*); @@ -104,6 +103,9 @@ struct LIBSHIBOKEN_API SbkBaseWrapperType } // extern "C" +namespace Shiboken +{ + /** * Init shiboken library. */ @@ -162,15 +164,8 @@ LIBSHIBOKEN_API bool canCallConstructor(PyTypeObject* myType, PyTypeObject* ctor */ #define Shiboken_TypeCheck(pyobj, type) (PyObject_TypeCheck(pyobj, SbkType<type>())) -#define SbkBaseWrapper_Check(op) PyObject_TypeCheck(op, (PyTypeObject*)&Shiboken::SbkBaseWrapper_Type) -#define SbkBaseWrapper_CheckExact(op) ((op)->ob_type == &Shiboken::SbkBaseWrapper_Type) - -LIBSHIBOKEN_API PyObject* -SbkBaseWrapper_New(SbkBaseWrapperType* instanceType, - void* cptr, - bool hasOwnership = true, - bool isExactType = false, - const char* typeName = 0); +#define SbkBaseWrapper_Check(op) PyObject_TypeCheck(op, (PyTypeObject*)&SbkBaseWrapper_Type) +#define SbkBaseWrapper_CheckExact(op) ((op)->ob_type == &SbkBaseWrapper_Type) LIBSHIBOKEN_API PyObject* SbkBaseWrapper_TpNew(PyTypeObject* subtype, PyObject*, PyObject*); @@ -189,9 +184,6 @@ SbkBaseWrapper_TpNew(PyTypeObject* subtype, PyObject*, PyObject*); */ LIBSHIBOKEN_API void keepReference(SbkObject* self, const char* key, PyObject* referredObject, bool append=false); -/// Dealloc the python object \p pyObj and the C++ object represented by it. -LIBSHIBOKEN_API void deallocWrapper(PyObject* pyObj); - /// Delete the class T allocated on \p cptr. template<typename T> void callCppDestructor(void* cptr) @@ -199,12 +191,17 @@ void callCppDestructor(void* cptr) delete reinterpret_cast<T*>(cptr); } -LIBSHIBOKEN_API void deallocWrapperWithPrivateDtor(PyObject* self); LIBSHIBOKEN_API bool importModule(const char* moduleName, PyTypeObject*** cppApiPtr); LIBSHIBOKEN_API void setErrorAboutWrongArguments(PyObject* args, const char* funcName, const char** cppOverloads); namespace Wrapper { +LIBSHIBOKEN_API PyObject* newObject(SbkBaseWrapperType* instanceType, + void* cptr, + bool hasOwnership = true, + bool isExactType = false, + const char* typeName = 0); + LIBSHIBOKEN_API void setValidCpp(SbkObject* pyObj, bool value); LIBSHIBOKEN_API void setHasCppWrapper(SbkObject* pyObj, bool value); LIBSHIBOKEN_API bool hasCppWrapper(SbkObject* pyObj); |