#include <PoolItemBest.h>
Public Types | |
typedef boost::function< bool(const PoolItem &lhs, const PoolItem &rhs)> | Predicate |
Predicate returning True if lhs is a better choice. | |
typedef Container::size_type | size_type |
typedef Container::value_type | value_type |
typedef MapKVIteratorTraits < Container > ::Value_const_iterator | iterator |
typedef MapKVIteratorTraits < Container > ::Key_const_iterator | ident_iterator |
Public Member Functions | |
PoolItemBest () | |
Default ctor. | |
PoolItemBest (sat::Solvable slv_r) | |
Ctor feeding a sat::Solvable. | |
PoolItemBest (const PoolItem &pi_r) | |
Ctor feeding a PoolItem. | |
template<class _Iterator> | |
PoolItemBest (_Iterator begin_r, _Iterator end_r) | |
Ctor feeding a range of sat::Solvable or PoolItem. | |
void | add (sat::Solvable slv_r) |
Feed one sat::Solvable. | |
void | add (const PoolItem &pi_r) |
Feed one PoolItem. | |
template<class _Iterator> | |
void | add (_Iterator begin_r, _Iterator end_r) |
Feed a range of sat::Solvable or PoolItem. | |
Iterate the collected PoolItems. | |
bool | empty () const |
Whether PoolItems were collected. | |
size_type | size () const |
Number of PoolItems collected. | |
iterator | begin () const |
Pointer to the first PoolItem. | |
iterator | end () const |
Pointer behind the last PoolItem. | |
PoolItem | find (IdString ident_r) const |
Return the collected PoolItem with sat::Solvable::ident ident_r. | |
PoolItem | find (sat::Solvable slv_r) const |
PoolItem | find (const PoolItem &pi_r) const |
Iterate the collected PoolItems ident strings. | |
ident_iterator | identBegin () const |
Pointer to the first item. | |
ident_iterator | identEnd () const |
Pointer behind the last item. | |
Private Types | |
typedef std::tr1::unordered_map < IdString, PoolItem > | Container |
Private Member Functions | |
void | _ctor_init () |
const Container & | container () const |
RWCOW_pointer< Impl > & | pimpl () |
Pointer to implementation. | |
const RWCOW_pointer< Impl > & | pimpl () const |
Pointer to implementation. | |
Private Attributes | |
shared_ptr< void > | _dont_use_this_use_pimpl |
Avoid need to include Impl definition when inlined ctors (due to tepmlate) are provided. | |
Related Functions | |
(Note that these are not member functions.) | |
std::ostream & | operator<< (std::ostream &str, const PoolItemBest &obj) |
Classes | |
struct | Impl |
PoolItemBest implementation. More... |
in a PoolQuery result.
The class basically maintains a map<IdString,PoolItem>
and remembers for each ident
(sat::Solvable::ident) the best PoolItem that was added.
The default Predicate to determine the best choice is the same that sorts the ui::Selectable list of available objects, thus follows the same rules the resolver will apply.
PoolQuery q; q.addAttribute(sat::SolvAttr::name, "lib*"); q.setMatchGlob(); // get the best matches and tag them for installation: PoolItemBest bestMatches( q.begin(), q.end() ); if ( ! bestMatches.empty() ) { for_( it, bestMatches.begin(), bestMatches.end() ) { ui::asSelectable()( *it )->setOnSystem( *it, ResStatus::USER ); } }
Definition at line 60 of file PoolItemBest.h.
typedef std::tr1::unordered_map<IdString,PoolItem> zypp::PoolItemBest::Container [private] |
Definition at line 62 of file PoolItemBest.h.
typedef boost::function<bool ( const PoolItem & lhs, const PoolItem & rhs )> zypp::PoolItemBest::Predicate |
typedef Container::size_type zypp::PoolItemBest::size_type |
Definition at line 67 of file PoolItemBest.h.
typedef Container::value_type zypp::PoolItemBest::value_type |
Definition at line 68 of file PoolItemBest.h.
typedef MapKVIteratorTraits<Container>::Value_const_iterator zypp::PoolItemBest::iterator |
Definition at line 69 of file PoolItemBest.h.
typedef MapKVIteratorTraits<Container>::Key_const_iterator zypp::PoolItemBest::ident_iterator |
Definition at line 70 of file PoolItemBest.h.
zypp::PoolItemBest::PoolItemBest | ( | ) | [inline] |
zypp::PoolItemBest::PoolItemBest | ( | sat::Solvable | slv_r | ) | [inline] |
Ctor feeding a sat::Solvable.
Definition at line 78 of file PoolItemBest.h.
References _ctor_init().
zypp::PoolItemBest::PoolItemBest | ( | const PoolItem & | pi_r | ) | [inline] |
zypp::PoolItemBest::PoolItemBest | ( | _Iterator | begin_r, | |
_Iterator | end_r | |||
) | [inline] |
Ctor feeding a range of sat::Solvable or PoolItem.
Definition at line 87 of file PoolItemBest.h.
References _ctor_init().
void zypp::PoolItemBest::add | ( | sat::Solvable | slv_r | ) | [inline] |
void zypp::PoolItemBest::add | ( | const PoolItem & | pi_r | ) |
Feed one PoolItem.
Definition at line 53 of file PoolItemBest.cc.
References container(), zypp::sat::Solvable::ident(), pimpl(), and zypp::PoolItem::satSolvable().
void zypp::PoolItemBest::add | ( | _Iterator | begin_r, | |
_Iterator | end_r | |||
) | [inline] |
Feed a range of sat::Solvable or PoolItem.
Definition at line 100 of file PoolItemBest.h.
References for_.
bool zypp::PoolItemBest::empty | ( | ) | const [inline] |
Whether PoolItems were collected.
Definition at line 110 of file PoolItemBest.h.
References container().
size_type zypp::PoolItemBest::size | ( | ) | const [inline] |
Number of PoolItems collected.
Definition at line 112 of file PoolItemBest.h.
References container().
Referenced by zypp::operator<<().
iterator zypp::PoolItemBest::begin | ( | ) | const [inline] |
Pointer to the first PoolItem.
Definition at line 114 of file PoolItemBest.h.
References container(), and zypp::make_map_value_begin().
Referenced by zypp::operator<<().
iterator zypp::PoolItemBest::end | ( | ) | const [inline] |
Pointer behind the last PoolItem.
Definition at line 116 of file PoolItemBest.h.
References container(), and zypp::make_map_value_end().
Referenced by zypp::operator<<().
Return the collected PoolItem with sat::Solvable::ident ident_r.
Definition at line 61 of file PoolItemBest.cc.
References container(), and pimpl().
Referenced by find().
PoolItem zypp::PoolItemBest::find | ( | sat::Solvable | slv_r | ) | const [inline] |
Definition at line 123 of file PoolItemBest.h.
References find(), zypp::sat::Solvable::ident(), and zypp::PoolItem::satSolvable().
ident_iterator zypp::PoolItemBest::identBegin | ( | ) | const [inline] |
Pointer to the first item.
Definition at line 129 of file PoolItemBest.h.
References container(), and zypp::make_map_key_begin().
ident_iterator zypp::PoolItemBest::identEnd | ( | ) | const [inline] |
Pointer behind the last item.
Definition at line 131 of file PoolItemBest.h.
References container(), and zypp::make_map_key_end().
void zypp::PoolItemBest::_ctor_init | ( | ) | [private] |
Definition at line 47 of file PoolItemBest.cc.
References _dont_use_this_use_pimpl.
Referenced by PoolItemBest().
const PoolItemBest::Container & zypp::PoolItemBest::container | ( | ) | const [private] |
Definition at line 50 of file PoolItemBest.cc.
References pimpl().
Referenced by add(), begin(), empty(), end(), find(), identBegin(), identEnd(), and size().
RWCOW_pointer<Impl>& zypp::PoolItemBest::pimpl | ( | ) | [inline, private] |
Pointer to implementation.
Definition at line 141 of file PoolItemBest.h.
References _dont_use_this_use_pimpl.
Referenced by add(), container(), and find().
const RWCOW_pointer<Impl>& zypp::PoolItemBest::pimpl | ( | ) | const [inline, private] |
Pointer to implementation.
Definition at line 143 of file PoolItemBest.h.
References _dont_use_this_use_pimpl.
std::ostream & operator<< | ( | std::ostream & | str, | |
const PoolItemBest & | obj | |||
) | [related] |
Stream output
Definition at line 73 of file PoolItemBest.cc.
shared_ptr<void> zypp::PoolItemBest::_dont_use_this_use_pimpl [private] |
Avoid need to include Impl definition when inlined ctors (due to tepmlate) are provided.
Definition at line 145 of file PoolItemBest.h.
Referenced by _ctor_init(), and pimpl().