From fd3b691d296af8004a46f278aeb89d68c76f49a8 Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Tue, 8 Dec 2009 19:00:03 +0100 Subject: [PATCH] Add Solvable/PoolItem test for sameNVRA. --- zypp/PoolItem.h | 12 ++++++++++++ zypp/sat/Solvable.h | 9 ++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/zypp/PoolItem.h b/zypp/PoolItem.h index bf10d7d..ff5d923 100644 --- a/zypp/PoolItem.h +++ b/zypp/PoolItem.h @@ -198,6 +198,18 @@ namespace zypp { return lhs.identical( rhs.satSolvable() ); } + /** \relates PoolItem Test for same name version release and arch. */ + inline bool sameNVRA( const PoolItem & lhs, const PoolItem & rhs ) + { return lhs == rhs || lhs.satSolvable().sameNVRA( rhs.satSolvable() ); } + + /** \relates PoolItem Test for same name version release and arch. */ + inline bool sameNVRA( const PoolItem & lhs, sat::Solvable rhs ) + { return lhs.satSolvable().sameNVRA( rhs ); } + + /** \relates PoolItem Test for same name version release and arch. */ + inline bool sameNVRA( sat::Solvable lhs, const PoolItem & rhs ) + { return lhs.sameNVRA( rhs.satSolvable() ); } + /** Solvable to PoolItem transform functor. * \relates PoolItem * \relates sat::SolvIterMixin diff --git a/zypp/sat/Solvable.h b/zypp/sat/Solvable.h index 4637d2f..85f55a7 100644 --- a/zypp/sat/Solvable.h +++ b/zypp/sat/Solvable.h @@ -191,7 +191,11 @@ namespace zypp */ bool identical( Solvable rhs ) const; - public: + /** Test for same name-version-release.arch */ + bool sameNVRA( Solvable rhs ) const + { return( ident() == rhs.ident() && edition() == rhs.edition() && arch() == rhs.arch() ); } + + public: /** \name Access to the \ref Solvable dependencies. * @@ -308,6 +312,9 @@ namespace zypp inline bool identical( Solvable lhs, Solvable rhs ) { return lhs.identical( rhs ); } + /** \relates Solvable Test for same name version release and arch. */ + inline bool sameNVRA( Solvable lhs, Solvable rhs ) + { return lhs.sameNVRA( rhs ); } /////////////////////////////////////////////////////////////////// namespace detail -- 2.7.4