39 #ifndef ZYPP_WRAPPER_H
40 #define ZYPP_WRAPPER_H
42 #include <zypp/ZYppFactory.h>
43 #include <zypp/ResObject.h>
44 #include <zypp/ResKind.h>
45 #include <zypp/ResPoolProxy.h>
46 #include <zypp/PoolQuery.h>
47 #include <zypp/ui/Selectable.h>
48 #include <zypp/Patch.h>
49 #include <zypp/Package.h>
50 #include <zypp/Pattern.h>
51 #include <zypp/Product.h>
52 #include <zypp/Repository.h>
53 #include <zypp/RepoManager.h>
54 #include <zypp/sat/LocaleSupport.h>
57 #include "yzypptags.h"
59 typedef zypp::ResPool _ZyppPool;
60 typedef zypp::ResPoolProxy ZyppPool;
61 inline ZyppPool zyppPool() {
return zypp::getZYpp()->poolProxy(); }
62 inline _ZyppPool _zyppPool() {
return zypp::getZYpp()->pool(); }
63 typedef zypp::ResObject::constPtr ZyppResObject;
64 typedef zypp::ResObject* ZyppResObjectPtr;
65 typedef zypp::ui::Selectable::Ptr ZyppSelectable;
66 typedef zypp::ui::Selectable* ZyppSelectablePtr;
67 typedef zypp::Package::constPtr ZyppPackage;
68 typedef zypp::Patch::constPtr ZyppPatch;
69 typedef zypp::Pattern::constPtr ZyppPattern;
70 typedef zypp::Repository ZyppRepository;
71 typedef zypp::PoolQuery ZyppQuery;
72 typedef zypp::sat::SolvAttr ZyppAttribute;
73 typedef zypp::ByteCount Size_t;
74 typedef zypp::DiskUsageCounter::MountPoint ZyppDu;
75 typedef zypp::DiskUsageCounter::MountPointSet ZyppDuSet;
77 inline ZyppPackage castZyppPackage (ZyppResObject obj)
78 {
return zypp::dynamic_pointer_cast <
const zypp::Package> (obj); }
79 inline ZyppPatch castZyppPatch (ZyppResObject obj)
80 {
return zypp::dynamic_pointer_cast <
const zypp::Patch> (obj); }
81 inline ZyppPattern castZyppPattern (ZyppResObject obj)
82 {
return zypp::dynamic_pointer_cast <
const zypp::Pattern> (obj); }
103 bool operator == (
const Repository &other)
const;
105 ZyppRepository &zyppRepo() {
return m_repo; }
108 ZyppRepository m_repo;
109 zypp::RepoInfo m_repo_info;
113 void getRepositoryFromAlias (
const std::string &alias,
114 std::string &name, std::string &url);
123 std::string number();
128 Size_t downloadSize();
133 bool operator < (
Version &other);
134 bool operator > (
Version &other);
135 bool operator == (
Version &other);
137 ZyppResObject zyppObj() {
return m_zobj; }
140 ZyppResObject m_zobj;
145 PACKAGE, PATTERN, LANGUAGE, PATCH, ALL
147 static zypp::ResKind asKind (Type type);
148 static Type asType (zypp::ResKind kind);
155 std::string summary();
156 std::string description (
bool as_html);
172 void lock (
bool lock);
180 bool hasCandidateVersion();
182 void setCandidate (
Version &version);
184 bool hasInstalledVersion();
188 bool operator == (
const Selectable &other)
const;
189 bool operator != (
const Selectable &other)
const;
191 ZyppSelectable zyppSel() {
return m_sel; }
192 zypp::Locale zyppLocale() {
return m_locale; }
196 ZyppSelectable m_sel;
197 zypp::Locale m_locale;
203 void stats (
int *installed,
int *total);
216 static int supportTotal();
217 static std::string supportSummary (
int support);
218 static std::string supportDescription (
int support);
222 YPkgGroupEnum group();
223 std::string rpm_group();
225 bool isCandidatePatch();
235 static int priorityTotal();
236 static const char *prioritySummary (
int priority);
237 static const char *priorityIcon (
int priority);
246 virtual void selectableModified() = 0;
254 void notifySelModified();
257 std::string description, details;
259 std::string description, details;
269 bool runSolver (
bool force =
false);
270 void setEnableSolver (
bool enabled);
271 bool isSolverEnabled();
272 bool showPendingLicenses (Ypp::Selectable::Type type);
276 void startTransactions();
277 bool finishTransactions();
280 virtual bool showLicense (
Selectable &sel,
const std::string &license) = 0;
281 virtual bool showMessage (
Selectable &sel,
const std::string &message) = 0;
283 virtual bool resolveProblems (
const std::list <Problem *> &problems) = 0;
286 void setInterface (
Interface *interface);
300 NAME = 0x1, SUMMARY = 0x2, DESCRIPTION = 0x4
303 void add (
const std::string &str);
313 IS_INSTALLED, NOT_INSTALLED, HAS_UPGRADE, IS_LOCKED, TO_MODIFY
318 private: Status m_status;
325 private: YPkgGroupEnum m_group;
332 private: std::string m_group;
352 {
return Package (sel).support() == m_n; }
359 {
return Patch (sel).priority() == m_n; }
364 virtual void addCriteria (
Match *match) = 0;
365 virtual bool hasNext() = 0;
367 virtual int guessSize() = 0;
375 CONTAINS, EXACT, GLOB, REGEX
377 enum StringAttribute {
378 NAME, SUMMARY, DESCRIPTION, FILELIST, PROVIDES, REQUIRES,
380 void setStringMode (
bool caseSensitive, MatchType type);
381 void addStringAttribute (StringAttribute attrb);
382 void addStringOr (
const std::string &str);
386 virtual void addCriteria (
Match *match);
388 virtual bool hasNext();
390 virtual int guessSize();
392 ZyppQuery &zyppQuery();
393 Selectable::Type poolType();
405 virtual void addCriteria (
Match *match) {}
406 virtual bool hasNext();
408 virtual int guessSize();
428 int count (
Match *match);
429 int find (
const std::string &name);
432 void reserve (
int size);
437 void lock (
bool lock);
441 IS_INSTALLED_SORT, NAME_SORT, SIZE_SORT, REPOSITORY_SORT, SUPPORT_SORT
443 void sort (SortAttribute attrb,
bool ascendent);
446 bool operator == (
const Ypp::List &other)
const;
447 bool operator != (
const Ypp::List &other)
const;
459 bool isInstalled()
const;
460 bool isNotInstalled()
const;
461 bool hasUpgrade()
const;
462 bool toModify()
const;
463 bool isLocked()
const;
464 bool isUnlocked()
const;
465 bool canRemove()
const;
466 bool canLock()
const;
468 int isInstalledNb()
const;
469 int isNotInstalledNb()
const;
470 int hasUpgradeNb()
const;
471 int isLockedNb()
const;
472 int toModifyNb()
const;
482 std::vector <std::string> getPartitionList();
483 const ZyppDu getPartition (
const std::string &mount_point);
500 virtual void loading (
float progress) = 0;