Implemented fuction __repr__ for base types.

Fixes bug #593

Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
          Marcelo Lira <marcelo.lira@openbossa.org>
This commit is contained in:
Renato Araujo Oliveira Filho 2011-01-26 15:21:37 -03:00
commit 1a65a287fb
3 changed files with 279 additions and 2 deletions

View file

@ -430,6 +430,15 @@
</extra-includes> </extra-includes>
</object-type> </object-type>
<value-type name="QLine" hash-function="PySide::hash"> <value-type name="QLine" hash-function="PySide::hash">
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
<replace from="%REPR_FORMAT" to="%i, %i, %i, %i" />
<replace from="%REPR_ARGS" to="%CPPSELF.x1(), %CPPSELF.y1(), %CPPSELF.x2(), %CPPSELF.y2()" />
</insert-template>
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code"> <insert-template name="reduce_code">
@ -501,6 +510,15 @@
<include file-name="datetime.h" location="global"/> <include file-name="datetime.h" location="global"/>
</extra-includes> </extra-includes>
<enum-type name="MonthNameType"/> <enum-type name="MonthNameType"/>
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
<replace from="%REPR_FORMAT" to="%i, %i, %i" />
<replace from="%REPR_ARGS" to="%CPPSELF.year(), %CPPSELF.month(), %CPPSELF.day()" />
</insert-template>
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code"> <insert-template name="reduce_code">
@ -566,6 +584,15 @@
%0 = new %TYPE(date, time); %0 = new %TYPE(date, time);
</inject-code> </inject-code>
</add-function> </add-function>
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
<replace from="%REPR_FORMAT" to="%i, %i, %i, %i, %i, %i, %i, %i" />
<replace from="%REPR_ARGS" to="%CPPSELF.date().year(), %CPPSELF.date().month(), %CPPSELF.date().day(), %CPPSELF.time().hour(), %CPPSELF.time().minute(), %CPPSELF.time().second(), %CPPSELF.time().msec(), (int)%CPPSELF.timeSpec()" />
</insert-template>
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code"> <insert-template name="reduce_code">
@ -590,6 +617,15 @@
</value-type> </value-type>
<value-type name="QPoint" hash-function="PySide::hash"> <value-type name="QPoint" hash-function="PySide::hash">
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
<replace from="%REPR_FORMAT" to="%i, %i" />
<replace from="%REPR_ARGS" to="%CPPSELF.x(), %CPPSELF.y()" />
</insert-template>
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code"> <insert-template name="reduce_code">
@ -621,6 +657,14 @@
<modify-function signature="ry()" remove="all"/> <modify-function signature="ry()" remove="all"/>
</value-type> </value-type>
<value-type name="QRect" hash-function="PySide::hash"> <value-type name="QRect" hash-function="PySide::hash">
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
<replace from="%REPR_FORMAT" to="%i, %i, %i, %i" />
<replace from="%REPR_ARGS" to="%CPPSELF.x(), %CPPSELF.y(), %CPPSELF.width(), %CPPSELF.height()" />
</insert-template>
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code"> <insert-template name="reduce_code">
@ -682,6 +726,15 @@
</modify-function> </modify-function>
</value-type> </value-type>
<value-type name="QRectF"> <value-type name="QRectF">
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
<replace from="%REPR_FORMAT" to="%f, %f, %f, %f" />
<replace from="%REPR_ARGS" to="%CPPSELF.x(), %CPPSELF.y(), %CPPSELF.width(), %CPPSELF.height()" />
</insert-template>
</inject-code>
</add-function>
<!-- <!--
FIXME These functions return qreal. Will convert to double (format FIXME These functions return qreal. Will convert to double (format
string) mess things up in other architectures? string) mess things up in other architectures?
@ -740,6 +793,15 @@
</modify-function> </modify-function>
</value-type> </value-type>
<value-type name="QSize" hash-function="PySide::hash"> <value-type name="QSize" hash-function="PySide::hash">
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
<replace from="%REPR_FORMAT" to="%i, %i" />
<replace from="%REPR_ARGS" to="%CPPSELF.width(), %CPPSELF.height()" />
</insert-template>
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code"> <insert-template name="reduce_code">
@ -772,6 +834,14 @@
</value-type> </value-type>
<value-type name="QTime" hash-function="PySide::hash"> <value-type name="QTime" hash-function="PySide::hash">
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
<replace from="%REPR_FORMAT" to="%i, %i, %i, %i" />
<replace from="%REPR_ARGS" to="%CPPSELF.hour(), %CPPSELF.minute(), %CPPSELF.second(), %CPPSELF.msec()" />
</insert-template>
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code"> <insert-template name="reduce_code">
@ -792,6 +862,14 @@
<value-type name="QUuid"> <value-type name="QUuid">
<enum-type name="Variant"/> <enum-type name="Variant"/>
<enum-type name="Version"/> <enum-type name="Version"/>
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
<replace from="%REPR_FORMAT" to="'%s'" />
<replace from="%REPR_ARGS" to="qPrintable(%CPPSELF.toString())" />
</insert-template>
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code"> <insert-template name="reduce_code">
@ -1221,6 +1299,15 @@
<extra-includes> <extra-includes>
<include file-name="QStringList" location="global"/> <include file-name="QStringList" location="global"/>
</extra-includes> </extra-includes>
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
<replace from="%REPR_FORMAT" to="'%s'" />
<replace from="%REPR_ARGS" to="qPrintable(%CPPSELF.toString())" />
</insert-template>
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code"> <insert-template name="reduce_code">
@ -1236,6 +1323,15 @@
<extra-includes> <extra-includes>
<include file-name="QStringList" location="global"/> <include file-name="QStringList" location="global"/>
</extra-includes> </extra-includes>
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
<replace from="%REPR_FORMAT" to="'%s', %i, %i" />
<replace from="%REPR_ARGS" to="qPrintable(%CPPSELF.pattern()), (int)%CPPSELF.caseSensitivity(), (int)%CPPSELF.patternSyntax()" />
</insert-template>
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code"> <insert-template name="reduce_code">
@ -1298,6 +1394,17 @@
<extra-includes> <extra-includes>
<include file-name="QNoImplicitBoolCast" location="global"/> <include file-name="QNoImplicitBoolCast" location="global"/>
</extra-includes> </extra-includes>
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
PyObject* str = PyString_FromStringAndSize(%CPPSELF.constData(), %CPPSELF.size());
<insert-template name="repr_code">
<replace from="%REPR_FORMAT" to="'%s'" />
<replace from="%REPR_ARGS" to="PyString_AS_STRING(str)" />
</insert-template>
Py_DECREF(str);
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code"> <insert-template name="reduce_code">

View file

@ -175,11 +175,22 @@
<rejection class="*" enum-name="enum_1"/> <rejection class="*" enum-name="enum_1"/>
<value-type name="QTransform"> <value-type name="QTransform">
<enum-type name="TransformationType"/> <enum-type name="TransformationType"/>
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
<replace from="%REPR_FORMAT" to="%f, %f, %f, %f, %f, %f, %f, %f, %f" />
<replace from="%REPR_ARGS"
to="%CPPSELF.m11(), %CPPSELF.m12(), %CPPSELF.m13(), %CPPSELF.m21(), %CPPSELF.m22(), %CPPSELF.m23(), %CPPSELF.m31(), %CPPSELF.m32(), %CPPSELF.m33()" />
</insert-template>
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code"> <insert-template name="reduce_code">
<replace from="%REDUCE_FORMAT" to="ddddddddd" /> <replace from="%REDUCE_FORMAT" to="ddddddddd" />
<replace from="%REDUCE_ARGS" to="%CPPSELF.m11(), %CPPSELF.m12(), %CPPSELF.m13(), %CPPSELF.m21(), %CPPSELF.m22(), %CPPSELF.m23(), %CPPSELF.m31(), %CPPSELF.m32(), %CPPSELF.m33()" /> <replace from="%REDUCE_ARGS"
to="%CPPSELF.m11(), %CPPSELF.m12(), %CPPSELF.m13(), %CPPSELF.m21(), %CPPSELF.m22(), %CPPSELF.m23(), %CPPSELF.m31(), %CPPSELF.m32(), %CPPSELF.m33()" />
</insert-template> </insert-template>
</inject-code> </inject-code>
</add-function> </add-function>
@ -420,6 +431,16 @@
<enum-type name="SequenceFormat"/> <enum-type name="SequenceFormat"/>
<enum-type name="SequenceMatch"/> <enum-type name="SequenceMatch"/>
<enum-type name="StandardKey"/> <enum-type name="StandardKey"/>
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
<replace from="%REPR_FORMAT" to="%i, %i, %i, %i" />
<replace from="%REPR_ARGS"
to="(*%CPPSELF)[0], (*%CPPSELF)[1], (*%CPPSELF)[2], (*%CPPSELF)[3]" />
</insert-template>
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code"> <insert-template name="reduce_code">
@ -512,7 +533,6 @@
</inject-code> </inject-code>
</add-function> </add-function>
<modify-function signature="QPolygon(int, const int *)" remove="all"/> <modify-function signature="QPolygon(int, const int *)" remove="all"/>
<modify-function signature="operator+=(QVector)" remove="all"/> <modify-function signature="operator+=(QVector)" remove="all"/>
<modify-function signature="operator&lt;&lt;(QPoint)" remove="all"/> <modify-function signature="operator&lt;&lt;(QPoint)" remove="all"/>
@ -634,6 +654,16 @@
<extra-includes> <extra-includes>
<include file-name="QPainterPath" location="global"/> <include file-name="QPainterPath" location="global"/>
</extra-includes> </extra-includes>
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
<replace from="%REPR_FORMAT" to="%f, %f, %f, %f, %f, %f" />
<replace from="%REPR_ARGS"
to="%CPPSELF.m11(), %CPPSELF.m12(), %CPPSELF.m21(), %CPPSELF.m22(), %CPPSELF.dx(), %CPPSELF.dy()" />
</insert-template>
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code"> <insert-template name="reduce_code">
@ -5148,6 +5178,15 @@
</object-type> </object-type>
<value-type name="QMatrix2x2"> <value-type name="QMatrix2x2">
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code_matrix">
<replace from="%MATRIX_SIZE" to="4" />
<replace from="%MATRIX_TYPE" to="qreal" />
</insert-template>
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code_matrix"> <insert-template name="reduce_code_matrix">
@ -5209,6 +5248,15 @@
</value-type> </value-type>
<value-type name="QMatrix2x3"> <value-type name="QMatrix2x3">
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code_matrix">
<replace from="%MATRIX_SIZE" to="6" />
<replace from="%MATRIX_TYPE" to="qreal" />
</insert-template>
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code_matrix"> <insert-template name="reduce_code_matrix">
@ -5270,6 +5318,15 @@
</value-type> </value-type>
<value-type name="QMatrix2x4"> <value-type name="QMatrix2x4">
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code_matrix">
<replace from="%MATRIX_SIZE" to="8" />
<replace from="%MATRIX_TYPE" to="qreal" />
</insert-template>
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code_matrix"> <insert-template name="reduce_code_matrix">
@ -5331,6 +5388,15 @@
</value-type> </value-type>
<value-type name="QMatrix3x2"> <value-type name="QMatrix3x2">
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code_matrix">
<replace from="%MATRIX_SIZE" to="6" />
<replace from="%MATRIX_TYPE" to="qreal" />
</insert-template>
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code_matrix"> <insert-template name="reduce_code_matrix">
@ -5392,6 +5458,15 @@
</value-type> </value-type>
<value-type name="QMatrix3x3"> <value-type name="QMatrix3x3">
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code_matrix">
<replace from="%MATRIX_SIZE" to="9" />
<replace from="%MATRIX_TYPE" to="qreal" />
</insert-template>
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code_matrix"> <insert-template name="reduce_code_matrix">
@ -5453,6 +5528,15 @@
</value-type> </value-type>
<value-type name="QMatrix3x4"> <value-type name="QMatrix3x4">
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code_matrix">
<replace from="%MATRIX_SIZE" to="12" />
<replace from="%MATRIX_TYPE" to="qreal" />
</insert-template>
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code_matrix"> <insert-template name="reduce_code_matrix">
@ -5514,6 +5598,15 @@
</value-type> </value-type>
<value-type name="QMatrix4x2"> <value-type name="QMatrix4x2">
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code_matrix">
<replace from="%MATRIX_SIZE" to="8" />
<replace from="%MATRIX_TYPE" to="qreal" />
</insert-template>
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code_matrix"> <insert-template name="reduce_code_matrix">
@ -5575,6 +5668,15 @@
</value-type> </value-type>
<value-type name="QMatrix4x3"> <value-type name="QMatrix4x3">
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code_matrix">
<replace from="%MATRIX_SIZE" to="12" />
<replace from="%MATRIX_TYPE" to="qreal" />
</insert-template>
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code_matrix"> <insert-template name="reduce_code_matrix">
@ -5637,6 +5739,15 @@
<value-type name="QMatrix4x4"> <value-type name="QMatrix4x4">
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code_matrix">
<replace from="%MATRIX_SIZE" to="16" />
<replace from="%MATRIX_TYPE" to="qreal" />
</insert-template>
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code_matrix"> <insert-template name="reduce_code_matrix">
@ -5732,6 +5843,15 @@
<enum-type name="ChangeFlag" flags="QPinchGesture::ChangeFlags"/> <enum-type name="ChangeFlag" flags="QPinchGesture::ChangeFlags"/>
</object-type> </object-type>
<value-type name="QQuaternion"> <value-type name="QQuaternion">
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
<replace from="%REPR_FORMAT" to="%f, %f, %f, %f" />
<replace from="%REPR_ARGS" to="%CPPSELF.scalar(), %CPPSELF.x(), %CPPSELF.y(), %CPPSELF.z()" />
</insert-template>
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code"> <insert-template name="reduce_code">
@ -5766,6 +5886,15 @@
</object-type> </object-type>
<value-type name="QVector2D"> <value-type name="QVector2D">
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
<replace from="%REPR_FORMAT" to="%f, %f" />
<replace from="%REPR_ARGS" to="%CPPSELF.x(), %CPPSELF.y()" />
</insert-template>
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code"> <insert-template name="reduce_code">
@ -5779,6 +5908,15 @@
<extra-includes> <extra-includes>
<include file-name="QMatrix4x4" location="global"/> <include file-name="QMatrix4x4" location="global"/>
</extra-includes> </extra-includes>
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
<replace from="%REPR_FORMAT" to="%f, %f, %f" />
<replace from="%REPR_ARGS" to="%CPPSELF.x(), %CPPSELF.y(), %CPPSELF.z()" />
</insert-template>
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code"> <insert-template name="reduce_code">
@ -5792,6 +5930,15 @@
<extra-includes> <extra-includes>
<include file-name="QMatrix4x4" location="global"/> <include file-name="QMatrix4x4" location="global"/>
</extra-includes> </extra-includes>
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
<replace from="%REPR_FORMAT" to="%f, %f, %f, %f" />
<replace from="%REPR_ARGS" to="%CPPSELF.x(), %CPPSELF.y(), %CPPSELF.z(), %CPPSELF.w()" />
</insert-template>
</inject-code>
</add-function>
<add-function signature="__reduce__" return-type="PyObject*"> <add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
<insert-template name="reduce_code"> <insert-template name="reduce_code">

View file

@ -187,6 +187,29 @@
if (!Shiboken::Object::hasParentInfo(_pySelf)) if (!Shiboken::Object::hasParentInfo(_pySelf))
Shiboken::Object::setParent(%CONVERTTOPYTHON[QApplication*](qApp), %PYARG_0); Shiboken::Object::setParent(%CONVERTTOPYTHON[QApplication*](qApp), %PYARG_0);
</template> </template>
<!-- templates for __repr__ -->
<template name="repr_code">
QString format = QString().sprintf("%s(%REPR_FORMAT)", ((PyObject*)%PYSELF)->ob_type->tp_name, %REPR_ARGS);
%PYARG_0 = PyString_FromString(qPrintable(format));
</template>
<template name="repr_code_matrix">
QString format= QString("%1((").arg(((PyObject*)%PYSELF)->ob_type->tp_name);
QList&lt; %MATRIX_TYPE &gt; cppArgs;
%MATRIX_TYPE data[%MATRIX_SIZE];
%CPPSELF.copyDataTo(data);
int matrixSize = %MATRIX_SIZE;
for(int size=0; size &lt; matrixSize; size++) {
if (size > 0)
format += ", ";
format += QString::number(data[size]);
}
format += "))";
%PYARG_0 = PyString_FromString(qPrintable(format));
</template>
<!-- templates for __reduce__ --> <!-- templates for __reduce__ -->
<template name="reduce_code"> <template name="reduce_code">
%PYARG_0 = Py_BuildValue("(N(%REDUCE_FORMAT))", PyObject_Type(%PYSELF), %REDUCE_ARGS); %PYARG_0 = Py_BuildValue("(N(%REDUCE_FORMAT))", PyObject_Type(%PYSELF), %REDUCE_ARGS);