Bump to libzypp-bindings 0.7.4
[platform/upstream/libzypp-bindings.git] / swig / Arch.i
1 /*
2  * Arch.i
3  *
4  * Architecture definitions
5  *
6  * Document-class: Arch
7  * Instances of Arch represent architecture and compatibility.
8  * The system has an architecture (i.e. x86_64) and so does every
9  * Resolvable.
10  *
11  * +Arch#compatible_with?+ is used to detect compatible architectures.
12  * 'noarch' is compatible with any system architecture.
13  *
14  * There is no limit to architecture specifiers, any string can be
15  * passed to the Arch constructor.
16  * However, there is a set of architectures built into libzypp.
17  * +Arch#builtin?+ returns true for an architecture from the builtin set.
18  *
19  * === Usage
20  *   arch = Arch.new("i686")
21  *   # equivalent:
22  *   # arch = Arch.i686
23  *
24  *   arch.builtin? -> true
25  *
26  */
27
28 %nodefault zypp::Arch;
29 namespace zypp {
30 class Arch {
31 };
32 };
33
34 %extend zypp::Arch
35 {
36   Arch(const char *s) {
37     return new zypp::Arch(s);
38   }
39   ~Arch() {
40     delete $self;
41   }
42
43   /*
44    * builtin: noarch
45    */
46   static Arch noarch() { return zypp::Arch_noarch; }
47   /*
48    * builtin: i386
49    */
50   static Arch i386() { return zypp::Arch_i386; }
51   /*
52    * builtin: i486
53    */
54   static Arch i486() { return zypp::Arch_i486; }
55   /*
56    * builtin: i586
57    */
58   static Arch i586() { return zypp::Arch_i586; }
59   /*
60    * builtin: i686
61    */
62   static Arch i686() { return zypp::Arch_i686; }
63   /*
64    * builtin: i86_64 (AMD 64)
65    */
66   static Arch x86_64() { return zypp::Arch_x86_64; }
67   /*
68    * builtin: ia64 (Itanium)
69    */
70   static Arch ia64() { return zypp::Arch_ia64; }
71   /*
72    * builtin: ppc (Power PC 32 bit)
73    */
74   static Arch ppc() { return zypp::Arch_ppc; }
75   /*
76    * builtin: ppc64 (Power PC 64 bit)
77    */
78   static Arch ppc64() { return zypp::Arch_ppc64; }
79   /*
80    * builtin: s390 (zSeries 32 bit)
81    */
82   static Arch s390() { return zypp::Arch_s390; }
83   /*
84    * builtin: s390s (zSeries 64 bit)
85    */
86   static Arch s390x() { return zypp::Arch_s390x; }
87   /*
88    * builtin: armv7tnhl
89    */
90   static Arch armv7tnhl() { return zypp::Arch_armv7tnhl; }
91   /*
92    * builtin: armv7thl
93    */
94   static Arch armv7thl() { return zypp::Arch_armv7thl; }
95   /*
96    * builtin: armv7nhl
97    */
98   static Arch armv7nhl() { return zypp::Arch_armv7nhl; }
99   /*
100    * builtin: armv7hl
101    */
102   static Arch armv7hl() { return zypp::Arch_armv7hl; }
103   /*
104    * builtin: armv7tnhl
105    */
106   static Arch armv7tnhl() { return zypp::Arch_armv7tnhl; }
107   /*
108    * builtin: armv7thl
109    */
110   static Arch armv7thl() { return zypp::Arch_armv7thl; }
111   /*
112    * builtin: armv7nhl
113    */
114   static Arch armv7nhl() { return zypp::Arch_armv7nhl; }
115   /*
116    * builtin: armv7hl
117    */
118   static Arch armv7hl() { return zypp::Arch_armv7hl; }
119
120   /*
121    * builtin: armv7l
122    */
123   static Arch armv7l() { return zypp::Arch_armv7l; }
124   /*
125    * builtin: armv6l
126    */
127   static Arch armv6l() { return zypp::Arch_armv6l; }
128   /*
129    * builtin: armv5tejl
130    */
131   static Arch armv5tejl() { return zypp::Arch_armv5tejl; }
132   /*
133    * builtin: armv5tel
134    */
135   static Arch armv5tel() { return zypp::Arch_armv5tel; }
136   /*
137    * builtin: armv5l
138    */
139   static Arch armv5l() { return zypp::Arch_armv5l; }
140   /*
141    * builtin: armv4tl
142    */
143   static Arch armv4tl() { return zypp::Arch_armv4tl; }
144   /*
145    * builtin: armv4l
146    */
147   static Arch armv4l() { return zypp::Arch_armv4l; }
148   /*
149    * builtin: armv3l
150    */
151   static Arch armv3l() { return zypp::Arch_armv3l; }
152
153 #if 0 /* defined(SWIGRUBY) */
154 %typemap(out) int is_builtin
155    "$result = $1 ? Qtrue : Qfalse;";
156 %rename("builtin?") builtin;
157 #endif
158   /*
159    * Whether this is a builtin (or known) architecture.
160    *
161    */
162   bool is_builtin() {
163     return ($self->isBuiltIn() ? 1 : 0);
164   }
165 #if defined(SWIGRUBY)
166 %typemap(out) int compatible_with
167    "$result = $1 ? Qtrue : Qfalse;";
168 %rename("compatible_with?") compatible_with;
169 #endif
170   /*
171    * Check if this architecture is compatible with another one
172    *
173    * e.g. 'noarch' is compatible with any arch
174    *
175    */
176   int compatible_with(const zypp::Arch & arch) {
177     return ($self->compatibleWith(arch) ? 1 : 0);
178   }
179
180 #if ZYPP_VERSION > 800
181   /*
182    * return the arch before noarch if it's not a multilib arch
183    * (e.g. x86_64,sparc64v,sparc64,ppc64,s390x).
184    *
185    */
186   zypp::Arch base_arch()
187   {
188     return $self->baseArch();
189   }
190 #endif
191
192 #if defined(SWIGRUBY)
193 %alias compare "<=>";
194 #endif
195 #if defined(SWIGPYTHON)
196   /*
197    * :nodoc:
198    */
199   int __cmp__( const zypp::Arch & arch )
200 #else
201   /*
202    * Comparison operator
203    *
204    * returning <0 (smaller), 0 (equal) or >0 (greater)
205    *
206    */
207   int compare( const zypp::Arch & arch )
208 #endif
209   {  return $self->compare( arch ); }
210
211 #if defined(SWIGPERL)
212   /*
213    * :nodoc:
214    */
215   int __eq__( const zypp::Arch & arch )
216 #endif
217 #if defined(SWIGRUBY)
218 %typemap(out) int equal
219    "$result = $1 ? Qtrue : Qfalse;";
220 %rename("==") equal;
221   /*
222    * Equality operator
223    *
224    */
225   int equal( const zypp::Arch & arch )
226 #endif
227
228 #if defined(SWIGPYTHON)
229   /*
230    * :nodoc:
231    * Python treats 'eq' and 'ne' distinct.
232    */
233   int __ne__( const zypp::Arch & arch )
234   { return $self->compare(arch) != 0; }
235   int __eq__( const zypp::Arch & arch )
236 #endif
237   { return $self->compare(arch) == 0; }
238
239
240 #ifdef SWIGPYTHON
241 %rename ("__str__") string();
242 #endif
243 #ifdef SWIGRUBY
244 %rename ("to_s") string();
245 #endif
246   /*
247    * String representation
248    *
249    */
250   const char *string()
251   {
252     return $self->c_str();
253   }
254 }