libzypp  10.5.0
SolvIterMixin.cc
Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 //#include <iostream>
00013 //#include "zypp/base/Logger.h"
00014 
00015 #include "zypp/sat/SolvIterMixin.h"
00016 #include "zypp/sat/Solvable.h"
00017 #include "zypp/ResPoolProxy.h"
00018 #include "zypp/pool/PoolTraits.h"
00019 
00020 using std::endl;
00021 
00023 namespace zypp
00024 { 
00025 
00026   namespace sat
00027   { 
00028 
00029     namespace solvitermixin_detail
00030     {
00031       bool UnifyByIdent::operator()( const Solvable & solv_r ) const
00032       {
00033         // Need to use pool::ByIdent because packages and srcpackages have the same id.
00034         return( solv_r && _uset->insert( pool::ByIdent( solv_r ).get() ).second );
00035       }
00036     }
00037 
00039     // asSolvable
00041     Solvable asSolvable::operator()( const PoolItem & pi_r ) const
00042     {
00043       return pi_r.satSolvable();
00044     }
00045 
00046     Solvable asSolvable::operator()( const ResObject_constPtr & res_r ) const
00047     {
00048       return res_r ? res_r->satSolvable() : Solvable();
00049     }
00050 
00052   } // namespace sat
00054 
00056   namespace ui
00057   { 
00058 
00059     Selectable_Ptr asSelectable::operator()( const sat::Solvable & sov_r ) const
00060     {
00061       return ResPool::instance().proxy().lookup( sov_r );
00062     }
00063 
00065   } // namespace ui
00068 } // namespace zypp