1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
14 #include "zypp/base/Exception.h"
18 ///////////////////////////////////////////////////////////////////
20 { /////////////////////////////////////////////////////////////////
25 std::map<std::string,Rel::for_use_in_switch> _table;
27 Rel::for_use_in_switch parse( const std::string & strval_r )
32 _table["EQ"] = _table["eq"] = _table["=="] = _table["="] = Rel::EQ_e;
33 _table["NE"] = _table["ne"] = _table["!="] = Rel::NE_e;
34 _table["LT"] = _table["lt"] = _table["<"] = Rel::LT_e;
35 _table["LE"] = _table["le"] = _table["lte"] = _table["<="] = Rel::LE_e;
36 _table["GT"] = _table["gt"] = _table[">"] = Rel::GT_e;
37 _table["GE"] = _table["ge"] = _table["gte"] = _table[">="] = Rel::GE_e;
38 _table["ANY"] = _table["any"] = _table["(any)"] = _table[""] = Rel::ANY_e;
39 _table["NONE"] = _table["none"] = Rel::NONE_e;
42 std::map<std::string,Rel::for_use_in_switch>::const_iterator it
43 = _table.find( strval_r );
44 if ( it == _table.end() )
46 ZYPP_THROW( Exception("Rel parse: illegal string value '"+strval_r+"'") );
52 ///////////////////////////////////////////////////////////////////
54 const Rel Rel::EQ( Rel::EQ_e );
55 const Rel Rel::NE( Rel::NE_e );
56 const Rel Rel::LT( Rel::LT_e );
57 const Rel Rel::LE( Rel::LE_e );
58 const Rel Rel::GT( Rel::GT_e );
59 const Rel Rel::GE( Rel::GE_e );
60 const Rel Rel::ANY( Rel::ANY_e );
61 const Rel Rel::NONE( Rel::NONE_e );
63 ///////////////////////////////////////////////////////////////////
65 // METHOD NAME : Rel::Rel
66 // METHOD TYPE : Constructor
68 Rel::Rel( const std::string & strval_r )
69 : _op( parse( strval_r ) )
72 ///////////////////////////////////////////////////////////////////
74 // METHOD NAME : Rel::asString
75 // METHOD TYPE : const std::string &
77 const std::string & Rel::asString() const
79 static std::map<for_use_in_switch,std::string> _table;
89 _table[ANY_e] = "ANY";
90 _table[NONE_e] = "NONE";
95 /////////////////////////////////////////////////////////////////
97 ///////////////////////////////////////////////////////////////////