aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/libshiboken/basewrapper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken2/libshiboken/basewrapper.cpp')
-rw-r--r--sources/shiboken2/libshiboken/basewrapper.cpp397
1 files changed, 197 insertions, 200 deletions
diff --git a/sources/shiboken2/libshiboken/basewrapper.cpp b/sources/shiboken2/libshiboken/basewrapper.cpp
index f38b55b56..b9f6735d8 100644
--- a/sources/shiboken2/libshiboken/basewrapper.cpp
+++ b/sources/shiboken2/libshiboken/basewrapper.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt for Python.
@@ -58,7 +58,7 @@
#include "voidptr.h"
namespace {
- void _destroyParentInfo(SbkObject* obj, bool keepReference);
+ void _destroyParentInfo(SbkObject *obj, bool keepReference);
}
static void callDestructor(const Shiboken::DtorAccumulatorVisitor::DestructorEntries &dts)
@@ -73,27 +73,26 @@ static void callDestructor(const Shiboken::DtorAccumulatorVisitor::DestructorEnt
extern "C"
{
-static void SbkObjectTypeDealloc(PyObject* pyObj);
-static PyObject* SbkObjectTypeTpNew(PyTypeObject* metatype, PyObject* args, PyObject* kwds);
+static void SbkObjectTypeDealloc(PyObject *pyObj);
+static PyObject *SbkObjectTypeTpNew(PyTypeObject *metatype, PyObject *args, PyObject *kwds);
// PYSIDE-908: The function PyType_Modified does not work in PySide, so we need to
// explicitly pass __doc__. For __signature__ it _did_ actually work, because
// it was not existing before. We add them both for clarity.
static PyGetSetDef SbkObjectType_Type_getsetlist[] = {
- {const_cast<char*>("__signature__"), (getter)Sbk_TypeGet___signature__},
- {const_cast<char*>("__doc__"), (getter)Sbk_TypeGet___doc__},
+ {const_cast<char *>("__signature__"), (getter)Sbk_TypeGet___signature__},
+ {const_cast<char *>("__doc__"), (getter)Sbk_TypeGet___doc__},
{nullptr} // Sentinel
};
static PyType_Slot SbkObjectType_Type_slots[] = {
- {Py_tp_dealloc, (void *)SbkObjectTypeDealloc},
- {Py_tp_setattro, (void *)PyObject_GenericSetAttr},
- {Py_tp_base, (void *)&PyType_Type},
- {Py_tp_alloc, (void *)PyType_GenericAlloc},
- {Py_tp_getset, (void *)SbkObjectType_Type_getsetlist},
- {Py_tp_new, (void *)SbkObjectTypeTpNew},
- {Py_tp_free, (void *)PyObject_GC_Del},
- {0, 0}
+ {Py_tp_dealloc, reinterpret_cast<void *>(SbkObjectTypeDealloc)},
+ {Py_tp_setattro, reinterpret_cast<void *>(PyObject_GenericSetAttr)},
+ {Py_tp_base, static_cast<void *>(&PyType_Type)},
+ {Py_tp_alloc, reinterpret_cast<void *>(PyType_GenericAlloc)},
+ {Py_tp_new, reinterpret_cast<void *>(SbkObjectTypeTpNew)},
+ {Py_tp_free, reinterpret_cast<void *>(PyObject_GC_Del)},
+ {0, nullptr}
};
static PyType_Spec SbkObjectType_Type_spec = {
"Shiboken.ObjectType",
@@ -205,35 +204,35 @@ PyTypeObject *SbkObjectType_TypeF(void)
return type;
}
-static PyObject *SbkObjectGetDict(PyObject* pObj, void *)
+static PyObject *SbkObjectGetDict(PyObject *pObj, void *)
{
- SbkObject *obj = reinterpret_cast<SbkObject *>(pObj);
+ auto *obj = reinterpret_cast<SbkObject *>(pObj);
if (!obj->ob_dict)
obj->ob_dict = PyDict_New();
if (!obj->ob_dict)
- return 0;
+ return nullptr;
Py_INCREF(obj->ob_dict);
return obj->ob_dict;
}
static PyGetSetDef SbkObjectGetSetList[] = {
- {const_cast<char*>("__dict__"), SbkObjectGetDict, 0, 0, 0},
- {0, 0, 0, 0, 0} // Sentinel
+ {const_cast<char *>("__dict__"), SbkObjectGetDict, nullptr, nullptr, nullptr},
+ {nullptr, nullptr, nullptr, nullptr, nullptr} // Sentinel
};
-static int SbkObject_traverse(PyObject* self, visitproc visit, void* arg)
+static int SbkObject_traverse(PyObject *self, visitproc visit, void *arg)
{
- SbkObject* sbkSelf = reinterpret_cast<SbkObject*>(self);
+ auto *sbkSelf = reinterpret_cast<SbkObject *>(self);
//Visit children
- Shiboken::ParentInfo* pInfo = sbkSelf->d->parentInfo;
+ Shiboken::ParentInfo *pInfo = sbkSelf->d->parentInfo;
if (pInfo) {
for (SbkObject *c : pInfo->children)
Py_VISIT(c);
}
//Visit refs
- Shiboken::RefCountMap* rInfo = sbkSelf->d->referredObjects;
+ Shiboken::RefCountMap *rInfo = sbkSelf->d->referredObjects;
if (rInfo) {
for (auto it = rInfo->begin(), end = rInfo->end(); it != end; ++it)
Py_VISIT(it->second);
@@ -244,9 +243,9 @@ static int SbkObject_traverse(PyObject* self, visitproc visit, void* arg)
return 0;
}
-static int SbkObject_clear(PyObject* self)
+static int SbkObject_clear(PyObject *self)
{
- SbkObject* sbkSelf = reinterpret_cast<SbkObject*>(self);
+ auto *sbkSelf = reinterpret_cast<SbkObject *>(self);
Shiboken::Object::removeParent(sbkSelf);
@@ -261,13 +260,13 @@ static int SbkObject_clear(PyObject* self)
}
static PyType_Slot SbkObject_Type_slots[] = {
- {Py_tp_dealloc, (void *)SbkDeallocWrapperWithPrivateDtor},
- {Py_tp_traverse, (void *)SbkObject_traverse},
- {Py_tp_clear, (void *)SbkObject_clear},
+ {Py_tp_dealloc, reinterpret_cast<void *>(SbkDeallocWrapperWithPrivateDtor)},
+ {Py_tp_traverse, reinterpret_cast<void *>(SbkObject_traverse)},
+ {Py_tp_clear, reinterpret_cast<void *>(SbkObject_clear)},
// unsupported: {Py_tp_weaklistoffset, (void *)offsetof(SbkObject, weakreflist)},
- {Py_tp_getset, (void *)SbkObjectGetSetList},
+ {Py_tp_getset, reinterpret_cast<void *>(SbkObjectGetSetList)},
// unsupported: {Py_tp_dictoffset, (void *)offsetof(SbkObject, ob_dict)},
- {0, 0}
+ {0, nullptr}
};
static PyType_Spec SbkObject_Type_spec = {
"Shiboken.Object",
@@ -298,10 +297,10 @@ static int mainThreadDeletionHandler(void *)
return 0;
}
-static void SbkDeallocWrapperCommon(PyObject* pyObj, bool canDelete)
+static void SbkDeallocWrapperCommon(PyObject *pyObj, bool canDelete)
{
- SbkObject* sbkObj = reinterpret_cast<SbkObject*>(pyObj);
- PyTypeObject* pyType = Py_TYPE(pyObj);
+ auto *sbkObj = reinterpret_cast<SbkObject *>(pyObj);
+ PyTypeObject *pyType = Py_TYPE(pyObj);
// Need to decref the type if this is the dealloc func; if type
// is subclassed, that dealloc func will decref (see subtype_dealloc
@@ -352,7 +351,7 @@ static void SbkDeallocWrapperCommon(PyObject* pyObj, bool canDelete)
Shiboken::Object::deallocData(sbkObj, true);
callDestructor(visitor.entries());
} else {
- void* cptr = sbkObj->d->cptr[0];
+ void *cptr = sbkObj->d->cptr[0];
Shiboken::Object::deallocData(sbkObj, true);
Shiboken::ThreadStateSaver threadSaver;
@@ -368,27 +367,27 @@ static void SbkDeallocWrapperCommon(PyObject* pyObj, bool canDelete)
Py_DECREF(pyType);
}
-void SbkDeallocWrapper(PyObject* pyObj)
+void SbkDeallocWrapper(PyObject *pyObj)
{
SbkDeallocWrapperCommon(pyObj, true);
}
-void SbkDeallocQAppWrapper(PyObject* pyObj)
+void SbkDeallocQAppWrapper(PyObject *pyObj)
{
SbkDeallocWrapper(pyObj);
// PYSIDE-571: make sure to create a singleton deleted qApp.
- MakeSingletonQAppWrapper(NULL);
+ MakeSingletonQAppWrapper(nullptr);
}
-void SbkDeallocWrapperWithPrivateDtor(PyObject* self)
+void SbkDeallocWrapperWithPrivateDtor(PyObject *self)
{
SbkDeallocWrapperCommon(self, false);
}
-void SbkObjectTypeDealloc(PyObject* pyObj)
+void SbkObjectTypeDealloc(PyObject *pyObj)
{
SbkObjectTypePrivate *sotp = PepType_SOTP(pyObj);
- PyTypeObject *type = reinterpret_cast<PyTypeObject*>(pyObj);
+ auto type = reinterpret_cast<PyTypeObject *>(pyObj);
PyObject_GC_UnTrack(pyObj);
#ifndef Py_LIMITED_API
@@ -411,7 +410,7 @@ void SbkObjectTypeDealloc(PyObject* pyObj)
#endif
}
-PyObject* SbkObjectTypeTpNew(PyTypeObject* metatype, PyObject* args, PyObject* kwds)
+PyObject *SbkObjectTypeTpNew(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
{
// Check if all bases are new style before calling type.tp_new
// Was causing gc assert errors in test_bug704.py when
@@ -422,19 +421,19 @@ PyObject* SbkObjectTypeTpNew(PyTypeObject* metatype, PyObject* args, PyObject* k
// Before we changed to heap types, it was sufficient to remove the
// Py_TPFLAGS_BASETYPE flag. That does not work, because PySide does
// not respect this flag itself!
- PyObject* name;
- PyObject* pyBases;
- PyObject* dict;
- static const char* kwlist[] = { "name", "bases", "dict", 0};
+ PyObject *name;
+ PyObject *pyBases;
+ PyObject *dict;
+ static const char *kwlist[] = { "name", "bases", "dict", nullptr};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO!O!:sbktype", (char**)kwlist,
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO!O!:sbktype", const_cast<char **>(kwlist),
&name,
&PyTuple_Type, &pyBases,
&PyDict_Type, &dict))
- return NULL;
+ return nullptr;
for (int i=0, i_max=PyTuple_GET_SIZE(pyBases); i < i_max; i++) {
- PyObject* baseType = PyTuple_GET_ITEM(pyBases, i);
+ PyObject *baseType = PyTuple_GET_ITEM(pyBases, i);
#ifndef IS_PY3K
if (PyClass_Check(baseType)) {
PyErr_Format(PyExc_TypeError, "Invalid base class used in type %s. "
@@ -449,15 +448,15 @@ PyObject* SbkObjectTypeTpNew(PyTypeObject* metatype, PyObject* args, PyObject* k
}
// The meta type creates a new type when the Python programmer extends a wrapped C++ class.
- newfunc type_new = reinterpret_cast<newfunc>(PyType_Type.tp_new);
- SbkObjectType *newType = reinterpret_cast<SbkObjectType*>(type_new(metatype, args, kwds));
+ auto type_new = reinterpret_cast<newfunc>(PyType_Type.tp_new);
+ auto *newType = reinterpret_cast<SbkObjectType *>(type_new(metatype, args, kwds));
if (!newType)
- return 0;
+ return nullptr;
Shiboken::ObjectType::initPrivateData(newType);
SbkObjectTypePrivate *sotp = PepType_SOTP(newType);
- const auto bases = Shiboken::getCppBaseClasses(reinterpret_cast<PyTypeObject*>(newType));
+ const auto bases = Shiboken::getCppBaseClasses(reinterpret_cast<PyTypeObject *>(newType));
if (bases.size() == 1) {
SbkObjectTypePrivate *parentType = PepType_SOTP(bases.front());
sotp->mi_offsets = parentType->mi_offsets;
@@ -489,19 +488,19 @@ PyObject* SbkObjectTypeTpNew(PyTypeObject* metatype, PyObject* args, PyObject* k
PepType_SOTP(base)->subtype_init(newType, args, kwds);
}
- return reinterpret_cast<PyObject*>(newType);
+ return reinterpret_cast<PyObject *>(newType);
}
static PyObject *_setupNew(SbkObject *self, PyTypeObject *subtype)
{
- Py_INCREF(reinterpret_cast<PyObject*>(subtype));
- SbkObjectPrivate* d = new SbkObjectPrivate;
+ Py_INCREF(reinterpret_cast<PyObject *>(subtype));
+ auto d = new SbkObjectPrivate;
- SbkObjectTypePrivate * sotp = PepType_SOTP(subtype);
+ SbkObjectTypePrivate *sotp = PepType_SOTP(subtype);
int numBases = ((sotp && sotp->is_multicpp) ?
Shiboken::getNumberOfCppBaseClasses(subtype) : 1);
- d->cptr = new void*[numBases];
- std::memset(d->cptr, 0, sizeof(void*) * size_t(numBases));
+ d->cptr = new void *[numBases];
+ std::memset(d->cptr, 0, sizeof(void *) *size_t(numBases));
d->hasOwnership = 1;
d->containsCppWrapper = 0;
d->validCppObject = 0;
@@ -511,18 +510,18 @@ static PyObject *_setupNew(SbkObject *self, PyTypeObject *subtype)
self->ob_dict = nullptr;
self->weakreflist = nullptr;
self->d = d;
- return reinterpret_cast<PyObject*>(self);
+ return reinterpret_cast<PyObject *>(self);
}
-PyObject* SbkObjectTpNew(PyTypeObject *subtype, PyObject *, PyObject *)
+PyObject *SbkObjectTpNew(PyTypeObject *subtype, PyObject *, PyObject *)
{
SbkObject *self = PyObject_GC_New(SbkObject, subtype);
PyObject *res = _setupNew(self, subtype);
- PyObject_GC_Track(reinterpret_cast<PyObject*>(self));
+ PyObject_GC_Track(reinterpret_cast<PyObject *>(self));
return res;
}
-PyObject* SbkQAppTpNew(PyTypeObject* subtype, PyObject *, PyObject *)
+PyObject *SbkQAppTpNew(PyTypeObject *subtype, PyObject *, PyObject *)
{
// PYSIDE-571:
// For qApp, we need to create a singleton Python object.
@@ -542,8 +541,8 @@ PyObject* SbkQAppTpNew(PyTypeObject* subtype, PyObject *, PyObject *)
subtype->tp_free = PyObject_Del;
}
#endif
- SbkObject* self = reinterpret_cast<SbkObject*>(MakeSingletonQAppWrapper(subtype));
- return self == 0 ? 0 : _setupNew(self, subtype);
+ auto self = reinterpret_cast<SbkObject *>(MakeSingletonQAppWrapper(subtype));
+ return self == nullptr ? nullptr : _setupNew(self, subtype);
}
void
@@ -553,7 +552,7 @@ object_dealloc(PyObject *self)
}
PyObject *
-SbkDummyNew(PyTypeObject *type, PyObject*, PyObject*)
+SbkDummyNew(PyTypeObject *type, PyObject *, PyObject *)
{
// PYSIDE-595: Give the same error as type_call does when tp_new is NULL.
PyErr_Format(PyExc_TypeError,
@@ -568,12 +567,12 @@ SbkDummyNew(PyTypeObject *type, PyObject*, PyObject*)
namespace
{
-void _destroyParentInfo(SbkObject* obj, bool keepReference)
+void _destroyParentInfo(SbkObject *obj, bool keepReference)
{
- Shiboken::ParentInfo* pInfo = obj->d->parentInfo;
+ Shiboken::ParentInfo *pInfo = obj->d->parentInfo;
if (pInfo) {
while(!pInfo->children.empty()) {
- SbkObject* first = *pInfo->children.begin();
+ SbkObject *first = *pInfo->children.begin();
// Mark child as invalid
Shiboken::Object::invalidate(first);
Shiboken::Object::removeParent(first, false, keepReference);
@@ -588,13 +587,13 @@ namespace Shiboken
{
bool walkThroughClassHierarchy(PyTypeObject *currentType, HierarchyVisitor *visitor)
{
- PyObject* bases = currentType->tp_bases;
+ PyObject *bases = currentType->tp_bases;
Py_ssize_t numBases = PyTuple_GET_SIZE(bases);
bool result = false;
for (int i = 0; !result && i < numBases; ++i) {
- PyTypeObject* type = reinterpret_cast<PyTypeObject*>(PyTuple_GET_ITEM(bases, i));
- if (PyType_IsSubtype(type, reinterpret_cast<PyTypeObject*>(SbkObject_TypeF()))) {
- SbkObjectType* sbkType = reinterpret_cast<SbkObjectType*>(type);
+ auto type = reinterpret_cast<PyTypeObject *>(PyTuple_GET_ITEM(bases, i));
+ if (PyType_IsSubtype(type, reinterpret_cast<PyTypeObject *>(SbkObject_TypeF()))) {
+ auto sbkType = reinterpret_cast<SbkObjectType *>(type);
result = PepType_SOTP(sbkType)->is_user_type
? walkThroughClassHierarchy(type, visitor) : visitor->visit(sbkType);
}
@@ -602,10 +601,10 @@ bool walkThroughClassHierarchy(PyTypeObject *currentType, HierarchyVisitor *visi
return result;
}
-bool importModule(const char* moduleName, PyTypeObject*** cppApiPtr)
+bool importModule(const char *moduleName, PyTypeObject *** cppApiPtr)
{
- PyObject* sysModules = PyImport_GetModuleDict();
- PyObject* module = PyDict_GetItemString(sysModules, moduleName);
+ PyObject *sysModules = PyImport_GetModuleDict();
+ PyObject *module = PyDict_GetItemString(sysModules, moduleName);
if (!module) {
module = PyImport_ImportModule(moduleName);
if (!module)
@@ -622,11 +621,11 @@ bool importModule(const char* moduleName, PyTypeObject*** cppApiPtr)
#ifdef IS_PY3K
if (PyCapsule_CheckExact(cppApi))
- *cppApiPtr = reinterpret_cast<PyTypeObject**>(PyCapsule_GetPointer(cppApi, 0));
+ *cppApiPtr = reinterpret_cast<PyTypeObject **>(PyCapsule_GetPointer(cppApi, nullptr));
#else
// Python 2.6 doesn't have PyCapsule API, so let's keep usign PyCObject on all Python 2.x
if (PyCObject_Check(cppApi))
- *cppApiPtr = reinterpret_cast<PyTypeObject**>(PyCObject_AsVoidPtr(cppApi));
+ *cppApiPtr = reinterpret_cast<PyTypeObject **>(PyCObject_AsVoidPtr(cppApi));
#endif
return true;
}
@@ -651,7 +650,7 @@ bool BaseAccumulatorVisitor::visit(SbkObjectType *node)
bool GetIndexVisitor::visit(SbkObjectType *node)
{
m_index++;
- return PyType_IsSubtype(reinterpret_cast<PyTypeObject*>(node), m_desiredType);
+ return PyType_IsSubtype(reinterpret_cast<PyTypeObject *>(node), m_desiredType);
}
bool DtorAccumulatorVisitor::visit(SbkObjectType *node)
@@ -709,27 +708,27 @@ public:
bool visit(SbkObjectType *node) override
{
- return reinterpret_cast<PyTypeObject*>(node) == m_typeToFind;
+ return reinterpret_cast<PyTypeObject *>(node) == m_typeToFind;
}
private:
PyTypeObject *m_typeToFind;
};
-std::vector<SbkObject *> splitPyObject(PyObject* pyObj)
+std::vector<SbkObject *> splitPyObject(PyObject *pyObj)
{
std::vector<SbkObject *> result;
if (PySequence_Check(pyObj)) {
AutoDecRef lst(PySequence_Fast(pyObj, "Invalid keep reference object."));
if (!lst.isNull()) {
for (Py_ssize_t i = 0, i_max = PySequence_Fast_GET_SIZE(lst.object()); i < i_max; ++i) {
- PyObject* item = PySequence_Fast_GET_ITEM(lst.object(), i);
+ PyObject *item = PySequence_Fast_GET_ITEM(lst.object(), i);
if (Object::checkType(item))
- result.push_back(reinterpret_cast<SbkObject*>(item));
+ result.push_back(reinterpret_cast<SbkObject *>(item));
}
}
} else {
- result.push_back(reinterpret_cast<SbkObject*>(pyObj));
+ result.push_back(reinterpret_cast<SbkObject *>(pyObj));
}
return result;
}
@@ -744,17 +743,17 @@ inline void decRefPyObjectList(Iterator i1, Iterator i2)
namespace ObjectType
{
-bool checkType(PyTypeObject* type)
+bool checkType(PyTypeObject *type)
{
- return PyType_IsSubtype(type, reinterpret_cast<PyTypeObject*>(SbkObject_TypeF())) != 0;
+ return PyType_IsSubtype(type, reinterpret_cast<PyTypeObject *>(SbkObject_TypeF())) != 0;
}
-bool isUserType(PyTypeObject* type)
+bool isUserType(PyTypeObject *type)
{
return checkType(type) && PepType_SOTP(type)->is_user_type;
}
-bool canCallConstructor(PyTypeObject* myType, PyTypeObject* ctorType)
+bool canCallConstructor(PyTypeObject *myType, PyTypeObject *ctorType)
{
FindBaseTypeVisitor visitor(ctorType);
if (!walkThroughClassHierarchy(myType, &visitor)) {
@@ -764,23 +763,23 @@ bool canCallConstructor(PyTypeObject* myType, PyTypeObject* ctorType)
return true;
}
-bool hasCast(SbkObjectType* type)
+bool hasCast(SbkObjectType *type)
{
- return PepType_SOTP(type)->mi_specialcast != 0;
+ return PepType_SOTP(type)->mi_specialcast != nullptr;
}
-void* cast(SbkObjectType* sourceType, SbkObject* obj, PyTypeObject* targetType)
+void *cast(SbkObjectType *sourceType, SbkObject *obj, PyTypeObject *targetType)
{
return PepType_SOTP(sourceType)->mi_specialcast(Object::cppPointer(obj, targetType),
- reinterpret_cast<SbkObjectType*>(targetType));
+ reinterpret_cast<SbkObjectType *>(targetType));
}
-void setCastFunction(SbkObjectType* type, SpecialCastFunction func)
+void setCastFunction(SbkObjectType *type, SpecialCastFunction func)
{
PepType_SOTP(type)->mi_specialcast = func;
}
-void setOriginalName(SbkObjectType* type, const char* name)
+void setOriginalName(SbkObjectType *type, const char *name)
{
SbkObjectTypePrivate *sotp = PepType_SOTP(type);
if (sotp->original_name)
@@ -788,12 +787,12 @@ void setOriginalName(SbkObjectType* type, const char* name)
sotp->original_name = strdup(name);
}
-const char* getOriginalName(SbkObjectType* type)
+const char *getOriginalName(SbkObjectType *type)
{
return PepType_SOTP(type)->original_name;
}
-void setTypeDiscoveryFunctionV2(SbkObjectType* type, TypeDiscoveryFuncV2 func)
+void setTypeDiscoveryFunctionV2(SbkObjectType *type, TypeDiscoveryFuncV2 func)
{
PepType_SOTP(type)->type_discovery = func;
}
@@ -805,7 +804,7 @@ void copyMultipleInheritance(SbkObjectType *type, SbkObjectType *other)
PepType_SOTP(type)->mi_specialcast = PepType_SOTP(other)->mi_specialcast;
}
-void setMultipleInheritanceFunction(SbkObjectType* type, MultipleInheritanceInitFunction function)
+void setMultipleInheritanceFunction(SbkObjectType *type, MultipleInheritanceInitFunction function)
{
PepType_SOTP(type)->mi_init = function;
}
@@ -815,12 +814,12 @@ MultipleInheritanceInitFunction getMultipleInheritanceFunction(SbkObjectType *ty
return PepType_SOTP(type)->mi_init;
}
-void setDestructorFunction(SbkObjectType* type, ObjectDestructor func)
+void setDestructorFunction(SbkObjectType *type, ObjectDestructor func)
{
PepType_SOTP(type)->cpp_dtor = func;
}
-void initPrivateData(SbkObjectType* type)
+void initPrivateData(SbkObjectType *type)
{
PepType_SOTP(type) = new SbkObjectTypePrivate;
memset(PepType_SOTP(type), 0, sizeof(SbkObjectTypePrivate));
@@ -842,7 +841,7 @@ introduceWrapperType(PyObject *enclosingObject,
PyObject *heaptype = PyType_FromSpecWithBases(typeSpec, baseTypes);
Py_TYPE(heaptype) = SbkObjectType_TypeF();
Py_INCREF(Py_TYPE(heaptype));
- SbkObjectType *type = reinterpret_cast<SbkObjectType *>(heaptype);
+ auto *type = reinterpret_cast<SbkObjectType *>(heaptype);
if (baseType) {
if (baseTypes) {
for (int i = 0; i < PySequence_Fast_GET_SIZE(baseTypes); ++i)
@@ -862,7 +861,7 @@ introduceWrapperType(PyObject *enclosingObject,
setOriginalName(type, originalName);
setDestructorFunction(type, cppObjDtor);
- PyObject *ob_type = reinterpret_cast<PyObject *>(type);
+ auto *ob_type = reinterpret_cast<PyObject *>(type);
if (wrapperFlags & InnerClass)
return PyDict_SetItemString(enclosingObject, typeName, ob_type) == 0 ? type : nullptr;
@@ -872,17 +871,17 @@ introduceWrapperType(PyObject *enclosingObject,
return PyModule_AddObject(enclosingObject, typeName, ob_type) == 0 ? type : nullptr;
}
-void setSubTypeInitHook(SbkObjectType* type, SubTypeInitHook func)
+void setSubTypeInitHook(SbkObjectType *type, SubTypeInitHook func)
{
PepType_SOTP(type)->subtype_init = func;
}
-void* getTypeUserData(SbkObjectType* type)
+void *getTypeUserData(SbkObjectType *type)
{
return PepType_SOTP(type)->user_data;
}
-void setTypeUserData(SbkObjectType* type, void* userData, DeleteUserDataFunc d_func)
+void setTypeUserData(SbkObjectType *type, void *userData, DeleteUserDataFunc d_func)
{
SbkObjectTypePrivate *sotp = PepType_SOTP(type);
sotp->user_data = userData;
@@ -895,7 +894,7 @@ SbkObjectType *typeForTypeName(const char *typeName)
SbkObjectType *result{};
if (typeName) {
if (PyTypeObject *pyType = Shiboken::Conversions::getPythonTypeObject(typeName))
- result = reinterpret_cast<SbkObjectType*>(pyType);
+ result = reinterpret_cast<SbkObjectType *>(pyType);
}
return result;
}
@@ -912,25 +911,25 @@ bool hasSpecialCastFunction(SbkObjectType *sbkType)
namespace Object
{
-static void recursive_invalidate(SbkObject* self, std::set<SbkObject*>& seen);
+static void recursive_invalidate(SbkObject *self, std::set<SbkObject *>& seen);
-bool checkType(PyObject* pyObj)
+bool checkType(PyObject *pyObj)
{
return ObjectType::checkType(Py_TYPE(pyObj));
}
-bool isUserType(PyObject* pyObj)
+bool isUserType(PyObject *pyObj)
{
return ObjectType::isUserType(Py_TYPE(pyObj));
}
-Py_hash_t hash(PyObject* pyObj)
+Py_hash_t hash(PyObject *pyObj)
{
assert(Shiboken::Object::checkType(pyObj));
return reinterpret_cast<Py_hash_t>(pyObj);
}
-static void setSequenceOwnership(PyObject* pyObj, bool owner)
+static void setSequenceOwnership(PyObject *pyObj, bool owner)
{
bool has_length = true;
@@ -957,36 +956,36 @@ static void setSequenceOwnership(PyObject* pyObj, bool owner)
}
} else if (Object::checkType(pyObj)) {
if (owner)
- getOwnership(reinterpret_cast<SbkObject*>(pyObj));
+ getOwnership(reinterpret_cast<SbkObject *>(pyObj));
else
- releaseOwnership(reinterpret_cast<SbkObject*>(pyObj));
+ releaseOwnership(reinterpret_cast<SbkObject *>(pyObj));
}
}
-void setValidCpp(SbkObject* pyObj, bool value)
+void setValidCpp(SbkObject *pyObj, bool value)
{
pyObj->d->validCppObject = value;
}
-void setHasCppWrapper(SbkObject* pyObj, bool value)
+void setHasCppWrapper(SbkObject *pyObj, bool value)
{
pyObj->d->containsCppWrapper = value;
}
-bool hasCppWrapper(SbkObject* pyObj)
+bool hasCppWrapper(SbkObject *pyObj)
{
return pyObj->d->containsCppWrapper;
}
-bool wasCreatedByPython(SbkObject* pyObj)
+bool wasCreatedByPython(SbkObject *pyObj)
{
return pyObj->d->cppObjectCreated;
}
-void callCppDestructors(SbkObject* pyObj)
+void callCppDestructors(SbkObject *pyObj)
{
PyTypeObject *type = Py_TYPE(pyObj);
- SbkObjectTypePrivate * sotp = PepType_SOTP(type);
+ SbkObjectTypePrivate *sotp = PepType_SOTP(type);
if (sotp->is_multicpp) {
Shiboken::DtorAccumulatorVisitor visitor(pyObj);
Shiboken::walkThroughClassHierarchy(type, &visitor);
@@ -1007,16 +1006,16 @@ void callCppDestructors(SbkObject* pyObj)
}
delete[] pyObj->d->cptr;
- pyObj->d->cptr = 0;
+ pyObj->d->cptr = nullptr;
pyObj->d->validCppObject = false;
}
-bool hasOwnership(SbkObject* pyObj)
+bool hasOwnership(SbkObject *pyObj)
{
return pyObj->d->hasOwnership;
}
-void getOwnership(SbkObject* self)
+void getOwnership(SbkObject *self)
{
// skip if already have the ownership
if (self->d->hasOwnership)
@@ -1035,16 +1034,16 @@ void getOwnership(SbkObject* self)
makeValid(self); // Make the object valid again
}
-void getOwnership(PyObject* pyObj)
+void getOwnership(PyObject *pyObj)
{
if (pyObj)
setSequenceOwnership(pyObj, true);
}
-void releaseOwnership(SbkObject* self)
+void releaseOwnership(SbkObject *self)
{
// skip if the ownership have already moved to c++
- SbkObjectType* selfType = reinterpret_cast<SbkObjectType*>(Py_TYPE(self));
+ auto *selfType = reinterpret_cast<SbkObjectType *>(Py_TYPE(self));
if (!self->d->hasOwnership || Shiboken::Conversions::pythonTypeIsValueType(PepType_SOTP(selfType)->converter))
return;
@@ -1058,35 +1057,35 @@ void releaseOwnership(SbkObject* self)
invalidate(self); // If I do not know when this object will die We need to invalidate this to avoid use after
}
-void releaseOwnership(PyObject* self)
+void releaseOwnership(PyObject *self)
{
setSequenceOwnership(self, false);
}
/* Needed forward declarations */
-static void recursive_invalidate(PyObject* pyobj, std::set<SbkObject*>& seen);
-static void recursive_invalidate(SbkObject* self, std::set<SbkObject*>& seen);
+static void recursive_invalidate(PyObject *pyobj, std::set<SbkObject *>& seen);
+static void recursive_invalidate(SbkObject *self, std::set<SbkObject *> &seen);
-void invalidate(PyObject* pyobj)
+void invalidate(PyObject *pyobj)
{
- std::set<SbkObject*> seen;
+ std::set<SbkObject *> seen;
recursive_invalidate(pyobj, seen);
}
-void invalidate(SbkObject* self)
+void invalidate(SbkObject *self)
{
- std::set<SbkObject*> seen;
+ std::set<SbkObject *> seen;
recursive_invalidate(self, seen);
}
-static void recursive_invalidate(PyObject* pyobj, std::set<SbkObject*>& seen)
+static void recursive_invalidate(PyObject *pyobj, std::set<SbkObject *> &seen)
{
const auto objs = splitPyObject(pyobj);
for (SbkObject *o : objs)
recursive_invalidate(o, seen);
}
-static void recursive_invalidate(SbkObject* self, std::set<SbkObject*>& seen)
+static void recursive_invalidate(SbkObject *self, std::set<SbkObject *> &seen)
{
// Skip if this object not is a valid object or if it's already been seen
if (!self || reinterpret_cast<PyObject *>(self) == Py_None || seen.find(self) != seen.end())
@@ -1115,13 +1114,13 @@ static void recursive_invalidate(SbkObject* self, std::set<SbkObject*>& seen)
// If has ref to other objects invalidate all
if (self->d->referredObjects) {
- RefCountMap& refCountMap = *(self->d->referredObjects);
+ RefCountMap &refCountMap = *(self->d->referredObjects);
for (auto it = refCountMap.begin(), end = refCountMap.end(); it != end; ++it)
recursive_invalidate(it->second, seen);
}
}
-void makeValid(SbkObject* self)
+void makeValid(SbkObject *self)
{
// Skip if this object not is a valid object
if (!self || reinterpret_cast<PyObject *>(self) == Py_None || self->d->validCppObject)
@@ -1138,7 +1137,7 @@ void makeValid(SbkObject* self)
// If has ref to other objects make all valid again
if (self->d->referredObjects) {
- RefCountMap& refCountMap = *(self->d->referredObjects);
+ RefCountMap &refCountMap = *(self->d->referredObjects);
RefCountMap::iterator iter;
for (auto it = refCountMap.begin(), end = refCountMap.end(); it != end; ++it) {
if (Shiboken::Object::checkType(it->second))
@@ -1147,35 +1146,35 @@ void makeValid(SbkObject* self)
}
}
-void* cppPointer(SbkObject* pyObj, PyTypeObject* desiredType)
+void *cppPointer(SbkObject *pyObj, PyTypeObject *desiredType)
{
- PyTypeObject* type = Py_TYPE(pyObj);
+ PyTypeObject *type = Py_TYPE(pyObj);
int idx = 0;
- if (PepType_SOTP(reinterpret_cast<SbkObjectType*>(type))->is_multicpp)
+ if (PepType_SOTP(reinterpret_cast<SbkObjectType *>(type))->is_multicpp)
idx = getTypeIndexOnHierarchy(type, desiredType);
if (pyObj->d->cptr)
return pyObj->d->cptr[idx];
- return 0;
+ return nullptr;
}
-std::vector<void*> cppPointers(SbkObject* pyObj)
+std::vector<void *> cppPointers(SbkObject *pyObj)
{
int n = getNumberOfCppBaseClasses(Py_TYPE(pyObj));
- std::vector<void*> ptrs(n);
+ std::vector<void *> ptrs(n);
for (int i = 0; i < n; ++i)
ptrs[i] = pyObj->d->cptr[i];
return ptrs;
}
-bool setCppPointer(SbkObject* sbkObj, PyTypeObject* desiredType, void* cptr)
+bool setCppPointer(SbkObject *sbkObj, PyTypeObject *desiredType, void *cptr)
{
int idx = 0;
PyTypeObject *type = Py_TYPE(sbkObj);
if (PepType_SOTP(type)->is_multicpp)
idx = getTypeIndexOnHierarchy(type, desiredType);
- const bool alreadyInitialized = sbkObj->d->cptr[idx] != 0;
+ const bool alreadyInitialized = sbkObj->d->cptr[idx] != nullptr;
if (alreadyInitialized)
PyErr_SetString(PyExc_RuntimeError, "You can't initialize an object twice!");
else
@@ -1185,14 +1184,14 @@ bool setCppPointer(SbkObject* sbkObj, PyTypeObject* desiredType, void* cptr)
return !alreadyInitialized;
}
-bool isValid(PyObject* pyObj)
+bool isValid(PyObject *pyObj)
{
if (!pyObj || pyObj == Py_None
|| Py_TYPE(Py_TYPE(pyObj)) != SbkObjectType_TypeF()) {
return true;
}
- SbkObjectPrivate* priv = reinterpret_cast<SbkObject*>(pyObj)->d;
+ auto priv = reinterpret_cast<SbkObject *>(pyObj)->d;
if (!priv->cppObjectCreated && isUserType(pyObj)) {
PyErr_Format(PyExc_RuntimeError, "'__init__' method of object's base class (%s) not called.",
@@ -1209,13 +1208,13 @@ bool isValid(PyObject* pyObj)
return true;
}
-bool isValid(SbkObject* pyObj, bool throwPyError)
+bool isValid(SbkObject *pyObj, bool throwPyError)
{
if (!pyObj)
return false;
- SbkObjectPrivate* priv = pyObj->d;
- if (!priv->cppObjectCreated && isUserType(reinterpret_cast<PyObject*>(pyObj))) {
+ SbkObjectPrivate *priv = pyObj->d;
+ if (!priv->cppObjectCreated && isUserType(reinterpret_cast<PyObject *>(pyObj))) {
if (throwPyError)
PyErr_Format(PyExc_RuntimeError, "Base constructor of the object (%s) not called.",
Py_TYPE(pyObj)->tp_name);
@@ -1232,13 +1231,13 @@ bool isValid(SbkObject* pyObj, bool throwPyError)
return true;
}
-bool isValid(PyObject* pyObj, bool throwPyError)
+bool isValid(PyObject *pyObj, bool throwPyError)
{
if (!pyObj || pyObj == Py_None ||
- !PyType_IsSubtype(Py_TYPE(pyObj), reinterpret_cast<PyTypeObject*>(SbkObject_TypeF()))) {
+ !PyType_IsSubtype(Py_TYPE(pyObj), reinterpret_cast<PyTypeObject *>(SbkObject_TypeF()))) {
return true;
}
- return isValid(reinterpret_cast<SbkObject*>(pyObj), throwPyError);
+ return isValid(reinterpret_cast<SbkObject *>(pyObj), throwPyError);
}
SbkObject *findColocatedChild(SbkObject *wrapper,
@@ -1249,32 +1248,30 @@ SbkObject *findColocatedChild(SbkObject *wrapper,
return wrapper;
if (!(wrapper->d && wrapper->d->cptr))
- return 0;
+ return nullptr;
- ParentInfo* pInfo = wrapper->d->parentInfo;
+ ParentInfo *pInfo = wrapper->d->parentInfo;
if (!pInfo)
- return 0;
+ return nullptr;
- ChildrenList& children = pInfo->children;
+ ChildrenList &children = pInfo->children;
for (SbkObject *child : children) {
if (!(child->d && child->d->cptr))
continue;
if (child->d->cptr[0] == wrapper->d->cptr[0]) {
- if (reinterpret_cast<const void *>(Py_TYPE(child)) == reinterpret_cast<const void *>(instanceType))
- return child;
- else
- return findColocatedChild(child, instanceType);
+ return reinterpret_cast<const void *>(Py_TYPE(child)) == reinterpret_cast<const void *>(instanceType)
+ ? child : findColocatedChild(child, instanceType);
}
}
- return 0;
+ return nullptr;
}
-PyObject *newObject(SbkObjectType* instanceType,
- void* cptr,
+PyObject *newObject(SbkObjectType *instanceType,
+ void *cptr,
bool hasOwnership,
bool isExactType,
- const char* typeName)
+ const char *typeName)
{
// Try to find the exact type of cptr.
if (!isExactType) {
@@ -1286,11 +1283,11 @@ PyObject *newObject(SbkObjectType* instanceType,
bool shouldCreate = true;
bool shouldRegister = true;
- SbkObject* self = 0;
+ SbkObject *self = nullptr;
// Some logic to ensure that colocated child field does not overwrite the parent
if (BindingManager::instance().hasWrapper(cptr)) {
- SbkObject* existingWrapper = BindingManager::instance().retrieveWrapper(cptr);
+ SbkObject *existingWrapper = BindingManager::instance().retrieveWrapper(cptr);
self = findColocatedChild(existingWrapper, instanceType);
if (self) {
@@ -1313,7 +1310,7 @@ PyObject *newObject(SbkObjectType* instanceType,
}
if (shouldCreate) {
- self = reinterpret_cast<SbkObject*>(SbkObjectTpNew(reinterpret_cast<PyTypeObject*>(instanceType), 0, 0));
+ self = reinterpret_cast<SbkObject *>(SbkObjectTpNew(reinterpret_cast<PyTypeObject *>(instanceType), nullptr, nullptr));
self->d->cptr[0] = cptr;
self->d->hasOwnership = hasOwnership;
self->d->validCppObject = 1;
@@ -1321,17 +1318,17 @@ PyObject *newObject(SbkObjectType* instanceType,
BindingManager::instance().registerWrapper(self, cptr);
}
} else {
- Py_IncRef(reinterpret_cast<PyObject*>(self));
+ Py_IncRef(reinterpret_cast<PyObject *>(self));
}
- return reinterpret_cast<PyObject*>(self);
+ return reinterpret_cast<PyObject *>(self);
}
-void destroy(SbkObject* self)
+void destroy(SbkObject *self)
{
- destroy(self, 0);
+ destroy(self, nullptr);
}
-void destroy(SbkObject* self, void* cppData)
+void destroy(SbkObject *self, void *cppData)
{
// Skip if this is called with NULL pointer this can happen in derived classes
if (!self)
@@ -1369,15 +1366,15 @@ void destroy(SbkObject* self, void* cppData)
// the cpp object instance was deleted
delete[] self->d->cptr;
- self->d->cptr = 0;
+ self->d->cptr = nullptr;
}
// After this point the object can be death do not use the self pointer bellow
}
-void removeParent(SbkObject* child, bool giveOwnershipBack, bool keepReference)
+void removeParent(SbkObject *child, bool giveOwnershipBack, bool keepReference)
{
- ParentInfo* pInfo = child->d->parentInfo;
+ ParentInfo *pInfo = child->d->parentInfo;
if (!pInfo || !pInfo->parent) {
if (pInfo && pInfo->hasWrapperRef) {
pInfo->hasWrapperRef = false;
@@ -1385,7 +1382,7 @@ void removeParent(SbkObject* child, bool giveOwnershipBack, bool keepReference)
return;
}
- ChildrenList& oldBrothers = pInfo->parent->d->parentInfo->children;
+ ChildrenList &oldBrothers = pInfo->parent->d->parentInfo->children;
// Verify if this child is part of parent list
auto iChild = oldBrothers.find(child);
if (iChild == oldBrothers.end())
@@ -1393,7 +1390,7 @@ void removeParent(SbkObject* child, bool giveOwnershipBack, bool keepReference)
oldBrothers.erase(iChild);
- pInfo->parent = 0;
+ pInfo->parent = nullptr;
// This will keep the wrapper reference, will wait for wrapper destruction to remove that
if (keepReference &&
@@ -1413,29 +1410,29 @@ void removeParent(SbkObject* child, bool giveOwnershipBack, bool keepReference)
Py_DECREF(child);
}
-void setParent(PyObject* parent, PyObject* child)
+void setParent(PyObject *parent, PyObject *child)
{
if (!child || child == Py_None || child == parent)
return;
/*
- * setParent is recursive when the child is a native Python sequence, i.e. objects not binded by Shiboken
- * like tuple and list.
+ * setParent is recursive when the child is a native Python sequence, i.e. objects not binded by Shiboken
+ * like tuple and list.
*
- * This "limitation" exists to fix the following problem: A class multiple inherits QObject and QString,
- * so if you pass this class to someone that takes the ownership, we CAN'T enter in this if, but hey! QString
- * follows the sequence protocol.
+ * This "limitation" exists to fix the following problem: A class multiple inherits QObject and QString,
+ * so if you pass this class to someone that takes the ownership, we CAN'T enter in this if, but hey! QString
+ * follows the sequence protocol.
*/
if (PySequence_Check(child) && !Object::checkType(child)) {
- Shiboken::AutoDecRef seq(PySequence_Fast(child, 0));
+ Shiboken::AutoDecRef seq(PySequence_Fast(child, nullptr));
for (Py_ssize_t i = 0, max = PySequence_Size(seq); i < max; ++i)
setParent(parent, PySequence_Fast_GET_ITEM(seq.object(), i));
return;
}
bool parentIsNull = !parent || parent == Py_None;
- SbkObject* parent_ = reinterpret_cast<SbkObject*>(parent);
- SbkObject* child_ = reinterpret_cast<SbkObject*>(child);
+ auto parent_ = reinterpret_cast<SbkObject *>(parent);
+ auto child_ = reinterpret_cast<SbkObject *>(child);
if (!parentIsNull) {
if (!parent_->d->parentInfo)
@@ -1446,7 +1443,7 @@ void setParent(PyObject* parent, PyObject* child)
return;
}
- ParentInfo* pInfo = child_->d->parentInfo;
+ ParentInfo *pInfo = child_->d->parentInfo;
bool hasAnotherParent = pInfo && pInfo->parent && pInfo->parent != parent_;
//Avoid destroy child during reparent operation
@@ -1476,7 +1473,7 @@ void setParent(PyObject* parent, PyObject* child)
Py_DECREF(child);
}
-void deallocData(SbkObject* self, bool cleanup)
+void deallocData(SbkObject *self, bool cleanup)
{
// Make cleanup if this is not a wrapper otherwise this will be done on wrapper destructor
if(cleanup) {
@@ -1492,18 +1489,18 @@ void deallocData(SbkObject* self, bool cleanup)
// Remove from BindingManager
Shiboken::BindingManager::instance().releaseWrapper(self);
delete[] self->d->cptr;
- self->d->cptr = 0;
+ self->d->cptr = nullptr;
// delete self->d; PYSIDE-205: wrong!
}
delete self->d; // PYSIDE-205: always delete d.
Py_XDECREF(self->ob_dict);
// PYSIDE-571: qApp is no longer allocated.
- if (PyObject_IS_GC(reinterpret_cast<PyObject*>(self)))
+ if (PyObject_IS_GC(reinterpret_cast<PyObject *>(self)))
Py_TYPE(self)->tp_free(self);
}
-void setTypeUserData(SbkObject* wrapper, void* userData, DeleteUserDataFunc d_func)
+void setTypeUserData(SbkObject *wrapper, void *userData, DeleteUserDataFunc d_func)
{
SbkObjectTypePrivate *sotp = PepType_SOTP(Py_TYPE(wrapper));
if (sotp->user_data)
@@ -1513,7 +1510,7 @@ void setTypeUserData(SbkObject* wrapper, void* userData, DeleteUserDataFunc d_fu
sotp->user_data = userData;
}
-void* getTypeUserData(SbkObject* wrapper)
+void *getTypeUserData(SbkObject *wrapper)
{
return PepType_SOTP(Py_TYPE(wrapper))->user_data;
}
@@ -1523,7 +1520,7 @@ static inline bool isNone(const PyObject *o)
return o == nullptr || o == Py_None;
}
-static void removeRefCountKey(SbkObject* self, const char *key)
+static void removeRefCountKey(SbkObject *self, const char *key)
{
if (self->d->referredObjects) {
const auto iterPair = self->d->referredObjects->equal_range(key);
@@ -1534,7 +1531,7 @@ static void removeRefCountKey(SbkObject* self, const char *key)
}
}
-void keepReference(SbkObject* self, const char* key, PyObject* referredObject, bool append)
+void keepReference(SbkObject *self, const char *key, PyObject *referredObject, bool append)
{
if (isNone(referredObject)) {
removeRefCountKey(self, key);
@@ -1548,7 +1545,7 @@ void keepReference(SbkObject* self, const char* key, PyObject* referredObject, b
return;
}
- RefCountMap& refCountMap = *(self->d->referredObjects);
+ RefCountMap &refCountMap = *(self->d->referredObjects);
const auto iterPair = refCountMap.equal_range(key);
if (std::any_of(iterPair.first, iterPair.second,
[referredObject](const RefCountMap::value_type &v) { return v.second == referredObject; })) {
@@ -1564,24 +1561,24 @@ void keepReference(SbkObject* self, const char* key, PyObject* referredObject, b
Py_INCREF(referredObject);
}
-void removeReference(SbkObject* self, const char* key, PyObject* referredObject)
+void removeReference(SbkObject *self, const char *key, PyObject *referredObject)
{
if (!isNone(referredObject))
removeRefCountKey(self, key);
}
-void clearReferences(SbkObject* self)
+void clearReferences(SbkObject *self)
{
if (!self->d->referredObjects)
return;
- RefCountMap& refCountMap = *(self->d->referredObjects);
+ RefCountMap &refCountMap = *(self->d->referredObjects);
for (auto it = refCountMap.begin(), end = refCountMap.end(); it != end; ++it)
Py_DECREF(it->second);
self->d->referredObjects->clear();
}
-std::string info(SbkObject* self)
+std::string info(SbkObject *self)
{
std::ostringstream s;
@@ -1590,7 +1587,7 @@ std::string info(SbkObject* self)
if (ObjectType::isUserType(Py_TYPE(self)))
bases = getCppBaseClasses(Py_TYPE(self));
else
- bases.push_back(reinterpret_cast<SbkObjectType*>(Py_TYPE(self)));
+ bases.push_back(reinterpret_cast<SbkObjectType *>(Py_TYPE(self)));
s << "C++ address....... ";
for (size_t i = 0, size = bases.size(); i < size; ++i) {
@@ -1625,7 +1622,7 @@ std::string info(SbkObject* self)
}
if (self->d->referredObjects && !self->d->referredObjects->empty()) {
- Shiboken::RefCountMap& map = *self->d->referredObjects;
+ Shiboken::RefCountMap &map = *self->d->referredObjects;
s << "referred objects.. ";
std::string lastKey;
for (auto it = map.begin(), end = map.end(); it != end; ++it) {