summaryrefslogtreecommitdiff
path: root/swig/ResPool.i
diff options
context:
space:
mode:
authorGui Chen <gui.chen@intel.com>2012-08-16 21:20:18 +0800
committerGui Chen <gui.chen@intel.com>2012-08-16 21:20:18 +0800
commit3fbed28be806ffd390adaffe6a049f3dbd55b5aa (patch)
treed40b3cacac28f8814142edf60f062cf72a3401ea /swig/ResPool.i
parent857e712e5928c179e9da121e903b7df68029225e (diff)
downloadlibzypp-bindings-3fbed28be806ffd390adaffe6a049f3dbd55b5aa.tar.gz
libzypp-bindings-3fbed28be806ffd390adaffe6a049f3dbd55b5aa.tar.bz2
libzypp-bindings-3fbed28be806ffd390adaffe6a049f3dbd55b5aa.zip
Signed-off-by: Gui Chen <gui.chen@intel.com>
Diffstat (limited to 'swig/ResPool.i')
-rw-r--r--swig/ResPool.i92
1 files changed, 92 insertions, 0 deletions
diff --git a/swig/ResPool.i b/swig/ResPool.i
new file mode 100644
index 0000000..c57f57c
--- /dev/null
+++ b/swig/ResPool.i
@@ -0,0 +1,92 @@
+// missing resfilter:: to call these
+%ignore zypp::ResPool::byKindBegin;
+%ignore zypp::ResPool::byKindEnd;
+%ignore zypp::ResPool::byNameBegin;
+%ignore zypp::ResPool::byNameEnd;
+%apply unsigned { zypp::ResPool::size_type };
+%include <zypp/ResPool.h>
+
+%ignore zypp::pool::operator<<;
+%include <zypp/pool/GetResolvablesToInsDel.h>
+namespace zypp
+{
+ typedef ::std::list<zyppPoolItem> PoolItemList;
+ %template(PoolItemList) ::std::list<PoolItem>;
+}
+
+namespace zypp
+{
+
+#ifdef SWIGPERL5
+
+iter2(ResPool, PoolItem);
+
+#endif
+
+#ifdef SWIGRUBY
+
+iter3(ResPool, PoolItem*);
+
+// %extend ResPool {
+// void each()
+// {
+// ResPool::const_iterator i = self->begin();
+// while ( i != self->end() ) {
+// rb_yield( SWIG_NewPointerObj( (void *) &*i, SWIGTYPE_p_PoolItem, 0));
+// ++i;
+// }
+// }
+// }
+
+%extend ResPool {
+ void each_by_kind( const ResObject::Kind & kind_r )
+ {
+ ResPool::byKind_iterator i = self->byKindBegin( kind_r );
+ while ( i != self->byKindEnd( kind_r ) ) {
+ rb_yield( SWIG_NewPointerObj( (void *) &*i, SWIGTYPE_p_PoolItem, 0));
+ ++i;
+ }
+ }
+}
+
+%extend ResPool {
+ void each_by_name( const std::string &name )
+ {
+ ResPool::byName_iterator i = self->byNameBegin( name );
+ while ( i != self->byNameEnd( name ) ) {
+ rb_yield( SWIG_NewPointerObj( (void *) &*i, $descriptor(PoolItem), 0));
+ ++i;
+ }
+ }
+}
+
+#endif
+
+#ifdef SWIGPYTHON
+%newobject ResPool::const_iterator(PyObject **PYTHON_SELF);
+%extend ResPool {
+ swig::SwigPyIterator* iterator(PyObject **PYTHON_SELF)
+ {
+ return swig::make_output_iterator(self->begin(), self->begin(),
+ self->end(), *PYTHON_SELF);
+ }
+ swig::SwigPyIterator* kinditerator(PyObject **PYTHON_SELF, const ResObject::Kind & kind_r)
+ {
+ return swig::make_output_iterator(self->byKindBegin( kind_r ), self->byKindBegin( kind_r ),
+ self->byKindEnd( kind_r ), *PYTHON_SELF);
+ }
+ swig::SwigPyIterator* nameiterator(PyObject **PYTHON_SELF, const std::string &name)
+ {
+ return swig::make_output_iterator(self->byNameBegin( name ), self->byNameBegin( name ),
+ self->byNameEnd( name ), *PYTHON_SELF);
+ }
+%pythoncode {
+ def __iter__(self): return self.iterator()
+ def byKindIterator(self, kind): return self.kinditerator(kind)
+ def byNameIterator(self, name): return self.nameiterator(name)
+}
+}
+
+#endif
+
+}