Author: mlandres
Date: Mon Dec 3 18:49:13 2007
New Revision: 8013
URL: http://svn.opensuse.org/viewcvs/zypp?rev=8013&view=rev
Log:
Added python iterator for ResPool
Modified:
trunk/libzypp-bindings/swig/ResPool.i
Modified: trunk/libzypp-bindings/swig/ResPool.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/ResPool.i?rev=8013&r1=8012&r2=8013&view=diff
==============================================================================
--- trunk/libzypp-bindings/swig/ResPool.i (original)
+++ trunk/libzypp-bindings/swig/ResPool.i Mon Dec 3 18:49:13 2007
@@ -1,3 +1,9 @@
+#ifdef SWIGPERL5
+#else
+%template(PoolItemSet) std::set;
+%apply std::set::const_iterator { ResPool::const_iterator };
+%apply unsigned { ResPool::size_type };
+#endif
class ResPool
{
@@ -27,7 +33,7 @@
/** \name Iterate through all ResObjects (all kinds). */
//@{
- #ifdef SWIGPERL5
+ #ifdef SWIGPERL5
const_iterator begin() const;
const_iterator end() const;
#endif
@@ -194,3 +200,18 @@
}
#endif
+
+#ifdef SWIGPYTHON
+%newobject ResPool::const_iterator(PyObject **PYTHON_SELF);
+%extend ResPool {
+ swig::PySwigIterator* iterator(PyObject **PYTHON_SELF)
+ {
+ return swig::make_output_iterator(self->begin(), self->begin(),
+ self->end(), *PYTHON_SELF);
+ }
+%pythoncode {
+ def __iter__(self): return self.iterator()
+}
+}
+
+#endif
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org