libzypp 17.37.17
CapMatch.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_CAPMATCH_H
13#define ZYPP_CAPMATCH_H
14
15#include <iosfwd>
16#include <zypp/Globals.h>
17
19namespace zypp
20{
21
23 //
24 // CLASS NAME : CapMatch
25 //
39 {
41
42 public:
43
46 {}
47
48 CapMatch( bool val_r )
49 : _result( val_r ? MATCH : NOMATCH )
50 {}
51
52 static const CapMatch yes;
53 static const CapMatch no;
54 static const CapMatch irrelevant;
55
56 friend bool operator==( const CapMatch & lhs, const CapMatch & rhs )
57 { return lhs._result == rhs._result; }
58
59 friend bool operator!=( const CapMatch & lhs, const CapMatch & rhs )
60 { return lhs._result != rhs._result; }
61
62 friend CapMatch operator!( const CapMatch & lhs )
63 {
64 if ( lhs._result == CapMatch::IRRELEVANT )
65 return lhs;
66 return !(lhs._result == CapMatch::MATCH);
67 }
68
69 friend CapMatch operator&&( const CapMatch & lhs, const CapMatch & rhs )
70 {
71 if ( lhs._result == CapMatch::IRRELEVANT )
72 return rhs;
73 if ( rhs._result == CapMatch::IRRELEVANT )
74 return lhs;
75 return (lhs._result == CapMatch::MATCH)
76 && (rhs._result == CapMatch::MATCH);
77 }
78
79 friend CapMatch operator||( const CapMatch & lhs, const CapMatch & rhs )
80 {
81 if ( lhs._result == CapMatch::IRRELEVANT )
82 return rhs;
83 if ( rhs._result == CapMatch::IRRELEVANT )
84 return lhs;
85 return (lhs._result == CapMatch::MATCH)
86 || (rhs._result == CapMatch::MATCH);
87 }
88
89 friend std::ostream & operator<<( std::ostream & str, const CapMatch & obj );
90
91 private:
93 };
94
95
97 std::ostream & operator<<( std::ostream & str, const CapMatch & obj ) ZYPP_API;
98
100} // namespace zypp
102#endif // ZYPP_CAPMATCH_H
Tri state Capability match result.
Definition CapMatch.h:39
friend bool operator!=(const CapMatch &lhs, const CapMatch &rhs)
Definition CapMatch.h:59
friend bool operator==(const CapMatch &lhs, const CapMatch &rhs)
Definition CapMatch.h:56
Result _result
Definition CapMatch.h:92
static const CapMatch no
Definition CapMatch.h:53
static const CapMatch irrelevant
Definition CapMatch.h:54
static const CapMatch yes
Definition CapMatch.h:52
CapMatch(bool val_r)
Definition CapMatch.h:48
friend CapMatch operator!(const CapMatch &lhs)
Definition CapMatch.h:62
friend CapMatch operator&&(const CapMatch &lhs, const CapMatch &rhs)
Definition CapMatch.h:69
friend CapMatch operator||(const CapMatch &lhs, const CapMatch &rhs)
Definition CapMatch.h:79
String related utilities and Regular expression matching.
Easy-to use interface to the ZYPP dependency resolver.
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition Arch.h:247