46 #include <zypp/ui/Status.h> 47 #include <zypp/ui/Selectable.h> 48 #include <zypp/ResObject.h> 49 #include <zypp/Package.h> 50 #include <zypp/Pattern.h> 51 #include <zypp/Product.h> 52 #include <zypp/Patch.h> 53 #include <zypp/ZYppFactory.h> 54 #include <zypp/ResPoolProxy.h> 55 #include <zypp/PoolQuery.h> 58 using zypp::ui::S_Protected;
59 using zypp::ui::S_Taboo;
60 using zypp::ui::S_Del;
61 using zypp::ui::S_Update;
62 using zypp::ui::S_Install;
63 using zypp::ui::S_AutoDel;
64 using zypp::ui::S_AutoUpdate;
65 using zypp::ui::S_AutoInstall;
66 using zypp::ui::S_KeepInstalled;
67 using zypp::ui::S_NoInst;
74 typedef zypp::ui::Status ZyppStatus;
75 typedef zypp::ui::Selectable::Ptr ZyppSel;
76 typedef zypp::ResObject::constPtr ZyppObj;
77 typedef zypp::Package::constPtr ZyppPkg;
78 typedef zypp::Pattern::constPtr ZyppPattern;
79 typedef zypp::Patch::constPtr ZyppPatch;
80 typedef zypp::Product::constPtr ZyppProduct;
81 typedef zypp::Repository ZyppRepo;
83 typedef zypp::ResPoolProxy ZyppPool;
84 typedef zypp::ResPoolProxy::const_iterator ZyppPoolIterator;
85 typedef zypp::ResPoolProxy::repository_iterator ZyppRepositoryIterator;
88 inline ZyppPool zyppPool() {
return zypp::getZYpp()->poolProxy(); }
90 template<
class T> ZyppPoolIterator zyppBegin() {
return zyppPool().byKindBegin<T>(); }
91 template<
class T> ZyppPoolIterator zyppEnd() {
return zyppPool().byKindEnd<T>(); }
93 inline ZyppPoolIterator zyppPkgBegin() {
return zyppBegin<zypp::Package>(); }
94 inline ZyppPoolIterator zyppPkgEnd() {
return zyppEnd<zypp::Package>(); }
96 inline ZyppPoolIterator zyppPatternsBegin() {
return zyppBegin<zypp::Pattern>(); }
97 inline ZyppPoolIterator zyppPatternsEnd() {
return zyppEnd<zypp::Pattern>(); }
99 inline ZyppPoolIterator zyppPatchesBegin() {
return zyppBegin<zypp::Patch>(); }
100 inline ZyppPoolIterator zyppPatchesEnd() {
return zyppEnd<zypp::Patch>(); }
102 inline ZyppPoolIterator zyppProductsBegin() {
return zyppBegin<zypp::Product>(); }
103 inline ZyppPoolIterator zyppProductsEnd() {
return zyppEnd<zypp::Product>(); }
105 inline ZyppRepositoryIterator ZyppRepositoriesBegin() {
return zyppPool().knownRepositoriesBegin(); }
106 inline ZyppRepositoryIterator ZyppRepositoriesEnd() {
return zyppPool().knownRepositoriesEnd(); }
109 inline ZyppPkg tryCastToZyppPkg( ZyppObj zyppObj )
111 return zypp::dynamic_pointer_cast<
const zypp::Package>( zyppObj );
114 inline ZyppPattern tryCastToZyppPattern( ZyppObj zyppObj )
116 return zypp::dynamic_pointer_cast<
const zypp::Pattern>( zyppObj );
119 inline ZyppPatch tryCastToZyppPatch( ZyppObj zyppObj )
121 return zypp::dynamic_pointer_cast<
const zypp::Patch>( zyppObj );
124 inline ZyppProduct tryCastToZyppProduct( ZyppObj zyppObj )
126 return zypp::dynamic_pointer_cast<
const zypp::Product>( zyppObj );
129 template<
typename T>
bool inContainer(
const std::set<T> & container, T search )
131 return container.find( search ) != container.end();
134 template<
typename T>
bool bsearch(
const std::vector<T> & sorted_vector, T search )
136 return binary_search( sorted_vector.begin(), sorted_vector.end(), search);
139 inline bool sortByName( ZyppSel ptr1, ZyppSel ptr2 )
141 return( ptr1->name() < ptr2->name() );