aboutsummaryrefslogtreecommitdiffstats
path: root/PySide
diff options
context:
space:
mode:
authorHugo Lima <hugo.lima@openbossa.org>2009-11-18 17:20:59 -0200
committerHugo Lima <hugo.lima@openbossa.org>2009-11-18 17:20:59 -0200
commit9ff5512a8b4577e944cbf8e7d13eacfca7f3624c (patch)
tree65b04053960d9d9d7c8136ee5f31ca97115f7811 /PySide
parent5521bb2fd048be3cd74c427f7965926b816f82d8 (diff)
Add sequence protocol support for QBitArray.
Diffstat (limited to 'PySide')
-rw-r--r--PySide/QtCore/typesystem_core.xml26
1 files changed, 26 insertions, 0 deletions
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml
index d165ed29f..f6540514e 100644
--- a/PySide/QtCore/typesystem_core.xml
+++ b/PySide/QtCore/typesystem_core.xml
@@ -1091,6 +1091,32 @@
</value-type>
<value-type name="QBitArray" hash-function="qHash" >
<modify-function signature="fill(bool,int)" remove="all"/> <!-- FIXME Removed due to a shiboken bug-->
+ <add-function signature="__len__">
+ <inject-code class="target" position="beginning">
+ return %CPPSELF.size();
+ </inject-code>
+ </add-function>
+ <add-function signature="__getitem__">
+ <inject-code class="target" position="beginning">
+ if (_i &lt; 0 || _i >= %CPPSELF.size()) {
+ PyErr_SetString(PyExc_IndexError, "index out of bounds");
+ return 0;
+ } else {
+ return %CONVERTTOPYTHON[bool](%CPPSELF.at(_i));
+ }
+ </inject-code>
+ </add-function>
+ <add-function signature="__setitem__">
+ <inject-code class="target" position="beginning">
+ PyObject* args = Py_BuildValue("(iiO)", _i, 1, _value);
+ PyObject* result = PyQBitArray_setBit(self, args);
+ Py_DECREF(args);
+ if (result) {
+ Py_DECREF(result);
+ }
+ return !result ? -1 : 0;
+ </inject-code>
+ </add-function>
</value-type>
<!-- QReadWriteLock does not have a copy ctor! -->
<object-type name="QReadWriteLock">