aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/PySide2/QtCore
diff options
context:
space:
mode:
authorCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2018-02-01 15:11:18 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2018-02-14 12:10:59 +0000
commit4566f0cba5ed5cccbec4706e343b4fd68400ff2c (patch)
tree89c539d8cb4b41fa328721915fba1d2836ccc044 /sources/pyside2/PySide2/QtCore
parent375a8565e1a0f6e0327d50657ac0f08045012809 (diff)
Apply Qt guidelines to the injected code via XML
There are many inconsistencies in the associated typesystem files that complement the binding generation, this is a first attempt to try to standardize it. Just Qt Coding Style were applied (when possible). In the future the process to access and manipulate Shiboken objects must also be standardized. Change-Id: Ida57d1630a893bc5b608f64119b4c8d638bb9c66 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside2/PySide2/QtCore')
-rw-r--r--sources/pyside2/PySide2/QtCore/typesystem_core_common.xml198
1 files changed, 97 insertions, 101 deletions
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
index 0eaf4165e..2f7ed5b9f 100644
--- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
+++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
@@ -268,7 +268,7 @@
</primitive-type>
<inject-code class="native" position="beginning">
- bool py2kStrCheck(PyObject* obj)
+ bool py2kStrCheck(PyObject *obj)
{
#ifdef IS_PY3K
return false;
@@ -283,15 +283,15 @@
<conversion-rule>
<native-to-target>
const int N = %in.length();
- wchar_t* str = new wchar_t[N];
+ wchar_t *str = new wchar_t[N];
%in.toWCharArray(str);
- PyObject* %out = PyUnicode_FromWideChar(str, N);
+ PyObject *%out = PyUnicode_FromWideChar(str, N);
delete[] str;
return %out;
</native-to-target>
<target-to-native>
<add-conversion type="PyUnicode">
- Py_UNICODE* unicode = PyUnicode_AS_UNICODE(%in);
+ Py_UNICODE *unicode = PyUnicode_AS_UNICODE(%in);
#if defined(Py_UNICODE_WIDE)
// cast as Py_UNICODE can be a different type
%out = QString::fromUcs4((const uint*)unicode);
@@ -316,9 +316,9 @@
<conversion-rule>
<native-to-target>
const int N = %in.toString().length();
- wchar_t* str = new wchar_t[N];
+ wchar_t *str = new wchar_t[N];
%in.toString().toWCharArray(str);
- PyObject* %out = PyUnicode_FromWideChar(str, N);
+ PyObject *%out = PyUnicode_FromWideChar(str, N);
delete[] str;
return %out;
</native-to-target>
@@ -369,7 +369,7 @@
Shiboken::Conversions::SpecificConverter converter(cppInRef.typeName());
if (converter) {
- void* ptr = cppInRef.data();
+ void *ptr = cppInRef.data();
return converter.toPython(ptr);
}
PyErr_Format(PyExc_RuntimeError, "Can't find converter for '%s'.", %in.typeName());
@@ -409,7 +409,7 @@
<add-conversion type="SbkObject">
// a class supported by QVariant?
int typeCode;
- const char* typeName = QVariant_resolveMetaType(%in->ob_type, &amp;typeCode);
+ const char *typeName = QVariant_resolveMetaType(%in->ob_type, &amp;typeCode);
if (!typeCode || !typeName)
return;
QVariant var(typeCode, (void*)0);
@@ -432,11 +432,11 @@
</conversion-rule>
</primitive-type>
<inject-code class="native" position="beginning">
- static const char* QVariant_resolveMetaType(PyTypeObject* type, int* typeId)
+ static const char *QVariant_resolveMetaType(PyTypeObject *type, int *typeId)
{
if (PyObject_TypeCheck(type, &amp;SbkObjectType_Type)) {
- SbkObjectType* sbkType = (SbkObjectType*)type;
- const char* typeName = Shiboken::ObjectType::getOriginalName(sbkType);
+ SbkObjectType *sbkType = (SbkObjectType*)type;
+ const char *typeName = Shiboken::ObjectType::getOriginalName(sbkType);
if (!typeName)
return 0;
bool valueType = '*' != typeName[qstrlen(typeName) - 1];
@@ -456,8 +456,8 @@
// that has added any python fields or slots to its object layout.
// See https://mail.python.org/pipermail/python-list/2009-January/520733.html
if (type->tp_bases) {
- for(int i = 0; i &lt; PyTuple_GET_SIZE(type->tp_bases); ++i) {
- const char* derivedName = QVariant_resolveMetaType((PyTypeObject*)PyTuple_GET_ITEM(type->tp_bases, i), typeId);
+ for (int i = 0; i &lt; PyTuple_GET_SIZE(type->tp_bases); ++i) {
+ const char *derivedName = QVariant_resolveMetaType((PyTypeObject*)PyTuple_GET_ITEM(type->tp_bases, i), typeId);
if (derivedName)
return derivedName;
}
@@ -469,13 +469,13 @@
*typeId = 0;
return 0;
}
- static QVariant QVariant_convertToValueList(PyObject* list)
+ static QVariant QVariant_convertToValueList(PyObject *list)
{
if (PySequence_Size(list) &lt; 1)
return QVariant();
Shiboken::AutoDecRef element(PySequence_GetItem(list, 0));
int typeId;
- const char* typeName = QVariant_resolveMetaType(element.cast&lt;PyTypeObject*&gt;(), &amp;typeId);
+ const char *typeName = QVariant_resolveMetaType(element.cast&lt;PyTypeObject*&gt;(), &amp;typeId);
if (typeName) {
QByteArray listTypeName("QList&lt;");
listTypeName += typeName;
@@ -498,8 +498,8 @@
bool allString = true;
Shiboken::AutoDecRef fast(PySequence_Fast(list, "Failed to convert QVariantList"));
Py_ssize_t size = PySequence_Fast_GET_SIZE(fast.object());
- for(int i = 0; i &lt; size; ++i) {
- PyObject* item = PySequence_Fast_GET_ITEM(fast.object(), i);
+ for (int i = 0; i &lt; size; ++i) {
+ PyObject *item = PySequence_Fast_GET_ITEM(fast.object(), i);
if (!%CHECKTYPE[QString](item)) {
allString = false;
break;
@@ -507,14 +507,14 @@
}
return allString;
}
- static QVariant QVariant_convertToVariantMap(PyObject* map)
+ static QVariant QVariant_convertToVariantMap(PyObject *map)
{
Py_ssize_t pos = 0;
Shiboken::AutoDecRef keys(PyDict_Keys(map));
if (!QVariant_isStringList(keys))
return QVariant();
- PyObject* key;
- PyObject* value;
+ PyObject *key;
+ PyObject *value;
QMap&lt;QString,QVariant&gt; ret;
while (PyDict_Next(map, &amp;pos, &amp;key, &amp;value)) {
QString cppKey = %CONVERTTOCPP[QString](key);
@@ -523,7 +523,7 @@
}
return QVariant(ret);
}
- static QVariant QVariant_convertToVariantList(PyObject* list)
+ static QVariant QVariant_convertToVariantList(PyObject *list)
{
if (QVariant_isStringList(list)) {
QList&lt;QString &gt; lst = %CONVERTTOCPP[QList&lt;QString&gt;](list);
@@ -536,7 +536,7 @@
Shiboken::AutoDecRef fast(PySequence_Fast(list, "Failed to convert QVariantList"));
Py_ssize_t size = PySequence_Fast_GET_SIZE(fast.object());
for (int i = 0; i &lt; size; ++i) {
- PyObject* pyItem = PySequence_Fast_GET_ITEM(fast.object(), i);
+ PyObject *pyItem = PySequence_Fast_GET_ITEM(fast.object(), i);
QVariant item = %CONVERTTOCPP[QVariant](pyItem);
lst.append(item);
}
@@ -547,12 +547,12 @@
<primitive-type name="QVariant::Type" default-constructor="QVariant::Invalid">
<conversion-rule>
<native-to-target>
- const char* typeName = QVariant::typeToName(%in);
- PyObject* %out;
- PyTypeObject* pyType = 0;
+ const char *typeName = QVariant::typeToName(%in);
+ PyObject *%out;
+ PyTypeObject *pyType = nullptr;
if (typeName)
pyType = Shiboken::Conversions::getPythonTypeObject(typeName);
- %out = pyType ? ((PyObject*)pyType) : Py_None;
+ %out = pyType ? (reinterpret_cast&lt;PyObject*&gt;(pyType)) : Py_None;
Py_INCREF(%out);
return %out;
</native-to-target>
@@ -561,17 +561,17 @@
%out = QVariant::Invalid;
</add-conversion>
<add-conversion type="PyTypeObject">
- const char* typeName;
+ const char *typeName;
if (Shiboken::String::checkType((PyTypeObject*)%in))
typeName = "QString";
- else if (%in == (PyObject*)&amp;PyFloat_Type)
+ else if (%in == reinterpret_cast&lt;PyObject*&gt;(&amp;PyFloat_Type))
typeName = "double"; // float is a UserType in QVariant.
- else if (%in == (PyObject*)&amp;PyLong_Type)
+ else if (%in == reinterpret_cast&lt;PyObject*&gt;(&amp;PyLong_Type))
typeName = "int"; // long is a UserType in QVariant.
else if (%in->ob_type == &amp;SbkObjectType_Type)
typeName = Shiboken::ObjectType::getOriginalName((SbkObjectType*)%in);
else
- typeName = ((PyTypeObject*)%in)->tp_name;
+ typeName = (reinterpret_cast&lt;PyTypeObject*&gt;(%in))->tp_name;
%out = QVariant::nameToType(typeName);
</add-conversion>
<add-conversion type="PyString" check="Shiboken::String::check(%in)">
@@ -581,12 +581,7 @@
%out = QVariant::nameToType("QVariantMap");
</add-conversion>
<add-conversion type="PySequence">
- const char* typeName;
- if (QVariantType_isStringList(%in))
- typeName = "QStringList";
- else
- typeName = "QVariantList";
- %out = QVariant::nameToType(typeName);
+ %out = QVariantType_isStringList(%in) ? QVariant::StringList : QVariant::List;
</add-conversion>
</target-to-native>
</conversion-rule>
@@ -598,13 +593,13 @@
</inject-code>
<inject-code class="native" position="beginning">
- static bool QVariantType_isStringList(PyObject* list)
+ static bool QVariantType_isStringList(PyObject *list)
{
bool allString = true;
Shiboken::AutoDecRef fast(PySequence_Fast(list, "Failed to convert QVariantList"));
Py_ssize_t size = PySequence_Fast_GET_SIZE(fast.object());
- for(int i=0; i &lt; size; i++) {
- PyObject* item = PySequence_Fast_GET_ITEM(fast.object(), i);
+ for (int i=0; i &lt; size; i++) {
+ PyObject *item = PySequence_Fast_GET_ITEM(fast.object(), i);
if (!%CHECKTYPE[QString](item)) {
allString = false;
break;
@@ -612,7 +607,7 @@
}
return allString;
}
- static bool QVariantType_checkAllStringKeys(PyObject* dict)
+ static bool QVariantType_checkAllStringKeys(PyObject *dict)
{
Shiboken::AutoDecRef keys(PyDict_Keys(dict));
return QVariantType_isStringList(keys);
@@ -763,13 +758,12 @@
</container-type>
<template name="cppmap_to_pymap_conversion">
- PyObject* %out = PyDict_New();
- %INTYPE::const_iterator it = %in.begin();
- for (; it != %in.end(); ++it) {
+ PyObject *%out = PyDict_New();
+ for (%INTYPE::const_iterator it = %in.begin(), end = %in.end(); it != end; ++it) {
%INTYPE_0 key = it.key();
%INTYPE_1 value = it.value();
- PyObject* pyKey = %CONVERTTOPYTHON[%INTYPE_0](key);
- PyObject* pyValue = %CONVERTTOPYTHON[%INTYPE_1](value);
+ PyObject *pyKey = %CONVERTTOPYTHON[%INTYPE_0](key);
+ PyObject *pyValue = %CONVERTTOPYTHON[%INTYPE_1](value);
PyDict_SetItem(%out, pyKey, pyValue);
Py_DECREF(pyKey);
Py_DECREF(pyValue);
@@ -777,8 +771,8 @@
return %out;
</template>
<template name="pydict_to_cppmap_conversion">
- PyObject* key;
- PyObject* value;
+ PyObject *key;
+ PyObject *value;
Py_ssize_t pos = 0;
while (PyDict_Next(%in, &amp;pos, &amp;key, &amp;value)) {
%OUTTYPE_0 cppKey = %CONVERTTOCPP[%OUTTYPE_0](key);
@@ -833,7 +827,7 @@
<include file-name="QPair" location="global"/>
<conversion-rule>
<native-to-target>
- PyObject* %out = PyTuple_New(2);
+ PyObject *%out = PyTuple_New(2);
PyTuple_SET_ITEM(%out, 0, %CONVERTTOPYTHON[%INTYPE_0](%in.first));
PyTuple_SET_ITEM(%out, 1, %CONVERTTOPYTHON[%INTYPE_1](%in.second));
return %out;
@@ -1002,13 +996,13 @@
void globalPostRoutineCallback()
{
Shiboken::GilState state;
- foreach(PyObject* callback, globalPostRoutineFunctions) {
+ foreach(PyObject *callback, globalPostRoutineFunctions) {
Shiboken::AutoDecRef result(PyObject_CallObject(callback, NULL));
Py_DECREF(callback);
}
globalPostRoutineFunctions.clear();
}
- void addPostRoutine(PyObject* callback)
+ void addPostRoutine(PyObject *callback)
{
if (PyCallable_Check(callback)) {
globalPostRoutineFunctions &lt;&lt; callback;
@@ -1030,7 +1024,7 @@
<inject-code class="target" position="end">
QList&lt;QByteArray&gt; version = QByteArray(qVersion()).split('.');
- PyObject* pyQtVersion = PyTuple_New(3);
+ PyObject *pyQtVersion = PyTuple_New(3);
for (int i = 0; i &lt; 3; ++i)
PyTuple_SET_ITEM(pyQtVersion, i, PyInt_FromLong(version[i].toInt()));
PyModule_AddObject(module, "__version_info__", pyQtVersion);
@@ -1052,7 +1046,7 @@
}
}
if (!atexit.isNull() &amp;&amp; !regFunc.isNull()){
- PyObject* shutDownFunc = PyObject_GetAttrString(module, "__moduleShutdown");
+ PyObject *shutDownFunc = PyObject_GetAttrString(module, "__moduleShutdown");
Shiboken::AutoDecRef args(PyTuple_New(1));
PyTuple_SET_ITEM(args, 0, shutDownFunc);
Shiboken::AutoDecRef retval(PyObject_Call(regFunc, args, 0));
@@ -1080,9 +1074,9 @@
<inject-code class="native" position="beginning">
// Define a global variable to handle qInstallMessageHandler callback
- static PyObject* qtmsghandler = 0;
+ static PyObject *qtmsghandler = nullptr;
- static void msgHandlerCallback(QtMsgType type, const QMessageLogContext &amp; ctx, const QString &amp;msg)
+ static void msgHandlerCallback(QtMsgType type, const QMessageLogContext &amp;ctx, const QString &amp;msg)
{
Shiboken::GilState state;
Shiboken::AutoDecRef arglist(PyTuple_New(3));
@@ -1149,7 +1143,7 @@
</add-function>
<inject-code class="native" position="beginning">
namespace PySide {
- template&lt;&gt; inline uint hash(const QLine&amp; v) {
+ template&lt;&gt; inline uint hash(const QLine &amp;v) {
return qHash(qMakePair(qMakePair(v.x1(), v.y1()), qMakePair(v.x2(), v.y2())));
}
};
@@ -1217,7 +1211,7 @@
<replace-type modified-type="PyObject" />
</modify-argument>
<inject-code>
- const void* d = %CPPSELF.%FUNCTION_NAME();
+ const void *d = %CPPSELF.%FUNCTION_NAME();
if (d) {
%PYARG_0 = Shiboken::Buffer::newObject(d, %CPPSELF.size());
} else {
@@ -1227,8 +1221,8 @@
</inject-code>
</modify-function>
<template name="QResource_registerResource">
- uchar* ptr = (uchar*) Shiboken::Buffer::getPointer(%PYARG_1);
- %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(const_cast&lt;const uchar*>(ptr), %2);
+ uchar *ptr = reinterpret_cast&lt;uchar*&gt;(Shiboken::Buffer::getPointer(%PYARG_1));
+ %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(const_cast&lt;const uchar*&gt;(ptr), %2);
%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
</template>
@@ -1261,7 +1255,7 @@
(PyDateTimeAPI = (PyDateTime_CAPI*) PyCObject_Import((char*)"datetime", \
(char*)"datetime_CAPI"))
#endif
- static bool PyDateTime_ImportAndCheck(PyObject* pyIn) {
+ static bool PyDateTime_ImportAndCheck(PyObject *pyIn) {
if (!PyDateTimeAPI) PySideDateTime_IMPORT;
return $DATETIMETYPE_Check(pyIn);
}
@@ -1307,7 +1301,8 @@
</add-function>
<add-function signature="toPython()" return-type="PyObject">
<inject-code class="target" position="beginning">
- if (!PyDateTimeAPI) PySideDateTime_IMPORT;
+ if (!PyDateTimeAPI)
+ PySideDateTime_IMPORT;
%PYARG_0 = PyDate_FromDate(%CPPSELF.year(), %CPPSELF.month(), %CPPSELF.day());
</inject-code>
</add-function>
@@ -1455,7 +1450,7 @@
</add-function>
<inject-code class="native" position="beginning">
namespace PySide {
- template&lt;&gt; inline uint hash(const QPoint&amp; v) {
+ template&lt;&gt; inline uint hash(const QPoint &amp;v) {
return qHash(qMakePair(v.x(), v.y()));
}
};
@@ -1527,7 +1522,7 @@
</add-function>
<inject-code class="native" position="beginning">
namespace PySide {
- template&lt;&gt; inline uint hash(const QRect&amp; v) {
+ template&lt;&gt; inline uint hash(const QRect &amp;v) {
return qHash(qMakePair(qMakePair(v.x(), v.y()), qMakePair(v.width(), v.height())));
}
};
@@ -1665,7 +1660,7 @@
</add-function>
<inject-code class="native" position="beginning">
namespace PySide {
- template&lt;&gt; inline uint hash(const QSize&amp; v) {
+ template&lt;&gt; inline uint hash(const QSize &amp;v) {
return qHash(qMakePair(v.width(), v.height()));
}
};
@@ -1762,7 +1757,8 @@
</add-function>
<add-function signature="toPython()" return-type="PyObject">
<inject-code class="target" position="beginning">
- if (!PyDateTimeAPI) PySideDateTime_IMPORT;
+ if (!PyDateTimeAPI)
+ PySideDateTime_IMPORT;
%PYARG_0 = PyTime_FromTime(%CPPSELF.hour(), %CPPSELF.minute(), %CPPSELF.second(), %CPPSELF.msec()*1000);
</inject-code>
</add-function>
@@ -1967,8 +1963,8 @@
</add-function>
<add-function signature="__setitem__">
<inject-code class="target" position="beginning">
- PyObject* args = Py_BuildValue("(iiO)", _i, 1, _value);
- PyObject* result = Sbk_QBitArrayFunc_setBit(self, args);
+ PyObject *args = Py_BuildValue("(iiO)", _i, 1, _value);
+ PyObject *result = Sbk_QBitArrayFunc_setBit(self, args);
Py_DECREF(args);
Py_XDECREF(result);
return !result ? -1 : 0;
@@ -2267,7 +2263,7 @@
<inject-code class="native" file="glue/qobject_findchild.cpp"/>
<add-function signature="findChild(PyTypeObject*, const QString&amp;)" return-type="PyObject*">
<inject-code class="target" position="beginning">
- QObject* child = _findChildHelper(%CPPSELF, %2, (PyTypeObject*)%PYARG_1);
+ QObject *child = _findChildHelper(%CPPSELF, %2, (PyTypeObject*)%PYARG_1);
%PYARG_0 = %CONVERTTOPYTHON[QObject*](child);
</inject-code>
<modify-argument index="return">
@@ -2330,7 +2326,7 @@
// Avoid return +1 because SignalManager connect to "destroyed()" signal to control object timelife
int ret = %CPPSELF.%FUNCTION_NAME(%1);
if (ret > 0 &amp;&amp; ((strcmp(%1, SIGNAL(destroyed())) == 0) || (strcmp(%1, SIGNAL(destroyed(QObject*))) == 0)))
- ret -= PySide::SignalManager::instance().countConnectionsWith(%CPPSELF);
+ ret -= PySide::SignalManager::instance().countConnectionsWith(%CPPSELF);
%PYARG_0 = %CONVERTTOPYTHON[int](ret);
</inject-code>
@@ -2586,10 +2582,10 @@
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
- QByteArray b(((PyObject*)%PYSELF)->ob_type->tp_name);
- PyObject* aux = Shiboken::String::fromStringAndSize(%CPPSELF.constData(), %CPPSELF.size());
+ QByteArray b((reinterpret_cast&lt;PyObject*&gt;(%PYSELF))->ob_type->tp_name);
+ PyObject *aux = Shiboken::String::fromStringAndSize(%CPPSELF.constData(), %CPPSELF.size());
if (PyUnicode_CheckExact(aux)) {
- PyObject* tmp = PyUnicode_AsASCIIString(aux);
+ PyObject *tmp = PyUnicode_AsASCIIString(aux);
Py_DECREF(aux);
aux = tmp;
}
@@ -2800,8 +2796,8 @@
<add-function signature="__setitem__">
<inject-code class="target" position="beginning">
%CPPSELF.remove(_i, 1);
- PyObject* args = Py_BuildValue("(nO)", _i, _value);
- PyObject* result = Sbk_QByteArrayFunc_insert(self, args);
+ PyObject *args = Py_BuildValue("(nO)", _i, _value);
+ PyObject *result = Sbk_QByteArrayFunc_insert(self, args);
Py_DECREF(args);
Py_XDECREF(result);
return !result ? -1 : 0;
@@ -2848,7 +2844,7 @@
<replace-type modified-type="PyBuffer"/>
</modify-argument>
<inject-code>
- uchar* ptr = (uchar*) Shiboken::Buffer::getPointer(%PYARG_1);
+ uchar *ptr = reinterpret_cast&lt;uchar*&gt;(Shiboken::Buffer::getPointer(%PYARG_1));
%RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(ptr);
%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
</inject-code>
@@ -3089,7 +3085,7 @@
</modify-argument>
<inject-code>
Py_ssize_t size;
- uchar* ptr = (uchar*) Shiboken::Buffer::getPointer(%PYARG_1, &amp;size);
+ uchar *ptr = reinterpret_cast&lt;uchar*&gt;(Shiboken::Buffer::getPointer(%PYARG_1, &amp;size));
%RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(const_cast&lt;const uchar*>(ptr), size);
%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
</inject-code>
@@ -3116,14 +3112,14 @@
// %FUNCTION_NAME() - disable generation of c++ function call
(void) %2; // remove warning about unused variable
Shiboken::AutoDecRef emptyTuple(PyTuple_New(0));
- PyObject* pyTimer = Shiboken::SbkType&lt;QTimer>()->tp_new(Shiboken::SbkType&lt;QTimer>(), emptyTuple, 0);
+ PyObject *pyTimer = Shiboken::SbkType&lt;QTimer>()->tp_new(Shiboken::SbkType&lt;QTimer>(), emptyTuple, 0);
Shiboken::SbkType&lt;QTimer>()->tp_init(pyTimer, emptyTuple, 0);
QTimer* timer = %CONVERTTOCPP[QTimer*](pyTimer);
Shiboken::AutoDecRef result(
PyObject_CallMethod(pyTimer,
- const_cast&lt;char*>("connect"),
- const_cast&lt;char*>("OsOs"),
+ const_cast&lt;char*&gt;("connect"),
+ const_cast&lt;char*&gt;("OsOs"),
pyTimer,
SIGNAL(timeout()),
%PYARG_2,
@@ -3146,12 +3142,12 @@
timer->setSingleShot(true);
if (PyObject_TypeCheck(%2, &amp;PySideSignalInstanceType)) {
- PySideSignalInstance* signalInstance = reinterpret_cast&lt;PySideSignalInstance*&gt;(%2);
+ PySideSignalInstance *signalInstance = reinterpret_cast&lt;PySideSignalInstance*&gt;(%2);
Shiboken::AutoDecRef signalSignature(Shiboken::String::fromFormat("2%s", PySide::Signal::getSignature(signalInstance)));
Shiboken::AutoDecRef result(
PyObject_CallMethod(pyTimer,
- const_cast&lt;char*>("connect"),
- const_cast&lt;char*>("OsOO"),
+ const_cast&lt;char*&gt;("connect"),
+ const_cast&lt;char*&gt;("OsOO"),
pyTimer,
SIGNAL(timeout()),
PySide::Signal::getObject(signalInstance),
@@ -3160,8 +3156,8 @@
} else {
Shiboken::AutoDecRef result(
PyObject_CallMethod(pyTimer,
- const_cast&lt;char*>("connect"),
- const_cast&lt;char*>("OsO"),
+ const_cast&lt;char*&gt;("connect"),
+ const_cast&lt;char*&gt;("OsO"),
pyTimer,
SIGNAL(timeout()),
%PYARG_2)
@@ -3211,7 +3207,7 @@
<inject-code>
long result;
#ifdef WIN32
- _PROCESS_INFORMATION* procInfo = %CPPSELF.%FUNCTION_NAME();
+ _PROCESS_INFORMATION *procInfo = %CPPSELF.%FUNCTION_NAME();
result = procInfo ? procInfo->dwProcessId : 0;
#else
result = %CPPSELF.%FUNCTION_NAME();
@@ -3661,7 +3657,7 @@
<modify-argument index="return">
<!--<replace-type modified-type="QString" />-->
<conversion-rule class="target">
- QString&amp; res = *%0;
+ QString &amp;res = *%0;
%PYARG_0 = %CONVERTTOPYTHON[QString](res);
</conversion-rule>
</modify-argument>
@@ -3895,9 +3891,9 @@
<modify-function signature="clear()" >
<inject-code class="target" position="beginning">
- for(int counter = 0; counter &lt; %CPPSELF.animationCount(); ++counter ) {
- QAbstractAnimation* animation = %CPPSELF.animationAt(counter);
- PyObject* obj = %CONVERTTOPYTHON[QAbstractAnimation*](animation);
+ for (int counter = 0; counter &lt; %CPPSELF.animationCount(); ++counter ) {
+ QAbstractAnimation *animation = %CPPSELF.animationAt(counter);
+ PyObject *obj = %CONVERTTOPYTHON[QAbstractAnimation*](animation);
Shiboken::Object::setParent(NULL, obj);
Py_DECREF(obj);
}
@@ -4021,11 +4017,11 @@ s1.addTransition(button.clicked, s1h)&lt;/code>
</modify-argument>
<inject-code>
if (PyObject_TypeCheck(%1, &amp;PySideSignalInstanceType)) {
- PyObject* dataSource = PySide::Signal::getObject((PySideSignalInstance*) %PYARG_1);
+ PyObject *dataSource = PySide::Signal::getObject((PySideSignalInstance*)%PYARG_1);
Shiboken::AutoDecRef obType(PyObject_Type(dataSource));
QObject* sender = %CONVERTTOCPP[QObject*](dataSource);
if (sender) {
- const char* dataSignature = PySide::Signal::getSignature((PySideSignalInstance*) %PYARG_1);
+ const char *dataSignature = PySide::Signal::getSignature((PySideSignalInstance*)%PYARG_1);
QByteArray signature(dataSignature); // Append SIGNAL flag (2)
%0 = new QSignalTransitionWrapper(sender, "2" + signature, %2);
}
@@ -4050,7 +4046,7 @@ s1.addTransition(button.clicked, s1h)&lt;/code>
<inject-code class="target" position="beginning">
QString signalName(%2);
if (PySide::SignalManager::registerMetaMethod(%1, signalName.mid(1).toLatin1().data(), QMetaMethod::Signal)) {
- QSignalTransition* %0 = %CPPSELF->addTransition(%1, %2, %3);
+ QSignalTransition *%0 = %CPPSELF->addTransition(%1, %2, %3);
%PYARG_0 = %CONVERTTOPYTHON[QSignalTransition*](%0);
} else {
Py_INCREF(Py_None);
@@ -4078,9 +4074,9 @@ s1.addTransition(button.clicked, s1h)&lt;/code>
// http://bugs.openbossa.org/show_bug.cgi?id=362
if (!PyObject_TypeCheck(%1, &amp;PySideSignalInstanceType))
goto Sbk_%TYPEFunc_%FUNCTION_NAME_TypeError;
- PySideSignalInstance* signalInstance = reinterpret_cast&lt;PySideSignalInstance*&gt;(%1);
+ PySideSignalInstance *signalInstance = reinterpret_cast&lt;PySideSignalInstance*&gt;(%1);
QObject* sender = %CONVERTTOCPP[QObject*](PySide::Signal::getObject(signalInstance));
- QSignalTransition* %0 = %CPPSELF->%FUNCTION_NAME(sender, PySide::Signal::getSignature(signalInstance), %2);
+ QSignalTransition *%0 = %CPPSELF->%FUNCTION_NAME(sender, PySide::Signal::getSignature(signalInstance), %2);
%PYARG_0 = %CONVERTTOPYTHON[QSignalTransition*](%0);
</inject-code>
</add-function>
@@ -4113,7 +4109,7 @@ s1.addTransition(button.clicked, s1h)&lt;/code>
<add-function signature="configuration()" return-type="list of QAbstractState" >
<inject-code class="target" position="beginning">
%PYARG_0 = PySet_New(0);
- foreach(QAbstractState* abs_state, %CPPSELF.configuration()) {
+ foreach(QAbstractState *abs_state, %CPPSELF.configuration()) {
Shiboken::AutoDecRef obj(%CONVERTTOPYTHON[QAbstractState*](abs_state));
Shiboken::Object::setParent(self, obj);
PySet_Add(%PYARG_0, obj);
@@ -4126,7 +4122,7 @@ s1.addTransition(button.clicked, s1h)&lt;/code>
<add-function signature="defaultAnimations()" return-type="list of QAbstractAnimation" >
<inject-code class="target" position="beginning">
%PYARG_0 = PyList_New(0);
- foreach(QAbstractAnimation* abs_anim, %CPPSELF.defaultAnimations()) {
+ foreach(QAbstractAnimation *abs_anim, %CPPSELF.defaultAnimations()) {
Shiboken::AutoDecRef obj(%CONVERTTOPYTHON[QAbstractAnimation*](abs_anim));
Shiboken::Object::setParent(self, obj);
PyList_Append(%PYARG_0, obj);
@@ -4200,17 +4196,17 @@ s1.addTransition(button.clicked, s1h)&lt;/code>
</inject-code>
<add-function signature="qRegisterResourceData(int, PyBytes, PyBytes, PyBytes)" return-type="bool">
<inject-code class="target" position="beginning">
- %RETURN_TYPE %0 = %FUNCTION_NAME(%1, (uchar*)PyBytes_AS_STRING(%PYARG_2),
- (uchar*)PyBytes_AS_STRING(%PYARG_3),
- (uchar*)PyBytes_AS_STRING(%PYARG_4));
+ %RETURN_TYPE %0 = %FUNCTION_NAME(%1, reinterpret_cast&lt;uchar*&gt;(PyBytes_AS_STRING(%PYARG_2)),
+ reinterpret_cast&lt;uchar*&gt;(PyBytes_AS_STRING(%PYARG_3)),
+ reinterpret_cast&lt;uchar*&gt;(PyBytes_AS_STRING(%PYARG_4)));
%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
</inject-code>
</add-function>
<add-function signature="qUnregisterResourceData(int, PyBytes, PyBytes, PyBytes)" return-type="bool">
<inject-code class="target" position="beginning">
- %RETURN_TYPE %0 = %FUNCTION_NAME(%1, (uchar*)PyBytes_AS_STRING(%PYARG_2),
- (uchar*)PyBytes_AS_STRING(%PYARG_3),
- (uchar*)PyBytes_AS_STRING(%PYARG_4));
+ %RETURN_TYPE %0 = %FUNCTION_NAME(%1, reinterpret_cast&lt;uchar*&gt;(PyBytes_AS_STRING(%PYARG_2)),
+ reinterpret_cast&lt;uchar*&gt;(PyBytes_AS_STRING(%PYARG_3)),
+ reinterpret_cast&lt;uchar*&gt;(PyBytes_AS_STRING(%PYARG_4)));
%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
</inject-code>
</add-function>