41 #define YUILogComponent "qt-pkg" 44 #include "YQPkgSelMapper.h" 48 int YQPkgSelMapper::_refCount = 0;
49 YQPkgSelMapper::Cache YQPkgSelMapper::_cache;
54 if ( ++_refCount == 1 )
61 if ( --_refCount == 0 )
63 yuiDebug() <<
"Destroying pkg -> selectable cache" << endl;
72 yuiDebug() <<
"Building pkg -> selectable cache" << endl;
74 for ( ZyppPoolIterator sel_it = zyppPkgBegin();
75 sel_it != zyppPkgEnd();
78 ZyppSel sel = *sel_it;
80 if ( sel->installedObj() )
85 ZyppPkg installedPkg = tryCastToZyppPkg( sel->installedObj() );
88 _cache.insert( CachePair( installedPkg, sel ) );
91 zypp::ui::Selectable::available_iterator it = sel->availableBegin();
93 while ( it != sel->availableEnd() )
95 ZyppPkg pkg = tryCastToZyppPkg( *it );
98 _cache.insert( CachePair( pkg, sel ) );
104 yuiDebug() <<
"Building pkg -> selectable cache done" << endl;
114 YQPkgSelMapper::CacheIterator it = YQPkgSelMapper::_cache.find( pkg );
116 if ( it != YQPkgSelMapper::_cache.end() )
119 yuiWarning() <<
"No selectable found for package " << pkg->name() << endl;
YQPkgSelMapper()
Constructor.
virtual ~YQPkgSelMapper()
Destructor.
Mapping from ZyppPkg to the correspoinding ZyppSel.
ZyppSel findZyppSel(ZyppPkg pkg)
Find the corresponding ZyppSel to a ZyppPkg.
void rebuildCache()
Rebuild the shared cache.