backup
[platform/upstream/libzypp-bindings.git] / swig / zypp.i
1 %module zypp
2
3 #ifdef SWIGPERL5
4 %{
5    #undef NORMAL
6    #undef readdir
7    #undef Fflush
8    #undef Mkdir
9    #undef strerror
10 %}
11 #endif
12
13 %{
14 /* Includes the header in the wrapper code */
15 #ifdef SWIGRUBY
16 #define REG_EXTENDED 1
17 #define REG_ICASE (REG_EXTENDED << 1)
18 #define REG_NEWLINE (REG_ICASE << 1)
19 #define REG_NOSUB (REG_NEWLINE << 1)
20 #endif
21
22 #include <sstream>
23 #include "zypp/base/PtrTypes.h"
24 #include "zypp/Edition.h"
25 #include "zypp/ResTraits.h"
26 #include "zypp/ZYppFactory.h"
27 #include "zypp/ZYpp.h"
28 #include "zypp/Pathname.h"
29 #include "zypp/base/ReferenceCounted.h"
30 #include "zypp/ResObject.h"
31 #include "zypp/Target.h"
32 #include "zypp/target/TargetImpl.h"
33 #include "zypp/MediaSetAccess.h"
34 #include "zypp/TranslatedText.h"
35 #include "zypp/Package.h"
36 #include "zypp/Patch.h"
37 #include "zypp/SrcPackage.h"
38 #include "zypp/Pattern.h"
39 #include "zypp/Product.h"
40 #include "zypp/ResFilters.h"
41 #include "zypp/OnMediaLocation.h"
42 #include "zypp/Repository.h"
43 #include "zypp/RepoManager.h"
44 #include "zypp/Service.h"
45 #include "zypp/repo/RepoType.h"
46 #include "zypp/TmpPath.h"
47 #include "zypp/Resolver.h"
48
49 using namespace boost;
50 using namespace zypp;
51 using namespace zypp::repo;
52 using namespace zypp::resfilter;
53 using namespace zypp::filesystem;
54
55 typedef std::set<Url> UrlSet;
56 typedef std::list<std::string> StringList;
57 %}
58
59 %nodefault ByKind;
60 %define DEFINE_PTR_TYPE(name)
61 %enddef
62
63 %rename("+") "operator+";
64 %rename("<<") "operator<<";
65 %rename("!=") "operator!=";
66 %rename("!") "operator!";
67 %rename("==") "operator==";
68
69 template < typename T >
70 class intrusive_ptr {
71   public:
72   T *operator->();
73 };
74
75 namespace zypp {
76   namespace base {
77     // silence 'Nothing known about class..' warning
78     class  ReferenceCounted {};
79   }
80 }
81
82 %include "std_string.i"
83 %include "stl.i"
84
85
86 #ifdef SWIGRUBY
87 %include "ruby/std_list.i"
88 %include "ruby/std_set.i"
89 %include "ruby/ruby.i"
90 #endif
91
92 #ifdef SWIGPYTHON
93 %include "std_list.i"
94 %include "std_set.i"
95 %include "python/python.i"
96 #endif
97
98 #ifdef SWIGPERL5
99 %include "std_list.i"
100 %include "perl5/perl.i"
101 #endif
102
103 %include "Pathname.i"
104 %include "Url.i"
105 %include "ResStatus.i"
106 %include "NeedAType.i"
107 %include "Arch.i"
108 %include "Edition.i"
109 %include "Kind.i"
110 %include "ResTraits.i"
111 %include "Date.i"
112 %include "Capability.i"
113 %include "Capabilities.i"
114 %include "Dep.i"
115 %include "Resolvable.i"
116 %include "ByteCount.i"
117 %include "RepoType.i"
118 %include "Repository.i"
119 %include "RepoInfo.i"
120 %include "RepoManager.i"
121 %include "RepoStatus.i"
122 %include "ResObject.i"
123 %include "TranslatedText.i"
124 %include "CheckSum.i"
125 %include "CapMatch.i"
126 %include "Package.i"
127 %include "Patch.i"
128 %include "SrcPackage.i"
129 %include "Pattern.i"
130 %include "Product.i"
131 %include "PublicKey.i"
132 %include "KeyRing.i"
133 %include "Target.i"
134 %include "MediaSetAccess.i"
135 %include "PoolItem.i"
136 %include "ResPool.i"
137 %include "ZYppCommitPolicy.i"
138 %include "ZYppCommitResult.i"
139 %include "TmpPath.i"
140 %include "Resolver.i"
141 #ifdef SWIGPYTHON
142 %include "python/callbacks.i"
143 #endif
144
145 class ZYpp
146 {
147   public:
148     typedef intrusive_ptr<ZYpp>       Ptr;
149     typedef intrusive_ptr<const ZYpp> constPtr;
150   public:
151
152     //ResPool pool() const;
153     //ResPoolProxy poolProxy() const;
154
155     /*
156     DiskUsageCounter::MountPointSet diskUsage();
157     void setPartitions(const DiskUsageCounter::MountPointSet &mp);
158     */
159     Target_Ptr target() const;
160     void initializeTarget(const zypp::Pathname & root);
161     void finishTarget();
162
163     typedef ZYppCommitResult CommitResult;
164     ZYppCommitResult commit( const ZYppCommitPolicy & policy_r );
165
166     Resolver_Ptr resolver() const;
167     KeyRing_Ptr keyRing() const;
168
169      /*
170     void setTextLocale( const Locale & textLocale_r );
171     Locale getTextLocale() const;
172     typedef std::set<Locale> LocaleSet;
173     void setRequestedLocales( const LocaleSet & locales_r );
174     LocaleSet getRequestedLocales() const;
175     LocaleSet getAvailableLocales() const;
176     void availableLocale( const Locale & locale_r );
177     */
178     zypp::Pathname homePath() const;
179     zypp::Pathname tmpPath() const;
180     void setHomePath( const zypp::Pathname & path );
181
182     Arch architecture() const;
183     void setArchitecture( const Arch & arch );
184
185    /**
186     * \short Apply persistant locks to current pool.
187     * Call this before solving
188     *
189     * \returns Number of items locked
190     */
191    int applyLocks();
192
193     protected:
194     virtual ~ZYpp();
195     private:
196     friend class ZYppFactory;
197     explicit ZYpp( const Impl_Ptr & impl_r );
198 };
199
200 %include "ZYppFactory.i"