From: Michael Andres Date: Thu, 22 Oct 2009 12:31:10 +0000 (+0200) Subject: Selectable: add candidateObjFrom: The best candidate provided by a specific Repository. X-Git-Tag: 6.19.3~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=05f2f9c675b9c08f24d9d0c9f1f47371a3c35b17;p=platform%2Fupstream%2Flibzypp.git Selectable: add candidateObjFrom: The best candidate provided by a specific Repository. --- diff --git a/zypp/ui/Selectable.cc b/zypp/ui/Selectable.cc index 62bf2ea..2f2cba0 100644 --- a/zypp/ui/Selectable.cc +++ b/zypp/ui/Selectable.cc @@ -73,6 +73,9 @@ namespace zypp PoolItem Selectable::candidateObj() const { return _pimpl->candidateObj(); } + PoolItem Selectable::candidateObjFrom( Repository repo_r ) const + { return _pimpl->candidateObjFrom( repo_r ); } + PoolItem Selectable::updateCandidateObj() const { return _pimpl->updateCandidateObj(); } diff --git a/zypp/ui/Selectable.h b/zypp/ui/Selectable.h index c5cd548..92b0bf5 100644 --- a/zypp/ui/Selectable.h +++ b/zypp/ui/Selectable.h @@ -125,6 +125,13 @@ namespace zypp */ PoolItem candidateObj() const; + /** The best candidate provided by a specific \ref Repository, if there is one. + * In contrary to \ref candidateObj, this may return no item even if + * there are available objects. This simply means the \ref Repository + * does not provide this object. + */ + PoolItem candidateObjFrom( Repository repo_r ) const; + /** The best candidate for update, if there is one. * In contrary to \ref candidateObj, this may return no item even if * there are available objects. This simply means the best object is @@ -133,6 +140,7 @@ namespace zypp */ PoolItem updateCandidateObj() const; + /** Return the \ref installedObj resolvable casted to a specific kind. * \code * Selectable mySelectable; diff --git a/zypp/ui/SelectableImpl.h b/zypp/ui/SelectableImpl.h index 53f4db8..c74ed90 100644 --- a/zypp/ui/SelectableImpl.h +++ b/zypp/ui/SelectableImpl.h @@ -117,6 +117,21 @@ namespace zypp */ PoolItem setCandidate( const PoolItem & newCandidate_r, ResStatus::TransactByValue causer_r ); + /** The best candidate provided by a specific \ref Repository, if there is one. + * In contrary to \ref candidateObj, this may return no item even if + * there are available objects. This simply means the \ref Repository + * does not provide this object. + */ + PoolItem candidateObjFrom( Repository repo_r ) const + { + for_( it, availableBegin(), availableEnd() ) + { + if ( (*it)->repository() == repo_r ) + return *it; + } + return PoolItem(); + } + /** The best candidate for update, if there is one. * In contrary to \ref candidateObj, this may return no item even if * there are available objects. This simply means the best object is