Bump to libzypp-bindings 0.7.4
[platform/upstream/libzypp-bindings.git] / swig / zypp.i
1 %module zypp
2
3 /* set this to 0 (zero) to only create a subset of the bindings
4  * for testing
5  */
6 #define PRODUCTION 1
7
8 #ifdef SWIGPERL5
9 %{
10    #undef NORMAL
11    #undef readdir
12    #undef Fflush
13    #undef Mkdir
14    #undef strerror
15 %}
16 #endif
17
18 // stuff swig seems to be unable to parse
19 #define BOOST_NOEXCEPT
20 #define BOOST_SP_NOEXCEPT
21 #define BOOST_SP_NOEXCEPT_WITH_ASSERT
22 #define BOOST_NO_CXX11_NOEXCEPT
23 #define BOOST_NO_CXX11_RVALUE_REFERENCES
24 #define BOOST_NO_CXX11_SMART_PTR
25 #define constexpr
26 #define BOOST_CONSTEXPR constexpr
27
28 %{
29 /* Includes the header in the wrapper code */
30 #ifdef SWIGRUBY
31 #define REG_EXTENDED 1
32 #define REG_ICASE (REG_EXTENDED << 1)
33 #define REG_NEWLINE (REG_ICASE << 1)
34 #define REG_NOSUB (REG_NEWLINE << 1)
35 #endif
36
37 /*
38  * type definitions to keep the C code generic
39  */
40
41 #if defined(SWIGPYTHON)
42 #define Target_Null_p(x) (x == Py_None)
43 #define Target_INCREF(x) Py_INCREF(x)
44 #define Target_DECREF(x) Py_DECREF(x)
45 #define Target_True Py_True
46 #define Target_False Py_False
47 #define Target_Null Py_None
48 #define Target_Type PyObject*
49 #define Target_Bool(x) PyBool_FromLong(x)
50 #define Target_WChar(x) PyInt_FromLong(x)
51 #define Target_Int(x) PyInt_FromLong(x)
52 #define Target_String(x) PyString_FromString(x)
53 #define Target_Real(x) Py_None
54 #define Target_Array() PyList_New(0)
55 #define Target_SizedArray(len) PyList_New(len)
56 #define Target_Append(x,y) PyList_Append(x,y)
57 #define Target_DateTime(x) Py_None
58 #include <Python.h>
59 #define TARGET_THREAD_BEGIN_BLOCK SWIG_PYTHON_THREAD_BEGIN_BLOCK
60 #define TARGET_THREAD_END_BLOCK SWIG_PYTHON_THREAD_END_BLOCK
61 #define TARGET_THREAD_BEGIN_ALLOW SWIG_PYTHON_THREAD_BEGIN_ALLOW
62 #define TARGET_THREAD_END_ALLOW SWIG_PYTHON_THREAD_END_ALLOW
63 #endif
64
65 #if defined(SWIGRUBY)
66 #define Target_Null_p(x) NIL_P(x)
67 #define Target_INCREF(x)
68 #define Target_DECREF(x)
69 #define Target_True Qtrue
70 #define Target_False Qfalse
71 #define Target_Null Qnil
72 #define Target_Type VALUE
73 #define Target_Bool(x) ((x)?Qtrue:Qfalse)
74 #define Target_WChar(x) INT2FIX(x)
75 #define Target_Int(x) INT2FIX(x)
76 #define Target_String(x) rb_str_new2(x)
77 #define Target_Real(x) rb_float_new(x)
78 #define Target_Array() rb_ary_new()
79 #define Target_SizedArray(len) rb_ary_new2(len)
80 #define Target_Append(x,y) rb_ary_push(x,y)
81 #define Target_DateTime(x) Qnil
82 #define TARGET_THREAD_BEGIN_BLOCK do {} while(0)
83 #define TARGET_THREAD_END_BLOCK do {} while(0)
84 #define TARGET_THREAD_BEGIN_ALLOW do {} while(0)
85 #define TARGET_THREAD_END_ALLOW do {} while(0)
86 #include <ruby.h>
87 #endif
88
89 #if defined(SWIGPERL)
90 #define TARGET_THREAD_BEGIN_BLOCK do {} while(0)
91 #define TARGET_THREAD_END_BLOCK do {} while(0)
92 #define TARGET_THREAD_BEGIN_ALLOW do {} while(0)
93 #define TARGET_THREAD_END_ALLOW do {} while(0)
94
95 SWIGINTERNINLINE SV *SWIG_From_long  SWIG_PERL_DECL_ARGS_1(long value);
96 SWIGINTERNINLINE SV *SWIG_FromCharPtr(const char *cptr);
97 SWIGINTERNINLINE SV *SWIG_From_double  SWIG_PERL_DECL_ARGS_1(double value);
98
99 #define Target_Null_p(x) (x == NULL)
100 #define Target_INCREF(x)
101 #define Target_DECREF(x)
102 #define Target_True (&PL_sv_yes)
103 #define Target_False (&PL_sv_no)
104 #define Target_Null NULL
105 #define Target_Type SV *
106 #define Target_Bool(x) (x)?Target_True:Target_False
107 #define Target_WChar(x) NULL
108 #define Target_Int(x) SWIG_From_long(x)
109 #define Target_String(x) SWIG_FromCharPtr(x)
110 #define Target_Real(x) SWIG_From_double(x)
111 #define Target_Array() (SV *)newAV()
112 #define Target_SizedArray(len) (SV *)newAV()
113 #define Target_Append(x,y) av_push(((AV *)(x)), y)
114 #define Target_DateTime(x) NULL
115 #include <perl.h>
116 #include <EXTERN.h>
117 #endif
118
119
120 #include <sstream>
121 #undef seed // don't know where it comes from, but it conflicts with <random>
122 #include "zypp/base/PtrTypes.h"
123 #include "zypp/base/ReferenceCounted.h"
124 #include "zypp/Edition.h"
125 #include "zypp/Pathname.h"
126 #include "zypp/ResTraits.h"
127 #include "zypp/ZYppFactory.h"
128 #include "zypp/ZYpp.h"
129
130 #include "zypp/ResObjects.h"
131 #include "zypp/Target.h"
132 #include "zypp/target/TargetImpl.h"
133 #include "zypp/MediaSetAccess.h"
134 #include "zypp/ResFilters.h"
135 #include "zypp/OnMediaLocation.h"
136 #include "zypp/Repository.h"
137 #include "zypp/ServiceInfo.h"
138 #include "zypp/RepoManager.h"
139 #include "zypp/repo/RepoType.h"
140 #include "zypp/repo/PackageProvider.h"
141 #include "zypp/TmpPath.h"
142 #include "zypp/Resolver.h"
143 #include "legacy/GetResolvablesToInsDel.h"
144
145 #include "zypp/sat/SolvAttr.h"
146 #include "zypp/PoolQuery.h"
147 #include "zypp/Product.h"
148
149 using namespace boost;
150 using namespace zypp;
151 using namespace zypp::repo;
152 using namespace zypp::resfilter;
153 using namespace zypp::filesystem;
154
155 typedef std::list<std::string> StringList;
156
157 %}
158
159 /* swig does not understand the __attribute__ extension */
160 #define  __attribute__(x)
161
162 /* prevent swig from creating a type called 'Target_Type' */
163 #if defined(SWIGRUBY)
164 #define Target_Type VALUE
165 #endif
166 #if defined(SWIGPYTHON)
167 #define Target_Type PyObject*
168 #endif
169 #if defined(SWIGPERL)
170 #define Target_Type SV *
171 #endif
172
173 #ifdef SWIGRUBY
174 %include "ruby/std_list.i"
175 %include "ruby/std_set.i"
176 %include "ruby/ruby.i"
177 #endif
178
179 #ifdef SWIGPYTHON
180 %include "std_list.i"
181 %include "std_set.i"
182 %include "python/python.i"
183 #endif
184
185 #ifdef SWIGPERL5
186 %include "std_list.i"
187 %include "perl5/perl.i"
188 #endif
189
190 #define VERSION ZYPP_VERSION
191
192 /* These include files are pending to be cleaned up from C++ cruft */
193 #if PRODUCTION /* set 0 for testing, these files still carry the full C++ cruft */
194
195 %nodefault ByKind;
196
197 %rename("+") "operator+";
198 %rename("<<") "operator<<";
199 %rename("!=") "operator!=";
200 %rename("!") "operator!";
201 %rename("==") "operator==";
202
203 namespace zypp {
204   namespace base {
205     // silence 'Nothing known about class..' warning
206     class  ReferenceCounted {};
207   }
208 }
209
210 %include "std_string.i"
211 %include "stl.i"
212
213 %import <boost/config.hpp>
214 %import <boost/pointer_cast.hpp>
215
216 #ifdef BOOST_SMARTPTR_INCLUDE_DIR
217 %import <boost/smart_ptr/scoped_ptr.hpp>
218 %import <boost/smart_ptr/shared_ptr.hpp>
219 %import <boost/smart_ptr/weak_ptr.hpp>
220 %import <boost/smart_ptr/intrusive_ptr.hpp>
221 #else
222 %import <boost/scoped_ptr.hpp>
223 %import <boost/shared_ptr.hpp>
224 %import <boost/weak_ptr.hpp>
225 %import <boost/intrusive_ptr.hpp>
226 #endif
227 %import <zypp/base/PtrTypes.h>
228 %import <zypp/base/Flags.h>
229
230 %include "IdStringType.i"
231 %include "Pathname.i"
232 %include "ByteCount.i"
233 %include "Url.i"
234 %include "NeedAType.i"
235 %include "Edition.i"
236 %include "Kind.i"
237 %include "CheckSum.i"
238 %include "Date.i"
239 %include "Changelog.i"
240 %include "Dep.i"
241 %include "Capability.i"
242 %include "Capabilities.i"
243 %include "CapMatch.i"
244 %include "OnMediaLocation.i"
245 %include "SolvAttr.i"
246 %include "RepoType.i"
247 %include "RepoInfo.i"
248 %include "Repository.i"
249 %include "Resolvable.i"
250 %include "ServiceInfo.i"
251 %include "ResTraits.i"
252 %include "ResStatus.i"
253 %include "ResObject.i"
254 %include "VendorSupportOptions.i"
255 %include "Package.i"
256 %include "PackageProvider.i"
257 %include "Patch.i"
258 %include "Pattern.i"
259 %include "Product.i"
260 %include "SrcPackage.i"
261 %include "RepoStatus.i"
262 %include "RepoManager.i"
263 %include "PublicKey.i"
264 %include "KeyRing.i"
265 %include "Target.i"
266 %include "MediaSetAccess.i"
267 %include "PoolItem.i"
268 %include "ResPool.i"
269 %include "ZYppCommitPolicy.i"
270 %include "ZYppCommitResult.i"
271 %include "TmpPath.i"
272 %include "Resolver.i"
273 %include "ZConfig.i"
274 %include "PoolQuery.i"
275
276 //just simple files, where we need default ctor
277 %include <zypp/repo/RepoProvideFile.h>
278 %include <zypp/repo/DeltaCandidates.h>
279
280 %ignore zypp::ZYpp::setTextLocale;
281 %ignore zypp::ZYpp::getTextLocale;
282 %ignore zypp::ZYpp::setRequestedLocales;
283 %ignore zypp::ZYpp::getRequestedLocales;
284 %ignore zypp::ZYpp::getAvailableLocales;
285 %ignore zypp::ZYpp::architecture;
286 %ignore zypp::ZYpp::setArchitecture;
287 %ignore zypp::ZYpp::applyLocks;
288
289 %include "ZYppFactory.i"
290 #endif
291
292 %include "Arch.i"
293 %include "Callbacks.i"
294
295 //
296 // helper
297 //
298 %{
299 #include <zypp/base/LogControl.h>
300 %}
301 %inline %{
302   namespace zypp
303   {
304     void setZyppLogfile( const std::string & file_r )
305     {
306       base::LogControl::instance().logfile( file_r );
307     }
308   }
309 %}