Fix bug #788 - "QIPv6Address.__getitem__ is missing."
Signed-off-by: Paulo Alcantara <paulo.alcantara@openbossa.org>
Reviewer: Renato Araujo <renato.araujo@openbossa.org>
Marcelo Lira <marcelo.lira@openbossa.org>
This commit is contained in:
parent
8d6761b93d
commit
5a80d6418b
1 changed files with 38 additions and 5 deletions
|
|
@ -239,12 +239,45 @@
|
||||||
<enum-type name="PermissionSpec"/>
|
<enum-type name="PermissionSpec"/>
|
||||||
</value-type>
|
</value-type>
|
||||||
|
|
||||||
<rejection class="QIPv6Address" field-name="c"/>
|
|
||||||
<value-type name="QIPv6Address">
|
<value-type name="QIPv6Address">
|
||||||
<!-- ### See bug 788 -->
|
<add-function signature="__len__">
|
||||||
<modify-function signature="operator[](int)const" remove="all" />
|
<inject-code class="target" position="beginning">
|
||||||
<modify-function signature="operator[](int)" remove="all" />
|
return 16;
|
||||||
<!-- ### -->
|
</inject-code>
|
||||||
|
</add-function>
|
||||||
|
<add-function signature="__getitem__">
|
||||||
|
<inject-code class="target" position="beginning">
|
||||||
|
if (_i >= 16) {
|
||||||
|
PyErr_SetString(PyExc_IndexError, "index out of bounds");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_i < 0)
|
||||||
|
_i = 16 - abs(_i);
|
||||||
|
|
||||||
|
return %CONVERTTOPYTHON[uint](%CPPSELF->c[_i]);
|
||||||
|
</inject-code>
|
||||||
|
</add-function>
|
||||||
|
<add-function signature="__len__">
|
||||||
|
<inject-code class="target" position="beginning">
|
||||||
|
return 16;
|
||||||
|
</inject-code>
|
||||||
|
</add-function>
|
||||||
|
<add-function signature="__setitem__">
|
||||||
|
<inject-code class="target" position="beginning">
|
||||||
|
if (_i >= 16) {
|
||||||
|
PyErr_SetString(PyExc_IndexError, "index out of bounds");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_i < 0)
|
||||||
|
_i = 16 - abs(_i);
|
||||||
|
|
||||||
|
%CPPSELF->c[_i] = %CONVERTTOCPP[quint8](_value);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
</inject-code>
|
||||||
|
</add-function>
|
||||||
</value-type>
|
</value-type>
|
||||||
|
|
||||||
<value-type name="QAuthenticator" />
|
<value-type name="QAuthenticator" />
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue