41 #define YUILogComponent "ncurses-pkg"
44 #include "NCPkgSelMapper.h"
49 int NCPkgSelMapper::_refCount = 0;
50 NCPkgSelMapper::Cache NCPkgSelMapper::_cache;
55 if ( ++_refCount == 1 )
62 if ( --_refCount == 0 )
64 yuiDebug() <<
"Destroying pkg -> selectable cache" << endl;
73 yuiDebug() <<
"Building pkg -> selectable cache" << endl;
75 for ( ZyppPoolIterator sel_it = zyppPkgBegin();
76 sel_it != zyppPkgEnd();
79 ZyppSel sel = *sel_it;
81 if ( sel->installedObj() )
86 ZyppPkg installedPkg = tryCastToZyppPkg( sel->installedObj() );
89 _cache.insert( CachePair( installedPkg, sel ) );
92 zypp::ui::Selectable::available_iterator it = sel->availableBegin();
94 while ( it != sel->availableEnd() )
96 ZyppPkg pkg = tryCastToZyppPkg( *it );
99 _cache.insert( CachePair( pkg, sel ) );
105 yuiDebug() <<
"Building pkg -> selectable cache done" << endl;
115 NCPkgSelMapper::CacheIterator it = NCPkgSelMapper::_cache.find( pkg );
117 if ( it != NCPkgSelMapper::_cache.end() )
120 yuiWarning() <<
"No selectable found for package %s" << pkg->name().c_str() << endl;