11 #ifndef ZYPP_BASE_SETRELATIONMIXIN_H 12 #define ZYPP_BASE_SETRELATIONMIXIN_H 43 inline std::ostream &
operator<<( std::ostream &
str,
const SetCompare::Enum & obj )
47 {
return str << obj.asEnum(); }
74 inline std::ostream &
operator<<( std::ostream &
str,
const SetRelation::Enum & obj )
78 {
return str << obj.asEnum(); }
81 inline bool operator==(
const SetRelation::Enum & lhs,
const SetCompare::Enum & rhs )
82 {
return( static_cast<int>(lhs)&static_cast<int>(rhs) || !(static_cast<int>(lhs)|static_cast<int>(rhs)) ); }
85 {
return( lhs == rhs.asEnum() ); }
88 {
return( lhs.asEnum() == rhs ); }
91 {
return( lhs.asEnum() == rhs.asEnum() ); }
93 inline bool operator==(
const SetCompare::Enum & lhs,
const SetRelation::Enum & rhs )
94 {
return( rhs == lhs ); }
97 {
return( rhs == lhs ); }
100 {
return( rhs == lhs ); }
103 {
return( rhs == lhs ); }
106 inline bool operator!=(
const SetRelation::Enum & lhs,
const SetCompare::Enum & rhs )
107 {
return !( lhs == rhs ); }
110 {
return !( lhs == rhs ); }
113 {
return !( lhs == rhs ); }
116 {
return !( lhs == rhs ); }
118 inline bool operator!=(
const SetCompare::Enum & lhs,
const SetRelation::Enum & rhs )
119 {
return !( lhs == rhs ); }
122 {
return !( lhs == rhs ); }
125 {
return !( lhs == rhs ); }
128 {
return !( lhs == rhs ); }
143 template <
class Derived>
149 {
return derived().setRelationMixinCompare( trg ); }
156 {
return compare( trg ) == cmp; }
159 {
return compare( trg ) == cmp; }
163 {
return compare( trg ) == rel; }
166 {
return compare( trg ) == rel; }
177 {
return *
static_cast<const Derived*
>( this ); }
181 template <
class Derived>
186 template <
class Derived>
188 {
return src.
compare( trg, cmp ); }
191 template <
class Derived>
193 {
return src.
compare( trg, rel ); }
196 template <
class Derived>
198 {
return src.
compare( trg, SetRelation::equal ); }
201 template <
class Derived>
203 {
return !( src == trg ); }
212 #define SETRELATIONMIXIN_DEFINE_COMPARE_BETWEEN(DERIVED_TYPE,OTHER_TYPE) \ 213 inline SetCompare compare( const base::SetRelationMixin<DERIVED_TYPE> & src, OTHER_TYPE trg ) \ 214 { return src.compare( DERIVED_TYPE(trg) ); } \ 215 inline SetCompare compare( OTHER_TYPE src, const base::SetRelationMixin<DERIVED_TYPE> & trg ) \ 216 { return DERIVED_TYPE(src).compare( trg ); } \ 218 inline bool compare( const base::SetRelationMixin<DERIVED_TYPE> & src, OTHER_TYPE trg, SetCompare cmp ) \ 219 { return src.compare( DERIVED_TYPE(trg), cmp ); } \ 220 inline bool compare( OTHER_TYPE src, const base::SetRelationMixin<DERIVED_TYPE> & trg, SetCompare cmp ) \ 221 { return DERIVED_TYPE(src).compare( trg, cmp ); } \ 223 inline bool compare( const base::SetRelationMixin<DERIVED_TYPE> & src, OTHER_TYPE trg, SetRelation rel ) \ 224 { return src.compare( DERIVED_TYPE(trg), rel ); } \ 225 inline bool compare( OTHER_TYPE src, const base::SetRelationMixin<DERIVED_TYPE> & trg, SetRelation rel ) \ 226 { return DERIVED_TYPE(src).compare( trg, rel ); } \ 228 inline bool operator==( const base::SetRelationMixin<DERIVED_TYPE> & src, OTHER_TYPE trg ) \ 229 { return src.compare( DERIVED_TYPE(trg), SetRelation::equal ); } \ 230 inline bool operator==( OTHER_TYPE src, const base::SetRelationMixin<DERIVED_TYPE> & trg ) \ 231 { return DERIVED_TYPE(src).compare( trg, SetRelation::equal ); } \ 233 inline bool operator!=( const base::SetRelationMixin<DERIVED_TYPE> & src, OTHER_TYPE trg ) \ 234 { return !( src == trg ); } \ 235 inline bool operator!=( OTHER_TYPE src, const base::SetRelationMixin<DERIVED_TYPE> & trg ) \ 236 { return !( src == trg ); } 242 #endif // ZYPP_BASE_SETRELATIONMIXIN_H bool compare(const SetRelationMixin< Derived > &trg, SetRelation rel) const
Set Relation based on SetCompare (use like 'enum class SetRelation') Comparison (== !=) between SetRe...
bool operator==(const Capability &lhs, const Capability &rhs)
relates: Capability
base::EnumClass< ESetRelationDef > SetRelation
relates: ESetRelationDef typedef 'enum class SetRelation'
DEFAULT_COPYABLE(SetRelationMixin)
std::string asString(const Patch::Category &obj)
relates: Patch::Category string representation.
base::EnumClass< ESetCompareDef > SetCompare
relates: ESetCompareDef typedef 'enum class SetCompare'
bool compare(const SetRelationMixin< Derived > &trg, SetCompare cmp) const
const Derived & derived() const
Access to sublass Derived.
String related utilities and Regular expression matching.
bool compare(const Derived &trg, SetCompare cmp) const
Compare sets and match against SetCompare.
static const std::string & asString(Enum val_r) ZYPP_API
String representantion.
SetCompare compare(const SetRelationMixin< Derived > &src, const SetRelationMixin< Derived > &trg)
relates: SetRelationMixin Compare sets
const Arch Arch_empty ZYPP_API
relates: Arch This is an empty Arch represented by an empty string.
DEFAULT_MOVABLE(SetRelationMixin)
bool operator!=(const Capability &lhs, const Capability &rhs)
relates: Capability
bool compare(const Derived &trg, SetRelation rel) const
Compare sets and match against SetRelation.
bool operator==(const SetRelationMixin< Derived > &src, const SetRelationMixin< Derived > &trg)
relates: SetRelationMixin Equal
bool operator!=(const SetRelationMixin< Derived > &src, const SetRelationMixin< Derived > &trg)
relates: SetRelationMixin Unequal
SetCompare compare(const SetRelationMixin< Derived > &trg) const
static const std::string & asString(Enum val_r) ZYPP_API
String representantion.
SetCompare compare(const Derived &trg) const
Compare sets.
std::ostream & operator<<(std::ostream &str, const Capabilities &obj)
relates: Capabilities Stream output
Provide set relation methods based on Derived::setRelationMixinCompare A class using this mixin must ...
Easy-to use interface to the ZYPP dependency resolver.
Result of set comparison (use like 'enum class SetCompare') This is the type a compare function shoul...