summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaulo Alcantara <paulo.alcantara@openbossa.org>2011-04-25 15:46:19 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:54:16 -0300
commit5a80d6418bf2cbe5bb14819db5d022d52bec0d75 (patch)
tree15dad57b1b30e0dc646e168272079d531e5df8b3
parent8d6761b93d82f59b8a75af59043eecbbf16ec9c6 (diff)
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>
-rw-r--r--PySide/QtNetwork/typesystem_network.xml43
1 files changed, 38 insertions, 5 deletions
diff --git a/PySide/QtNetwork/typesystem_network.xml b/PySide/QtNetwork/typesystem_network.xml
index f261f3a4..fd47356f 100644
--- a/PySide/QtNetwork/typesystem_network.xml
+++ b/PySide/QtNetwork/typesystem_network.xml
@@ -239,12 +239,45 @@
<enum-type name="PermissionSpec"/>
</value-type>
- <rejection class="QIPv6Address" field-name="c"/>
<value-type name="QIPv6Address">
- <!-- ### See bug 788 -->
- <modify-function signature="operator[](int)const" remove="all" />
- <modify-function signature="operator[](int)" remove="all" />
- <!-- ### -->
+ <add-function signature="__len__">
+ <inject-code class="target" position="beginning">
+ 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 &lt; 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 &lt; 0)
+ _i = 16 - abs(_i);
+
+ %CPPSELF->c[_i] = %CONVERTTOCPP[quint8](_value);
+
+ return 0;
+ </inject-code>
+ </add-function>
</value-type>
<value-type name="QAuthenticator" />