Implemented support to pyton iterator in QTextFrame::iterator.
Fixes bug #688. Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Marcelo Lira <marcelo.lira@openbossa.org>
This commit is contained in:
parent
e3b24c2204
commit
ccf8ddf75b
2 changed files with 41 additions and 9 deletions
|
|
@ -509,25 +509,25 @@
|
||||||
The iterator methods (__iter__, next) replace this functionality. -->
|
The iterator methods (__iter__, next) replace this functionality. -->
|
||||||
<modify-function signature="operator++()" remove="all"/>
|
<modify-function signature="operator++()" remove="all"/>
|
||||||
<modify-function signature="operator--()" remove="all"/>
|
<modify-function signature="operator--()" remove="all"/>
|
||||||
<modify-function signature="operator++(int)" remove="all"/>
|
|
||||||
<modify-function signature="operator--(int)" remove="all"/>
|
|
||||||
<!-- ### -->
|
<!-- ### -->
|
||||||
<add-function signature="__iter__()" return-type="PyObject*">
|
<add-function signature="__iter__()" return-type="PyObject*">
|
||||||
<inject-code class="target" position="beginning">
|
<inject-code class="target" position="beginning">
|
||||||
Py_INCREF(%PYSELF);
|
<insert-template name="__iter__" />
|
||||||
%PYARG_0 = %PYSELF;
|
|
||||||
</inject-code>
|
</inject-code>
|
||||||
</add-function>
|
</add-function>
|
||||||
<add-function signature="__next__()" return-type="PyObject*">
|
<add-function signature="__next__()" return-type="PyObject*">
|
||||||
<inject-code class="target" position="beginning">
|
<inject-code class="target" position="beginning">
|
||||||
if (!%CPPSELF.atEnd())
|
<insert-template name="__next__">
|
||||||
%PYARG_0 = %CONVERTTOPYTHON[QTextBlock::iterator]((*%CPPSELF)++);
|
<replace from="%CPPSELF_TYPE" to="QTextBlock::iterator" />
|
||||||
|
</insert-template>
|
||||||
</inject-code>
|
</inject-code>
|
||||||
</add-function>
|
</add-function>
|
||||||
</value-type>
|
</value-type>
|
||||||
<add-function signature="__iter__()" return-type="PyObject*">
|
<add-function signature="__iter__()" return-type="PyObject*">
|
||||||
<inject-code class="target" position="beginning">
|
<inject-code class="target" position="beginning">
|
||||||
%PYARG_0 = %CONVERTTOPYTHON[QTextBlock::iterator](%CPPSELF.begin());
|
<insert-template name="__iter_parent__">
|
||||||
|
<replace from="%CPPSELF_TYPE" to="QTextBlock::iterator" />
|
||||||
|
</insert-template>
|
||||||
</inject-code>
|
</inject-code>
|
||||||
</add-function>
|
</add-function>
|
||||||
<modify-function signature="setUserData(QTextBlockUserData*)">
|
<modify-function signature="setUserData(QTextBlockUserData*)">
|
||||||
|
|
@ -3917,12 +3917,29 @@
|
||||||
<!-- ### These operators where removed because they don't make sense in Python.
|
<!-- ### These operators where removed because they don't make sense in Python.
|
||||||
Instead iterator methods (__iter__, next) should be implemented.
|
Instead iterator methods (__iter__, next) should be implemented.
|
||||||
See bug 688 -->
|
See bug 688 -->
|
||||||
<modify-function signature="operator++(int)" remove="all"/>
|
|
||||||
<modify-function signature="operator--(int)" remove="all"/>
|
|
||||||
<modify-function signature="operator++()" remove="all"/>
|
<modify-function signature="operator++()" remove="all"/>
|
||||||
<modify-function signature="operator--()" remove="all"/>
|
<modify-function signature="operator--()" remove="all"/>
|
||||||
<!-- ### -->
|
<!-- ### -->
|
||||||
|
<add-function signature="__iter__()" return-type="PyObject*">
|
||||||
|
<inject-code class="target" position="beginning">
|
||||||
|
<insert-template name="__iter__" />
|
||||||
|
</inject-code>
|
||||||
|
</add-function>
|
||||||
|
<add-function signature="__next__()" return-type="PyObject*">
|
||||||
|
<inject-code class="target" position="beginning">
|
||||||
|
<insert-template name="__next__">
|
||||||
|
<replace from="%CPPSELF_TYPE" to="QTextFrame::iterator" />
|
||||||
|
</insert-template>
|
||||||
|
</inject-code>
|
||||||
|
</add-function>
|
||||||
</value-type>
|
</value-type>
|
||||||
|
<add-function signature="__iter__()" return-type="PyObject*">
|
||||||
|
<inject-code class="target" position="beginning">
|
||||||
|
<insert-template name="__iter_parent__">
|
||||||
|
<replace from="%CPPSELF_TYPE" to="QTextFrame::iterator" />
|
||||||
|
</insert-template>
|
||||||
|
</inject-code>
|
||||||
|
</add-function>
|
||||||
</object-type>
|
</object-type>
|
||||||
<object-type name="QImageIOHandler">
|
<object-type name="QImageIOHandler">
|
||||||
<extra-includes>
|
<extra-includes>
|
||||||
|
|
|
||||||
|
|
@ -320,5 +320,20 @@
|
||||||
%PYARG_0 = %PYARG_#;
|
%PYARG_0 = %PYARG_#;
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<!-- Iterator -->
|
||||||
|
<template name="__iter__">
|
||||||
|
Py_INCREF(%PYSELF);
|
||||||
|
%PYARG_0 = %PYSELF;
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template name="__iter_parent__">
|
||||||
|
%PYARG_0 = %CONVERTTOPYTHON[%CPPSELF_TYPE](%CPPSELF.begin());
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template name="__next__">
|
||||||
|
if (!%CPPSELF.atEnd())
|
||||||
|
%PYARG_0 = %CONVERTTOPYTHON[%CPPSELF_TYPE]((*%CPPSELF)++);
|
||||||
|
</template>
|
||||||
|
|
||||||
</typesystem>
|
</typesystem>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue