libzypp  17.35.19
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 
19 namespace zypp
20 {
21 
23  //
24  // CLASS NAME : CapMatch
25  //
39  {
40  enum Result { NOMATCH, MATCH, IRRELEVANT };
41 
42  public:
43 
45  : _result( IRRELEVANT )
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  };
95 
97  std::ostream & operator<<( std::ostream & str, const CapMatch & obj ) ZYPP_API;
98 
100 } // namespace zypp
102 #endif // ZYPP_CAPMATCH_H
Result _result
Definition: CapMatch.h:92
static const CapMatch no
Definition: CapMatch.h:53
String related utilities and Regular expression matching.
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
Definition: SerialNumber.cc:52
friend CapMatch operator||(const CapMatch &lhs, const CapMatch &rhs)
Definition: CapMatch.h:79
static const CapMatch irrelevant
Definition: CapMatch.h:54
CapMatch(bool val_r)
Definition: CapMatch.h:48
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition: ResTraits.h:93
friend bool operator==(const CapMatch &lhs, const CapMatch &rhs)
Definition: CapMatch.h:56
Tri state Capability match result.
Definition: CapMatch.h:38
friend CapMatch operator!(const CapMatch &lhs)
Definition: CapMatch.h:62
RepoStatus operator &&(const RepoStatus &lhs, const RepoStatus &rhs)
Definition: RepoStatus.cc:243
static const CapMatch yes
Definition: CapMatch.h:52
Easy-to use interface to the ZYPP dependency resolver.
Definition: Application.cc:19
friend bool operator!=(const CapMatch &lhs, const CapMatch &rhs)
Definition: CapMatch.h:59
ZYppCommitResult & _result
Definition: TargetImpl.cc:1610