From: Michael Andres Date: Fri, 10 Apr 2009 11:19:27 +0000 (+0200) Subject: New Solvable::isKind overload to test whether a Solvable is within a range of kinds. X-Git-Tag: 6.6.0~35 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a25dec023033df363a4d8fdcb5947a3c805c3278;p=platform%2Fupstream%2Flibzypp.git New Solvable::isKind overload to test whether a Solvable is within a range of kinds. --- 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;