b9f24e9e7343183ccfbcf29d4e21e10868ea4d16
[platform/upstream/libzypp-bindings.git] / swig / ResPool.i
1 // missing resfilter:: to call these
2 %ignore zypp::ResPool::byKindBegin;
3 %ignore zypp::ResPool::byKindEnd;
4 %ignore zypp::ResPool::byNameBegin;
5 %ignore zypp::ResPool::byNameEnd;
6 #if (BOOST_VERSION >= 106501)
7 %ignore zypp::ResPool::byStatus;  
8 %ignore zypp::ResPool::byStatusBegin;  
9 %ignore zypp::ResPool::byStatusEnd; 
10 #endif
11 %apply unsigned { zypp::ResPool::size_type };
12 %include <zypp/ResPool.h>
13
14 %ignore zypp::pool::operator<<;
15 %include "legacy/GetResolvablesToInsDel.h"
16 namespace zypp
17 {
18   typedef ::std::list<zyppPoolItem> PoolItemList;
19   %template(PoolItemList) ::std::list<PoolItem>;
20 }
21
22 namespace zypp
23 {
24
25 #ifdef SWIGPERL5
26
27 iter2(ResPool, PoolItem);
28
29 #endif
30
31 #ifdef SWIGRUBY
32
33 iter3(ResPool, zypp::PoolItem*);
34
35 // %extend ResPool {
36 //     void each()
37 //     {
38 //         ResPool::const_iterator i = self->begin();
39 //         while ( i != self->end() ) {
40 //             rb_yield( SWIG_NewPointerObj( (void *) &*i, SWIGTYPE_p_zypp__PoolItem, 0));
41 //             ++i;
42 //         }
43 //     }
44 // }
45
46 %extend ResPool {
47     void each_by_kind( const ResKind & kind_r )
48     {
49         ResPool::byKind_iterator i = self->byKindBegin( kind_r );
50         while ( i != self->byKindEnd( kind_r ) ) {
51             rb_yield( SWIG_NewPointerObj( (void *) &*i, SWIGTYPE_p_zypp__PoolItem, 0));
52             ++i;
53         }
54     }
55 }
56
57 %extend ResPool {
58     void each_by_name( const std::string &name )
59     {
60         ResPool::byName_iterator i = self->byNameBegin( name );
61         while ( i != self->byNameEnd( name ) ) {
62             rb_yield( SWIG_NewPointerObj( (void *) &*i, SWIGTYPE_p_zypp__PoolItem, 0));
63             ++i;
64         }
65     }
66 }
67
68 #endif
69
70 #ifdef SWIGPYTHON
71 %newobject ResPool::const_iterator(PyObject **PYTHON_SELF);
72 %extend  ResPool {
73 #if SWIG_VERSION > 0x010336
74   swig::SwigPyIterator* iterator(PyObject **PYTHON_SELF)
75 #else
76   swig::PySwigIterator* iterator(PyObject **PYTHON_SELF)
77 #endif
78   {
79     return swig::make_output_iterator(self->begin(), self->begin(),
80                                       self->end(), *PYTHON_SELF);
81   }
82 #if SWIG_VERSION > 0x010336
83   swig::SwigPyIterator* kinditerator(PyObject **PYTHON_SELF, const ResObject::Kind & kind_r)
84 #else
85   swig::PySwigIterator* kinditerator(PyObject **PYTHON_SELF, const ResObject::Kind & kind_r)
86 #endif
87   {
88     return swig::make_output_iterator(self->byKindBegin( kind_r ), self->byKindBegin( kind_r ),
89                                       self->byKindEnd( kind_r ), *PYTHON_SELF);
90   }
91 #if SWIG_VERSION > 0x010336
92   swig::SwigPyIterator* nameiterator(PyObject **PYTHON_SELF, const std::string &name)
93 #else
94   swig::PySwigIterator* nameiterator(PyObject **PYTHON_SELF, const std::string &name)
95 #endif
96   {
97     return swig::make_output_iterator(self->byNameBegin( name ), self->byNameBegin( name ),
98                                       self->byNameEnd( name ), *PYTHON_SELF);
99   }
100 %pythoncode {
101   def __iter__(self): return self.iterator()
102   def byKindIterator(self, kind): return self.kinditerator(kind)
103   def byNameIterator(self, name): return self.nameiterator(name)
104 }
105 }
106
107 #endif
108
109 }