From: Michael Andres Date: Fri, 3 Mar 2006 14:01:25 +0000 (+0000) Subject: - Added Logical functor chaining _ACondition OR _BCondition: X-Git-Tag: BASE-SuSE-SLE-10-SP2-Branch~1708 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a7b4f945b651d9a1044e19542fa971d04c252a23;p=platform%2Fupstream%2Flibzypp.git - Added Logical functor chaining _ACondition OR _BCondition: functor::Or<_ACondition, _BCondition> or_c( _ACondition conda_r, _BCondition condb_r ); --- diff --git a/zypp/base/Functional.h b/zypp/base/Functional.h index 79dff2a..a496a1d 100644 --- a/zypp/base/Functional.h +++ b/zypp/base/Functional.h @@ -257,6 +257,35 @@ namespace zypp return Not<_Condition>( cond_r ); } + /** Logical functor chaining \a _ACondition \c OR \a _BCondition. + */ + template + struct Or + { + Or( _ACondition conda_r, _BCondition condb_r ) + : _conda( conda_r ) + , _condb( condb_r ) + {} + + template + bool operator()( _Tp t ) const + { + return _conda( t ) || _condb( t ); + } + + _ACondition _conda; + _BCondition _condb; + }; + + /** Convenience function for creating a Or from two conditions + * \a conda_r OR \a condb_r. + */ + template + inline Or<_ACondition, _BCondition> or_c( _ACondition conda_r, _BCondition condb_r ) + { + return Or<_ACondition, _BCondition>( conda_r, condb_r ); + } + /** Logical functor chaining \a _ACondition \c AND \a _BCondition. */ template