From b2f5dadc7e3fef7a1a662ad268e8bbada705d5c7 Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Tue, 13 Sep 2011 10:56:15 +0200 Subject: [PATCH] Add Selectable::identical{Available,Installed}Obj --- zypp/ui/Selectable.cc | 6 ++++++ zypp/ui/Selectable.h | 11 +++++++++++ zypp/ui/SelectableImpl.h | 20 ++++++++++++++------ 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/zypp/ui/Selectable.cc b/zypp/ui/Selectable.cc index 8965f87..6c87fc1 100644 --- a/zypp/ui/Selectable.cc +++ b/zypp/ui/Selectable.cc @@ -88,6 +88,12 @@ namespace zypp bool Selectable::identicalInstalled( const PoolItem & rhs ) const { return _pimpl->identicalInstalled( rhs ); } + PoolItem Selectable::identicalAvailableObj( const PoolItem & rhs ) const + { return _pimpl->identicalAvailableObj( rhs ); } + + PoolItem Selectable::identicalInstalledObj( const PoolItem & rhs ) const + { return _pimpl->identicalInstalledObj( rhs ); } + PoolItem Selectable::setCandidate( const PoolItem & newCandidate_r, ResStatus::TransactByValue causer_r ) { return _pimpl->setCandidate( newCandidate_r, causer_r ); } diff --git a/zypp/ui/Selectable.h b/zypp/ui/Selectable.h index 6a9d4ea..897155e 100644 --- a/zypp/ui/Selectable.h +++ b/zypp/ui/Selectable.h @@ -174,6 +174,17 @@ namespace zypp bool identicalInstalledUpdateCandidate() const { return identicalInstalled( updateCandidateObj() ); } + /** Return an available Object with the same content as \c rhs. + * Basically the same name, edition, arch, vendor and buildtime. + * \see \ref sat::Solvable::identical + */ + PoolItem identicalAvailableObj( const PoolItem & rhs ) const; + + /** \Return an installed Object with the same content as \c rhs. + * Basically the same name, edition, arch, vendor and buildtime. + * \see \ref sat::Solvable::identical + */ + PoolItem identicalInstalledObj( const PoolItem & rhs ) const; /** Return the \ref installedObj resolvable casted to a specific kind. * \code diff --git a/zypp/ui/SelectableImpl.h b/zypp/ui/SelectableImpl.h index efba04d..d6d3596 100644 --- a/zypp/ui/SelectableImpl.h +++ b/zypp/ui/SelectableImpl.h @@ -187,30 +187,38 @@ namespace zypp /** \copydoc Selectable::identicalAvailable( const PoolItem & )const */ bool identicalAvailable( const PoolItem & rhs ) const + { return identicalAvailableObj( rhs ); } + + /** \copydoc Selectable::identicalInstalled( const PoolItem & )const */ + bool identicalInstalled( const PoolItem & rhs ) const + { return identicalInstalledObj( rhs ); } + + /** \copydoc Selectable::identicalAvailableObj( const PoolItem & rhs ) const */ + PoolItem identicalAvailableObj( const PoolItem & rhs ) const { if ( !availableEmpty() && rhs ) { for_( it, _availableItems.begin(), _availableItems.end() ) { if ( identical( *it, rhs ) ) - return true; + return *it; } } - return false; + return PoolItem(); } - /** \copydoc Selectable::identicalInstalled( const PoolItem & )const */ - bool identicalInstalled( const PoolItem & rhs ) const + /** \copydoc Selectable::identicalInstalledObj( const PoolItem & rhs ) const */ + PoolItem identicalInstalledObj( const PoolItem & rhs ) const { if ( !installedEmpty() && rhs ) { for_( it, _installedItems.begin(), _installedItems.end() ) { if ( identical( *it, rhs ) ) - return true; + return *it; } } - return false; + return PoolItem(); } /** Best among all objects. */ -- 2.7.4