From 8c7e60cc6bb07bd58a555d782bcac984f42866bf Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 10 Nov 2010 14:19:44 -0200 Subject: SbkBaseWrapperType renamed to SbkObjectType. --- libshiboken/basewrapper.cpp | 38 +++++++++++++++++++------------------- libshiboken/basewrapper.h | 14 +++++++------- libshiboken/basewrapper_p.h | 18 +++++++++--------- libshiboken/bindingmanager.cpp | 22 +++++++++++----------- libshiboken/bindingmanager.h | 6 +++--- libshiboken/conversions.h | 12 ++++++------ libshiboken/typeresolver.h | 2 +- 7 files changed, 56 insertions(+), 56 deletions(-) (limited to 'libshiboken') diff --git a/libshiboken/basewrapper.cpp b/libshiboken/basewrapper.cpp index 3337a4d25..26652548b 100644 --- a/libshiboken/basewrapper.cpp +++ b/libshiboken/basewrapper.cpp @@ -39,8 +39,8 @@ static PyObject* SbkBaseWrapperType_TpNew(PyTypeObject* metatype, PyObject* args PyTypeObject SbkBaseWrapperType_Type = { PyObject_HEAD_INIT(0) /*ob_size*/ 0, - /*tp_name*/ "Shiboken.BaseWrapperType", - /*tp_basicsize*/ sizeof(SbkBaseWrapperType), + /*tp_name*/ "Shiboken.ObjectType", + /*tp_basicsize*/ sizeof(SbkObjectType), /*tp_itemsize*/ 0, /*tp_dealloc*/ SbkBaseWrapperType_dealloc, /*tp_print*/ 0, @@ -100,10 +100,10 @@ static PyGetSetDef SbkBaseWrapper_getsetlist[] = { {0} // Sentinel }; -SbkBaseWrapperType SbkBaseWrapper_Type = { { { +SbkObjectType SbkBaseWrapper_Type = { { { PyObject_HEAD_INIT(&SbkBaseWrapperType_Type) /*ob_size*/ 0, - /*tp_name*/ "Shiboken.BaseWrapper", + /*tp_name*/ "Shiboken.Object", /*tp_basicsize*/ sizeof(SbkObject), /*tp_itemsize*/ 0, /*tp_dealloc*/ SbkDeallocWrapperWithPrivateDtor, @@ -165,7 +165,7 @@ void SbkDeallocWrapper(PyObject* pyObj) Shiboken::BindingManager::instance().releaseWrapper(sbkObj); if (sbkObj->d->hasOwnership) { - SbkBaseWrapperType* sbkType = reinterpret_cast(pyObj->ob_type); + SbkObjectType* sbkType = reinterpret_cast(pyObj->ob_type); if (sbkType->is_multicpp) { Shiboken::DtorCallerVisitor visitor(sbkObj); Shiboken::walkThroughClassHierarchy(pyObj->ob_type, &visitor); @@ -198,7 +198,7 @@ void SbkDeallocWrapperWithPrivateDtor(PyObject* self) void SbkBaseWrapperType_dealloc(PyObject* pyObj) { - SbkBaseWrapperType *sbkType = reinterpret_cast(pyObj->ob_type); + SbkObjectType *sbkType = reinterpret_cast(pyObj->ob_type); if(sbkType->user_data && sbkType->d_func) { sbkType->d_func(sbkType->user_data); @@ -209,14 +209,14 @@ void SbkBaseWrapperType_dealloc(PyObject* pyObj) PyObject* SbkBaseWrapperType_TpNew(PyTypeObject* metatype, PyObject* args, PyObject* kwds) { // The meta type creates a new type when the Python programmer extends a wrapped C++ class. - SbkBaseWrapperType* newType = reinterpret_cast(PyType_Type.tp_new(metatype, args, kwds)); + SbkObjectType* newType = reinterpret_cast(PyType_Type.tp_new(metatype, args, kwds)); if (!newType) return 0; - std::list bases = Shiboken::getCppBaseClasses(reinterpret_cast(newType)); + std::list bases = Shiboken::getCppBaseClasses(reinterpret_cast(newType)); if (bases.size() == 1) { - SbkBaseWrapperType* parentType = bases.front(); + SbkObjectType* parentType = bases.front(); newType->mi_offsets = parentType->mi_offsets; newType->mi_init = parentType->mi_init; newType->mi_specialcast = parentType->mi_specialcast; @@ -252,7 +252,7 @@ PyObject* SbkObjectTpNew(PyTypeObject* subtype, PyObject*, PyObject*) SbkObject* self = reinterpret_cast(subtype->tp_alloc(subtype, 0)); self->d = new SbkBaseWrapperPrivate; - SbkBaseWrapperType* sbkType = reinterpret_cast(subtype); + SbkObjectType* sbkType = reinterpret_cast(subtype); int numBases = sbkType->is_multicpp ? Shiboken::getNumberOfCppBaseClasses(subtype) : 1; self->d->cptr = new void*[numBases]; std::memset(self->d->cptr, 0, sizeof(void*)*numBases); @@ -390,7 +390,7 @@ void walkThroughClassHierarchy(PyTypeObject* currentType, HierarchyVisitor* visi if (type->ob_type != &SbkBaseWrapperType_Type) { continue; } else { - SbkBaseWrapperType* sbkType = reinterpret_cast(type); + SbkObjectType* sbkType = reinterpret_cast(type); if (sbkType->is_user_type) walkThroughClassHierarchy(type, visitor); else @@ -403,7 +403,7 @@ void walkThroughClassHierarchy(PyTypeObject* currentType, HierarchyVisitor* visi void setTypeUserData(SbkObject* wrapper, void *user_data, DeleteUserDataFunc d_func) { - SbkBaseWrapperType* ob_type = reinterpret_cast(wrapper->ob_type); + SbkObjectType* ob_type = reinterpret_cast(wrapper->ob_type); if (ob_type->user_data) ob_type->d_func(ob_type->user_data); @@ -413,7 +413,7 @@ void setTypeUserData(SbkObject* wrapper, void *user_data, DeleteUserDataFunc d_f void* getTypeUserData(SbkObject* wrapper) { - return reinterpret_cast(wrapper->ob_type)->user_data; + return reinterpret_cast(wrapper->ob_type)->user_data; } void keepReference(SbkObject* self, const char* key, PyObject* referredObject, bool append) @@ -474,7 +474,7 @@ bool importModule(const char* moduleName, PyTypeObject*** cppApiPtr) // Wrapper metatype and base type ---------------------------------------------------------- -void DtorCallerVisitor::visit(SbkBaseWrapperType* node) +void DtorCallerVisitor::visit(SbkObjectType* node) { node->cpp_dtor(m_pyObj->d->cptr[m_count]); m_count++; @@ -548,7 +548,7 @@ class FindBaseTypeVisitor : public HierarchyVisitor { public: FindBaseTypeVisitor(PyTypeObject* typeToFind) : m_found(false), m_typeToFind(typeToFind) {} - virtual void visit(SbkBaseWrapperType* node) + virtual void visit(SbkObjectType* node) { if (reinterpret_cast(node) == m_typeToFind) { m_found = true; @@ -666,7 +666,7 @@ void* cppPointer(PyObject* pyObj, PyTypeObject* desiredType) assert(isShibokenType(pyObj)); PyTypeObject* type = pyObj->ob_type; int idx = 0; - if (reinterpret_cast(type)->is_multicpp) + if (reinterpret_cast(type)->is_multicpp) idx = getTypeIndexOnHierarchy(type, desiredType); return reinterpret_cast(pyObj)->d->cptr[idx]; } @@ -674,7 +674,7 @@ void* cppPointer(PyObject* pyObj, PyTypeObject* desiredType) bool setCppPointer(SbkObject* sbkObj, PyTypeObject* desiredType, void* cptr) { int idx = 0; - if (reinterpret_cast(sbkObj->ob_type)->is_multicpp) + if (reinterpret_cast(sbkObj->ob_type)->is_multicpp) idx = getTypeIndexOnHierarchy(sbkObj->ob_type, desiredType); bool alreadyInitialized = sbkObj->d->cptr[idx]; @@ -697,7 +697,7 @@ bool isValid(PyObject* pyObj) return false; } -PyObject* newObject(SbkBaseWrapperType* instanceType, +PyObject* newObject(SbkObjectType* instanceType, void* cptr, bool hasOwnership, bool isExactType, @@ -709,7 +709,7 @@ PyObject* newObject(SbkBaseWrapperType* instanceType, if (typeName) { tr = TypeResolver::get(typeName); if (tr) - instanceType = reinterpret_cast(tr->pythonType()); + instanceType = reinterpret_cast(tr->pythonType()); } if (!tr) instanceType = BindingManager::instance().resolveType(cptr, instanceType); diff --git a/libshiboken/basewrapper.h b/libshiboken/basewrapper.h index df5f8e352..fbb558f7e 100644 --- a/libshiboken/basewrapper.h +++ b/libshiboken/basewrapper.h @@ -51,7 +51,7 @@ struct LIBSHIBOKEN_API SbkObject LIBSHIBOKEN_API void SbkDeallocWrapper(PyObject* pyObj); LIBSHIBOKEN_API void SbkDeallocWrapperWithPrivateDtor(PyObject* self); -struct SbkBaseWrapperType; +struct SbkObjectType; /// Function signature for the multiple inheritance information initializers that should be provided by classes with multiple inheritance. typedef int* (*MultipleInheritanceInitFunction)(const void*); @@ -61,9 +61,9 @@ typedef int* (*MultipleInheritanceInitFunction)(const void*); * 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* (*SpecialCastFunction)(void*, SbkObjectType*); typedef void* (*ObjectCopierFunction)(const void*); -typedef SbkBaseWrapperType* (*TypeDiscoveryFunc)(void*, SbkBaseWrapperType*); +typedef SbkObjectType* (*TypeDiscoveryFunc)(void*, SbkObjectType*); typedef void* (*ExtendedToCppFunc)(PyObject*); typedef bool (*ExtendedIsConvertibleFunc)(PyObject*); @@ -72,10 +72,10 @@ typedef bool (*ExtendedIsConvertibleFunc)(PyObject*); typedef void (*DeleteUserDataFunc)(void*); extern LIBSHIBOKEN_API PyTypeObject SbkBaseWrapperType_Type; -extern LIBSHIBOKEN_API SbkBaseWrapperType SbkBaseWrapper_Type; +extern LIBSHIBOKEN_API SbkObjectType SbkBaseWrapper_Type; /// PyTypeObject extended with C++ multiple inheritance information. -struct LIBSHIBOKEN_API SbkBaseWrapperType +struct LIBSHIBOKEN_API SbkObjectType { PyHeapTypeObject super; int* mi_offsets; @@ -146,7 +146,7 @@ inline bool isShibokenType(PyObject*& pyObj) */ inline bool isUserType(PyObject*& pyObj) { - return isShibokenType(pyObj) && reinterpret_cast(pyObj->ob_type)->is_user_type; + return isShibokenType(pyObj) && reinterpret_cast(pyObj->ob_type)->is_user_type; } /** @@ -195,7 +195,7 @@ LIBSHIBOKEN_API void setErrorAboutWrongArguments(PyObject* args, const char* fun namespace Wrapper { -LIBSHIBOKEN_API PyObject* newObject(SbkBaseWrapperType* instanceType, +LIBSHIBOKEN_API PyObject* newObject(SbkObjectType* instanceType, void* cptr, bool hasOwnership = true, bool isExactType = false, diff --git a/libshiboken/basewrapper_p.h b/libshiboken/basewrapper_p.h index 6b8b9ab34..3e0757f20 100644 --- a/libshiboken/basewrapper_p.h +++ b/libshiboken/basewrapper_p.h @@ -28,7 +28,7 @@ #include struct SbkObject; -struct SbkBaseWrapperType; +struct SbkObjectType; namespace Shiboken { @@ -97,7 +97,7 @@ class HierarchyVisitor public: HierarchyVisitor() : m_wasFinished(false) {} virtual ~HierarchyVisitor() {} - virtual void visit(SbkBaseWrapperType* node) = 0; + virtual void visit(SbkObjectType* node) = 0; void finish() { m_wasFinished = true; }; bool wasFinished() const { return m_wasFinished; } private: @@ -109,7 +109,7 @@ class BaseCountVisitor : public HierarchyVisitor public: BaseCountVisitor() : m_count(0) {} - void visit(SbkBaseWrapperType*) + void visit(SbkObjectType*) { m_count++; } @@ -124,21 +124,21 @@ class BaseAccumulatorVisitor : public HierarchyVisitor public: BaseAccumulatorVisitor() {} - void visit(SbkBaseWrapperType* node) + void visit(SbkObjectType* node) { m_bases.push_back(node); } - std::list bases() const { return m_bases; } + std::list bases() const { return m_bases; } private: - std::list m_bases; + std::list m_bases; }; class GetIndexVisitor : public HierarchyVisitor { public: GetIndexVisitor(PyTypeObject* desiredType) : m_index(-1), m_desiredType(desiredType) {} - virtual void visit(SbkBaseWrapperType* node) + virtual void visit(SbkObjectType* node) { m_index++; if (PyType_IsSubtype(reinterpret_cast(node), m_desiredType)) @@ -155,7 +155,7 @@ class DtorCallerVisitor : public HierarchyVisitor { public: DtorCallerVisitor(SbkObject* pyObj) : m_count(0), m_pyObj(pyObj) {} - void visit(SbkBaseWrapperType* node); + void visit(SbkObjectType* node); private: int m_count; SbkObject* m_pyObj; @@ -183,7 +183,7 @@ inline int getNumberOfCppBaseClasses(PyTypeObject* baseType) return visitor.count(); } -inline std::list getCppBaseClasses(PyTypeObject* baseType) +inline std::list getCppBaseClasses(PyTypeObject* baseType) { BaseAccumulatorVisitor visitor; walkThroughClassHierarchy(baseType, &visitor); diff --git a/libshiboken/bindingmanager.cpp b/libshiboken/bindingmanager.cpp index 5e0cbf3df..183c0c057 100644 --- a/libshiboken/bindingmanager.cpp +++ b/libshiboken/bindingmanager.cpp @@ -37,8 +37,8 @@ typedef google::dense_hash_map WrapperMap; class Graph { public: - typedef std::list NodeList; - typedef google::dense_hash_map Edges; + typedef std::list NodeList; + typedef google::dense_hash_map Edges; Edges m_edges; @@ -47,7 +47,7 @@ public: m_edges.set_empty_key(0); } - void addEdge(SbkBaseWrapperType* from, SbkBaseWrapperType* to) + void addEdge(SbkObjectType* from, SbkObjectType* to) { m_edges[from].push_back(to); } @@ -61,7 +61,7 @@ public: Edges::const_iterator i = m_edges.begin(); for (; i != m_edges.end(); ++i) { - SbkBaseWrapperType* node1 = i->first; + SbkObjectType* node1 = i->first; const NodeList& nodeList = i->second; NodeList::const_iterator j = nodeList.begin(); for (; j != nodeList.end(); ++j) @@ -71,14 +71,14 @@ public: } #endif - SbkBaseWrapperType* identifyType(void* cptr, SbkBaseWrapperType* type, SbkBaseWrapperType* baseType) const + SbkObjectType* identifyType(void* cptr, SbkObjectType* type, SbkObjectType* baseType) const { Edges::const_iterator edgesIt = m_edges.find(type); if (edgesIt != m_edges.end()) { const NodeList& adjNodes = m_edges.find(type)->second; NodeList::const_iterator i = adjNodes.begin(); for (; i != adjNodes.end(); ++i) { - SbkBaseWrapperType* newType = identifyType(cptr, *i, baseType); + SbkObjectType* newType = identifyType(cptr, *i, baseType); if (newType) return newType; } @@ -164,7 +164,7 @@ bool BindingManager::hasWrapper(const void* cptr) } void BindingManager::registerWrapper(SbkObject* pyObj, void* cptr) { - SbkBaseWrapperType* instanceType = reinterpret_cast(pyObj->ob_type); + SbkObjectType* instanceType = reinterpret_cast(pyObj->ob_type); if (instanceType->mi_init && !instanceType->mi_offsets) instanceType->mi_offsets = instanceType->mi_init(cptr); @@ -181,7 +181,7 @@ void BindingManager::registerWrapper(SbkObject* pyObj, void* cptr) void BindingManager::releaseWrapper(SbkObject* sbkObj) { - SbkBaseWrapperType* sbkType = reinterpret_cast(sbkObj->ob_type); + SbkObjectType* sbkType = reinterpret_cast(sbkObj->ob_type); int numBases = sbkType->is_multicpp ? getNumberOfCppBaseClasses(sbkObj->ob_type) : 1; void** cptrs = reinterpret_cast(sbkObj)->d->cptr; @@ -333,14 +333,14 @@ void BindingManager::transferOwnershipToCpp(SbkObject* wrapper) invalidateWrapper(wrapper); } -void BindingManager::addClassInheritance(SbkBaseWrapperType* parent, SbkBaseWrapperType* child) +void BindingManager::addClassInheritance(SbkObjectType* parent, SbkObjectType* child) { m_d->classHierarchy.addEdge(parent, child); } -SbkBaseWrapperType* BindingManager::resolveType(void* cptr, SbkBaseWrapperType* type) +SbkObjectType* BindingManager::resolveType(void* cptr, SbkObjectType* type) { - SbkBaseWrapperType* identifiedType = m_d->classHierarchy.identifyType(cptr, type, type); + SbkObjectType* identifiedType = m_d->classHierarchy.identifyType(cptr, type, type); return identifiedType ? identifiedType : type; } diff --git a/libshiboken/bindingmanager.h b/libshiboken/bindingmanager.h index 8a6607fd4..c1926e5ee 100644 --- a/libshiboken/bindingmanager.h +++ b/libshiboken/bindingmanager.h @@ -28,7 +28,7 @@ #include "shibokenmacros.h" struct SbkObject; -struct SbkBaseWrapperType; +struct SbkObjectType; namespace Shiboken { @@ -56,8 +56,8 @@ public: void transferOwnershipToCpp(SbkObject* wrapper); /// Convenience method to call transferOwnershipToCpp with a properly cast SbkBaseWrapper. void transferOwnershipToCpp(PyObject* wrapper); - void addClassInheritance(SbkBaseWrapperType* parent, SbkBaseWrapperType* child); - SbkBaseWrapperType* resolveType(void* cptr, SbkBaseWrapperType* type); + void addClassInheritance(SbkObjectType* parent, SbkObjectType* child); + SbkObjectType* resolveType(void* cptr, SbkObjectType* type); /// Called by wrapper destructor void destroyWrapper(const void* cptr); diff --git a/libshiboken/conversions.h b/libshiboken/conversions.h index a590ea193..dff144782 100644 --- a/libshiboken/conversions.h +++ b/libshiboken/conversions.h @@ -99,7 +99,7 @@ struct CppObjectCopier { static inline T* copy(const T& obj) { - return reinterpret_cast(reinterpret_cast(SbkType())->obj_copier(&obj)); + return reinterpret_cast(reinterpret_cast(SbkType())->obj_copier(&obj)); } }; @@ -113,7 +113,7 @@ inline PyObject* createWrapper(const T* cppobj, bool hasOwnership = false, bool const char* typeName = 0; if (!isExactType) typeName = typeid(*const_cast(cppobj)).name(); - return Wrapper::newObject(reinterpret_cast(SbkType()), + return Wrapper::newObject(reinterpret_cast(SbkType()), const_cast(cppobj), hasOwnership, isExactType, typeName); } @@ -215,7 +215,7 @@ struct ValueTypeConverter { if (PyObject_TypeCheck(pyobj, SbkType())) return true; - SbkBaseWrapperType* shiboType = reinterpret_cast(SbkType()); + SbkObjectType* shiboType = reinterpret_cast(SbkType()); if (shiboType->ext_isconvertible) return shiboType->ext_isconvertible(pyobj); return false; @@ -235,7 +235,7 @@ struct ValueTypeConverter static inline T toCpp(PyObject* pyobj) { if (!PyObject_TypeCheck(pyobj, SbkType())) { - SbkBaseWrapperType* shiboType = reinterpret_cast(SbkType()); + SbkObjectType* shiboType = reinterpret_cast(SbkType()); if (shiboType->ext_tocpp && isConvertible(pyobj)) { T* cptr = reinterpret_cast(shiboType->ext_tocpp(pyobj)); std::auto_ptr cptr_auto_ptr(cptr); @@ -275,9 +275,9 @@ struct ObjectTypeConverter { if (pyobj == Py_None) return 0; - SbkBaseWrapperType* shiboType = reinterpret_cast(pyobj->ob_type); + SbkObjectType* shiboType = reinterpret_cast(pyobj->ob_type); if (shiboType->mi_specialcast) - return (T*) shiboType->mi_specialcast(Wrapper::cppPointer(pyobj, SbkType()), reinterpret_cast(SbkType())); + return (T*) shiboType->mi_specialcast(Wrapper::cppPointer(pyobj, SbkType()), reinterpret_cast(SbkType())); return (T*) Wrapper::cppPointer(pyobj, SbkType()); } }; diff --git a/libshiboken/typeresolver.h b/libshiboken/typeresolver.h index 4e23b970d..bec990909 100644 --- a/libshiboken/typeresolver.h +++ b/libshiboken/typeresolver.h @@ -26,7 +26,7 @@ #include "shibokenmacros.h" #include "conversions.h" -class SbkBaseWrapperType; +class SbkObjectType; namespace Shiboken { -- cgit v1.2.3