ref: refs/heads/master
commit 05f2f9c675b9c08f24d9d0c9f1f47371a3c35b17
Author: Michael Andres
Date: Thu Oct 22 14:31:10 2009 +0200
Selectable: add candidateObjFrom: The best candidate provided by a specific Repository.
---
zypp/ui/Selectable.cc | 3 +++
zypp/ui/Selectable.h | 8 ++++++++
zypp/ui/SelectableImpl.h | 15 +++++++++++++++
3 files changed, 26 insertions(+), 0 deletions(-)
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
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org