aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2011-05-31 12:29:52 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:54:26 -0300
commitf957a6f42d2abf5b33bf2bd9b525731c313cc668 (patch)
tree4e5a9eeae314ccce3d269fb625147ed831a3b44e
parentc0d6e44accb302ab31694a4efa0c18c13fc997dd (diff)
Moved internalPointer methods code injection into a code template.
-rw-r--r--PySide/QtCore/typesystem_core.xml10
-rw-r--r--PySide/typesystem_templates.xml6
2 files changed, 8 insertions, 8 deletions
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml
index 20946454a..8795cf5f8 100644
--- a/PySide/QtCore/typesystem_core.xml
+++ b/PySide/QtCore/typesystem_core.xml
@@ -985,10 +985,7 @@
<value-type name="QPersistentModelIndex">
<modify-function signature="internalPointer()const">
<inject-code class="target" position="beginning">
- %PYARG_0 = (PyObject*)%CPPSELF.%FUNCTION_NAME();
- if (!%PYARG_0)
- %PYARG_0 = Py_None;
- Py_XINCREF(%PYARG_0);
+ <insert-template name="return_internal_pointer" />
</inject-code>
</modify-function>
<modify-function signature="operator const QModelIndex&amp;()const">
@@ -2825,10 +2822,7 @@
<value-type name="QModelIndex">
<modify-function signature="internalPointer()const">
<inject-code class="target" position="beginning">
- %PYARG_0 = (PyObject*)%CPPSELF.%FUNCTION_NAME();
- if (!%PYARG_0)
- %PYARG_0 = Py_None;
- Py_XINCREF(%PYARG_0);
+ <insert-template name="return_internal_pointer" />
</inject-code>
</modify-function>
<modify-function signature="model()const">
diff --git a/PySide/typesystem_templates.xml b/PySide/typesystem_templates.xml
index 8a2628148..3a46c620f 100644
--- a/PySide/typesystem_templates.xml
+++ b/PySide/typesystem_templates.xml
@@ -272,6 +272,12 @@
%PYARG_0 = PyString_FromString(qPrintable(format));
</template>
+ <template name="return_internal_pointer">
+ %PYARG_0 = reinterpret_cast&lt;PyObject*>(%CPPSELF.%FUNCTION_NAME());
+ if (!%PYARG_0)
+ %PYARG_0 = Py_None;
+ Py_INCREF(%PYARG_0);
+ </template>
<!-- templates for __reduce__ -->
<template name="reduce_code">