00001
00002
00003
00004
00005
00006
00007
00008
00012 #ifndef ZYPP_REL_H
00013 #define ZYPP_REL_H
00014
00015 #include <iosfwd>
00016 #include <string>
00017
00019 namespace zypp
00020 {
00021
00023
00024
00025
00043 struct Rel
00044 {
00050 static const Rel EQ;
00051 static const Rel NE;
00052 static const Rel LT;
00053 static const Rel LE;
00054 static const Rel GT;
00055 static const Rel GE;
00056 static const Rel ANY;
00057 static const Rel NONE;
00059
00063 enum for_use_in_switch { EQ_e, NE_e, LT_e, LE_e, GT_e, GE_e, ANY_e, NONE_e };
00064
00066 Rel()
00067 : _op( ANY_e )
00068 {}
00069
00080 explicit
00081 Rel( const std::string & strval_r );
00082
00086 const std::string & asString() const;
00087
00107 for_use_in_switch inSwitch() const
00108 { return _op; }
00109
00110 private:
00112 Rel( for_use_in_switch op_r )
00113 : _op( op_r )
00114 {}
00116 for_use_in_switch _op;
00117 };
00119
00121 inline std::ostream & operator<<( std::ostream & str, const Rel & obj )
00122 { return str << obj.asString(); }
00123
00125
00127 inline bool operator==( const Rel & lhs, const Rel & rhs )
00128 { return lhs.inSwitch() == rhs.inSwitch(); }
00129
00131 inline bool operator!=( const Rel & lhs, const Rel & rhs )
00132 { return ! ( lhs == rhs ); }
00133
00135 }
00137 #endif // ZYPP_REL_H