#include "zypp/solver/detail/Helper.h"
+#include "zypp/CapSet.h"
+#include "zypp/base/Logger.h"
+#include "zypp/base/String.h"
+#include "zypp/base/Gettext.h"
+
+#include "zypp/base/Algorithm.h"
+#include "zypp/ResPool.h"
+#include "zypp/ResFilters.h"
+#include "zypp/CapFilters.h"
+
+using namespace std;
+
/////////////////////////////////////////////////////////////////////////
namespace zypp
{ ///////////////////////////////////////////////////////////////////////
namespace detail
{ ///////////////////////////////////////////////////////////////////
-PoolItem
-Helper::findInstalledItem (const ResPool *pool, PoolItem_Ref item)
+ostream &
+operator<< (ostream & os, const PoolItemList & itemlist)
{
- struct LookForUpgrades : public resfilter::OnCapMatchCallbackFunctor
- {
- PoolItem_Ref installed;
+ for (PoolItemList::const_iterator iter = itemlist.begin(); iter != itemlist.end(); ++iter) {
+ if (iter != itemlist.begin())
+ os << ", ";
+ os << *iter;
+ }
+ return os;
+}
- LookForUpgrades ()
- { }
- bool operator()( PoolItem_Ref & provider )
- {
- installed = provider;
- return false; // stop here, we found it
- }
- };
+struct LookForUpgrades : public resfilter::OnCapMatchCallbackFunctor, public resfilter::PoolItemFilterFunctor
+{
+ PoolItem_Ref installed;
+ LookForUpgrades ()
+ { }
+
+ bool operator()( PoolItem_Ref provider )
+ {
+ installed = provider;
+ return false; // stop here, we found it
+ }
+};
+
+
+PoolItem
+Helper::findInstalledItem (const ResPool *pool, PoolItem_Ref item)
+{
LookForUpgrades info;
- invokeOnEach( pool->byNameBegin( item->name() ), pool->byNameEnd( item->name() ),
- functor::chain( resfilter::ByStatus ( ResStatus::INSTALLED ),
- resfilter::ByKind( item->kind() ),
- resfilter::ByEdition<CompareByLT<Edition> >( item->edition() ),
- info );
+ invokeOnEach( pool->byNameBegin( item->name() ),
+ pool->byNameEnd( item->name() ),
+ functor::chain( resfilter::ByInstalled (),
+ functor::chain (resfilter::ByKind( item->kind() ),
+ resfilter::byEdition<CompareByLT<Edition> >( item->edition() ) ) ),
+ functor::functorRef<bool,PoolItem> (info) );
return info.installed;
}