28#include <zypp/ui/Status.h>
29#include <zypp/ui/Selectable.h>
30#include <zypp/ResObject.h>
31#include <zypp/Package.h>
32#include <zypp/Pattern.h>
33#include <zypp/Product.h>
34#include <zypp/Patch.h>
35#include <zypp/ZYppFactory.h>
36#include <zypp/ResPoolProxy.h>
37#include <zypp/PoolQuery.h>
40using zypp::ui::S_Protected;
41using zypp::ui::S_Taboo;
43using zypp::ui::S_Update;
44using zypp::ui::S_Install;
45using zypp::ui::S_AutoDel;
46using zypp::ui::S_AutoUpdate;
47using zypp::ui::S_AutoInstall;
48using zypp::ui::S_KeepInstalled;
49using zypp::ui::S_NoInst;
56typedef zypp::ui::Status ZyppStatus;
57typedef zypp::ui::Selectable::Ptr ZyppSel;
58typedef zypp::ResObject::constPtr ZyppObj;
59typedef zypp::Package::constPtr ZyppPkg;
60typedef zypp::Pattern::constPtr ZyppPattern;
61typedef zypp::Patch::constPtr ZyppPatch;
62typedef zypp::Product::constPtr ZyppProduct;
63typedef zypp::Repository ZyppRepo;
65typedef zypp::ResPoolProxy ZyppPool;
66typedef zypp::ResPoolProxy::const_iterator ZyppPoolIterator;
67typedef zypp::ResPoolProxy::repository_iterator ZyppRepositoryIterator;
70inline ZyppPool zyppPool() {
return zypp::getZYpp()->poolProxy(); }
72template<
class T> ZyppPoolIterator zyppBegin() {
return zyppPool().byKindBegin<T>(); }
73template<
class T> ZyppPoolIterator zyppEnd() {
return zyppPool().byKindEnd<T>(); }
75inline ZyppPoolIterator zyppPkgBegin() {
return zyppBegin<zypp::Package>(); }
76inline ZyppPoolIterator zyppPkgEnd() {
return zyppEnd<zypp::Package>(); }
78inline ZyppPoolIterator zyppPatternsBegin() {
return zyppBegin<zypp::Pattern>(); }
79inline ZyppPoolIterator zyppPatternsEnd() {
return zyppEnd<zypp::Pattern>(); }
81inline ZyppPoolIterator zyppPatchesBegin() {
return zyppBegin<zypp::Patch>(); }
82inline ZyppPoolIterator zyppPatchesEnd() {
return zyppEnd<zypp::Patch>(); }
84inline ZyppPoolIterator zyppProductsBegin() {
return zyppBegin<zypp::Product>(); }
85inline ZyppPoolIterator zyppProductsEnd() {
return zyppEnd<zypp::Product>(); }
87inline ZyppRepositoryIterator ZyppRepositoriesBegin() {
return zyppPool().knownRepositoriesBegin(); }
88inline ZyppRepositoryIterator ZyppRepositoriesEnd() {
return zyppPool().knownRepositoriesEnd(); }
91inline ZyppPkg tryCastToZyppPkg( ZyppObj zyppObj )
93 return zypp::dynamic_pointer_cast<const zypp::Package>( zyppObj );
96inline ZyppPattern tryCastToZyppPattern( ZyppObj zyppObj )
98 return zypp::dynamic_pointer_cast<const zypp::Pattern>( zyppObj );
101inline ZyppPatch tryCastToZyppPatch( ZyppObj zyppObj )
103 return zypp::dynamic_pointer_cast<const zypp::Patch>( zyppObj );
106inline ZyppProduct tryCastToZyppProduct( ZyppObj zyppObj )
108 return zypp::dynamic_pointer_cast<const zypp::Product>( zyppObj );
111template<
typename T>
bool inContainer(
const std::set<T> & container, T search )
113 return container.find( search ) != container.end();
116template<
typename T>
bool bsearch(
const std::vector<T> & sorted_vector, T search )
118 return binary_search( sorted_vector.begin(), sorted_vector.end(), search);
121inline bool sortByName( ZyppSel ptr1, ZyppSel ptr2 )
123 return( ptr1->name() < ptr2->name() );