1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
14 #include "zypp/base/Exception.h"
20 ///////////////////////////////////////////////////////////////////
22 { /////////////////////////////////////////////////////////////////
27 map<string,Rel::for_use_in_switch> _table;
29 Rel::for_use_in_switch parse( const std::string & strval_r )
34 _table["EQ"] = _table["eq"] = _table["=="] = _table["="] = Rel::EQ_e;
35 _table["NE"] = _table["ne"] = _table["!="] = Rel::NE_e;
36 _table["LT"] = _table["lt"] = _table["<"] = Rel::LT_e;
37 _table["LE"] = _table["le"] = _table["<="] = Rel::LE_e;
38 _table["GT"] = _table["gt"] = _table[">"] = Rel::GT_e;
39 _table["GE"] = _table["ge"] = _table[">="] = Rel::GE_e;
40 _table["ANY"] = _table["any"] = _table[""] = Rel::ANY_e;
41 _table["NONE"] = _table["none"] = Rel::NONE_e;
44 map<string,Rel::for_use_in_switch>::const_iterator it
45 = _table.find( strval_r );
46 if ( it == _table.end() )
48 ZYPP_THROW( "Rel parse: illegal string value" );
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 map<for_use_in_switch,string> _table;
89 _table[ANY_e] = "ANY";
90 _table[NONE_e] = "NONE";
95 /////////////////////////////////////////////////////////////////
97 ///////////////////////////////////////////////////////////////////