From a25dec023033df363a4d8fdcb5947a3c805c3278 Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Fri, 10 Apr 2009 13:19:27 +0200 Subject: [PATCH] New Solvable::isKind overload to test whether a Solvable is within a range of kinds. --- zypp/sat/Solvable.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/zypp/sat/Solvable.h b/zypp/sat/Solvable.h index d0bbd01..68fbf59 100644 --- a/zypp/sat/Solvable.h +++ b/zypp/sat/Solvable.h @@ -149,12 +149,19 @@ namespace zypp IdString ident() const; ResKind kind() const; - /** Test whether a Solvable is of a certain \ref ResKind. */ - bool isKind( const ResKind & kind_r ) const; + /** Test whether a Solvable is of a certain \ref ResKind. + * The test is far cheaper than actually retriveing and + * comparing the \ref kind. + */ + bool isKind( const ResKind & kind_r ) const; /** \overload */ template bool isKind() const { return isKind( resKind<_Res>() ); } + /** \overload Extend the test to a range of \ref ResKind. */ + template + bool isKind( _Iterator begin, _Iterator end ) + { for_( it, begin, end ) if ( isKind( *it ) ) return true; return false; } std::string name() const; Edition edition() const; -- 2.7.4