aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/libpyside/pysideproperty.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside2/libpyside/pysideproperty.cpp')
-rw-r--r--sources/pyside2/libpyside/pysideproperty.cpp127
1 files changed, 63 insertions, 64 deletions
diff --git a/sources/pyside2/libpyside/pysideproperty.cpp b/sources/pyside2/libpyside/pysideproperty.cpp
index c48a6f88..a2bf5fd2 100644
--- a/sources/pyside2/libpyside/pysideproperty.cpp
+++ b/sources/pyside2/libpyside/pysideproperty.cpp
@@ -51,16 +51,16 @@
extern "C"
{
-static PyObject* qpropertyTpNew(PyTypeObject* subtype, PyObject* args, PyObject* kwds);
-static int qpropertyTpInit(PyObject*, PyObject*, PyObject*);
-static void qpropertyDeAlloc(PyObject* self);
+static PyObject *qpropertyTpNew(PyTypeObject *subtype, PyObject *args, PyObject *kwds);
+static int qpropertyTpInit(PyObject *, PyObject *, PyObject *);
+static void qpropertyDeAlloc(PyObject *self);
//methods
-static PyObject* qPropertyCall(PyObject*, PyObject*, PyObject*);
-static PyObject* qPropertySetter(PyObject*, PyObject*);
-static PyObject* qPropertyGetter(PyObject*, PyObject*);
-static int qpropertyTraverse(PyObject* self, visitproc visit, void* arg);
-static int qpropertyClear(PyObject* self);
+static PyObject *qPropertyCall(PyObject *, PyObject *, PyObject *);
+static PyObject *qPropertySetter(PyObject *, PyObject *);
+static PyObject *qPropertyGetter(PyObject *, PyObject *);
+static int qpropertyTraverse(PyObject *self, visitproc visit, void *arg);
+static int qpropertyClear(PyObject *self);
static PyMethodDef PySidePropertyMethods[] = {
{"setter", (PyCFunction)qPropertySetter, METH_O, 0},
@@ -98,7 +98,7 @@ PyTypeObject *PySidePropertyTypeF(void)
return type;
}
-static void qpropertyMetaCall(PySideProperty* pp, PyObject* self, QMetaObject::Call call, void** args)
+static void qpropertyMetaCall(PySideProperty *pp, PyObject *self, QMetaObject::Call call, void **args)
{
Shiboken::Conversions::SpecificConverter converter(pp->d->typeName);
Q_ASSERT(converter);
@@ -109,7 +109,7 @@ static void qpropertyMetaCall(PySideProperty* pp, PyObject* self, QMetaObject::C
case QMetaObject::ReadProperty:
{
Shiboken::GilState gil;
- PyObject* value = PySide::Property::getValue(pp, self);
+ PyObject *value = PySide::Property::getValue(pp, self);
if (value) {
converter.toCpp(value, args[0]);
Py_DECREF(value);
@@ -150,16 +150,16 @@ static void qpropertyMetaCall(PySideProperty* pp, PyObject* self, QMetaObject::C
static PyObject *qpropertyTpNew(PyTypeObject *subtype, PyObject * /* args */, PyObject * /* kwds */)
{
- PySideProperty* me = reinterpret_cast<PySideProperty*>(subtype->tp_alloc(subtype, 0));
+ PySideProperty *me = reinterpret_cast<PySideProperty *>(subtype->tp_alloc(subtype, 0));
me->d = new PySidePropertyPrivate;
return reinterpret_cast<PyObject *>(me);
}
-int qpropertyTpInit(PyObject* self, PyObject* args, PyObject* kwds)
+int qpropertyTpInit(PyObject *self, PyObject *args, PyObject *kwds)
{
- PyObject* type = 0;
- PySideProperty* data = reinterpret_cast<PySideProperty*>(self);
- PySidePropertyPrivate* pData = data->d;
+ PyObject *type = nullptr;
+ auto data = reinterpret_cast<PySideProperty *>(self);
+ PySidePropertyPrivate *pData = data->d;
pData->metaCallHandler = &qpropertyMetaCall;
static const char *kwlist[] = {"type", "fget", "fset", "freset", "fdel", "doc", "notify",
@@ -169,7 +169,7 @@ int qpropertyTpInit(PyObject* self, PyObject* args, PyObject* kwds)
if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O|OOOOsObbbbbb:QtCore.QProperty",
- const_cast<char**>(kwlist),
+ const_cast<char **>(kwlist),
/*OO*/ &type, &(pData->fget),
/*OOO*/ &(pData->fset), &(pData->freset), &(pData->fdel),
/*s*/ &doc,
@@ -208,7 +208,7 @@ int qpropertyTpInit(PyObject* self, PyObject* args, PyObject* kwds)
return -1;
}
-void qpropertyDeAlloc(PyObject* self)
+void qpropertyDeAlloc(PyObject *self)
{
qpropertyClear(self);
Py_TYPE(self)->tp_free(self);
@@ -218,8 +218,8 @@ PyObject *qPropertyCall(PyObject *self, PyObject *args, PyObject * /* kw */)
{
PyObject *callback = PyTuple_GetItem(args, 0);
if (PyFunction_Check(callback)) {
- PySideProperty *prop = reinterpret_cast<PySideProperty*>(self);
- PySidePropertyPrivate* pData = prop->d;
+ auto prop = reinterpret_cast<PySideProperty *>(self);
+ PySidePropertyPrivate *pData = prop->d;
Py_INCREF(callback);
pData->fget = callback;
@@ -231,11 +231,11 @@ PyObject *qPropertyCall(PyObject *self, PyObject *args, PyObject * /* kw */)
return nullptr;
}
-PyObject* qPropertySetter(PyObject* self, PyObject* callback)
+PyObject *qPropertySetter(PyObject *self, PyObject *callback)
{
if (PyFunction_Check(callback)) {
- PySideProperty *prop = reinterpret_cast<PySideProperty*>(self);
- PySidePropertyPrivate* pData = prop->d;
+ PySideProperty *prop = reinterpret_cast<PySideProperty *>(self);
+ PySidePropertyPrivate *pData = prop->d;
Py_INCREF(callback);
pData->fset = callback;
@@ -247,11 +247,11 @@ PyObject* qPropertySetter(PyObject* self, PyObject* callback)
return nullptr;
}
-PyObject* qPropertyGetter(PyObject* self, PyObject* callback)
+PyObject *qPropertyGetter(PyObject *self, PyObject *callback)
{
if (PyFunction_Check(callback)) {
- PySideProperty *prop = reinterpret_cast<PySideProperty*>(self);
- PySidePropertyPrivate* pData = prop->d;
+ PySideProperty *prop = reinterpret_cast<PySideProperty *>(self);
+ PySidePropertyPrivate *pData = prop->d;
Py_INCREF(callback);
pData->fget = callback;
@@ -263,9 +263,9 @@ PyObject* qPropertyGetter(PyObject* self, PyObject* callback)
return nullptr;
}
-static int qpropertyTraverse(PyObject* self, visitproc visit, void* arg)
+static int qpropertyTraverse(PyObject *self, visitproc visit, void *arg)
{
- PySidePropertyPrivate* data = reinterpret_cast<PySideProperty*>(self)->d;
+ PySidePropertyPrivate *data = reinterpret_cast<PySideProperty *>(self)->d;
if (!data)
return 0;
@@ -277,9 +277,9 @@ static int qpropertyTraverse(PyObject* self, visitproc visit, void* arg)
return 0;
}
-static int qpropertyClear(PyObject* self)
+static int qpropertyClear(PyObject *self)
{
- PySidePropertyPrivate* data = reinterpret_cast<PySideProperty*>(self)->d;
+ PySidePropertyPrivate *data = reinterpret_cast<PySideProperty *>(self)->d;
if (!data)
return 0;
@@ -291,7 +291,7 @@ static int qpropertyClear(PyObject* self)
delete data;
- reinterpret_cast<PySideProperty*>(self)->d = 0;
+ reinterpret_cast<PySideProperty *>(self)->d = nullptr;
return 0;
}
@@ -299,16 +299,16 @@ static int qpropertyClear(PyObject* self)
namespace {
-static PyObject* getFromType(PyTypeObject* type, PyObject* name)
+static PyObject *getFromType(PyTypeObject *type, PyObject *name)
{
- PyObject* attr = 0;
+ PyObject *attr = nullptr;
attr = PyDict_GetItem(type->tp_dict, name);
if (!attr) {
- PyObject* bases = type->tp_bases;
+ PyObject *bases = type->tp_bases;
int size = PyTuple_GET_SIZE(bases);
for(int i=0; i < size; i++) {
- PyObject* base = PyTuple_GET_ITEM(bases, i);
- attr = getFromType(reinterpret_cast<PyTypeObject*>(base), name);
+ PyObject *base = PyTuple_GET_ITEM(bases, i);
+ attr = getFromType(reinterpret_cast<PyTypeObject *>(base), name);
if (attr)
return attr;
}
@@ -321,7 +321,7 @@ static PyObject* getFromType(PyTypeObject* type, PyObject* name)
namespace PySide { namespace Property {
-void init(PyObject* module)
+void init(PyObject *module)
{
if (PyType_Ready(PySidePropertyTypeF()) < 0)
return;
@@ -330,7 +330,7 @@ void init(PyObject* module)
PyModule_AddObject(module, QPROPERTY_CLASS_NAME, reinterpret_cast<PyObject *>(PySidePropertyTypeF()));
}
-bool checkType(PyObject* pyObj)
+bool checkType(PyObject *pyObj)
{
if (pyObj) {
return PyType_IsSubtype(Py_TYPE(pyObj), PySidePropertyTypeF());
@@ -338,14 +338,14 @@ bool checkType(PyObject* pyObj)
return false;
}
-bool isPropertyType(PyObject* pyObj)
+bool isPropertyType(PyObject *pyObj)
{
return checkType(pyObj);
}
-int setValue(PySideProperty* self, PyObject* source, PyObject* value)
+int setValue(PySideProperty *self, PyObject *source, PyObject *value)
{
- PyObject* fset = self->d->fset;
+ PyObject *fset = self->d->fset;
if (fset) {
Shiboken::AutoDecRef args(PyTuple_New(2));
PyTuple_SET_ITEM(args, 0, source);
@@ -360,9 +360,9 @@ int setValue(PySideProperty* self, PyObject* source, PyObject* value)
return -1;
}
-PyObject* getValue(PySideProperty* self, PyObject* source)
+PyObject *getValue(PySideProperty *self, PyObject *source)
{
- PyObject* fget = self->d->fget;
+ PyObject *fget = self->d->fget;
if (fget) {
Shiboken::AutoDecRef args(PyTuple_New(1));
Py_INCREF(source);
@@ -372,9 +372,9 @@ PyObject* getValue(PySideProperty* self, PyObject* source)
return 0;
}
-int reset(PySideProperty* self, PyObject* source)
+int reset(PySideProperty *self, PyObject *source)
{
- PyObject* freset = self->d->freset;
+ PyObject *freset = self->d->freset;
if (freset) {
Shiboken::AutoDecRef args(PyTuple_New(1));
Py_INCREF(source);
@@ -385,25 +385,24 @@ int reset(PySideProperty* self, PyObject* source)
return -1;
}
-const char* getTypeName(const PySideProperty* self)
+const char *getTypeName(const PySideProperty *self)
{
return self->d->typeName;
}
-PySideProperty* getObject(PyObject* source, PyObject* name)
+PySideProperty *getObject(PyObject *source, PyObject *name)
{
- PyObject* attr = 0;
+ PyObject *attr = nullptr;
if (Shiboken::Object::isUserType(source)) {
- PyObject* dict = reinterpret_cast<SbkObject*>(source)->ob_dict;
- if (dict)
+ if (auto dict = reinterpret_cast<SbkObject *>(source)->ob_dict)
attr = PyDict_GetItem(dict, name);
}
attr = getFromType(Py_TYPE(source), name);
if (attr && checkType(attr)) {
Py_INCREF(attr);
- return reinterpret_cast<PySideProperty*>(attr);
+ return reinterpret_cast<PySideProperty *>(attr);
}
if (!attr)
@@ -417,50 +416,50 @@ bool isReadable(const PySideProperty * /* self */)
return true;
}
-bool isWritable(const PySideProperty* self)
+bool isWritable(const PySideProperty *self)
{
return (self->d->fset != 0);
}
-bool hasReset(const PySideProperty* self)
+bool hasReset(const PySideProperty *self)
{
return (self->d->freset != 0);
}
-bool isDesignable(const PySideProperty* self)
+bool isDesignable(const PySideProperty *self)
{
return self->d->designable;
}
-bool isScriptable(const PySideProperty* self)
+bool isScriptable(const PySideProperty *self)
{
return self->d->scriptable;
}
-bool isStored(const PySideProperty* self)
+bool isStored(const PySideProperty *self)
{
return self->d->stored;
}
-bool isUser(const PySideProperty* self)
+bool isUser(const PySideProperty *self)
{
return self->d->user;
}
-bool isConstant(const PySideProperty* self)
+bool isConstant(const PySideProperty *self)
{
return self->d->constant;
}
-bool isFinal(const PySideProperty* self)
+bool isFinal(const PySideProperty *self)
{
return self->d->final;
}
-const char* getNotifyName(PySideProperty* self)
+const char *getNotifyName(PySideProperty *self)
{
if (self->d->notifySignature.isEmpty()) {
- PyObject* str = PyObject_Str(self->d->notify);
+ PyObject *str = PyObject_Str(self->d->notify);
self->d->notifySignature = Shiboken::String::toCString(str);
Py_DECREF(str);
}
@@ -469,22 +468,22 @@ const char* getNotifyName(PySideProperty* self)
? nullptr : self->d->notifySignature.constData();
}
-void setMetaCallHandler(PySideProperty* self, MetaCallHandler handler)
+void setMetaCallHandler(PySideProperty *self, MetaCallHandler handler)
{
self->d->metaCallHandler = handler;
}
-void setTypeName(PySideProperty* self, const char* typeName)
+void setTypeName(PySideProperty *self, const char *typeName)
{
self->d->typeName = typeName;
}
-void setUserData(PySideProperty* self, void* data)
+void setUserData(PySideProperty *self, void *data)
{
self->d->userData = data;
}
-void* userData(PySideProperty* self)
+void *userData(PySideProperty *self)
{
return self->d->userData;
}