1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
15 #include "zypp/base/Exception.h"
16 #include "zypp/base/String.h"
20 ///////////////////////////////////////////////////////////////////
22 { /////////////////////////////////////////////////////////////////
27 std::map<std::string,Dep::for_use_in_switch> _table;
29 Dep::for_use_in_switch parse( const std::string & strval_r )
34 _table["provides"] = Dep::PROVIDES_e;
35 _table["prerequires"] = Dep::PREREQUIRES_e;
36 _table["requires"] = Dep::REQUIRES_e;
37 _table["conflicts"] = Dep::CONFLICTS_e;
38 _table["obsoletes"] = Dep::OBSOLETES_e;
39 _table["recommends"] = Dep::RECOMMENDS_e;
40 _table["suggests"] = Dep::SUGGESTS_e;
41 _table["enhances"] = Dep::ENHANCES_e;
42 _table["supplements"] = Dep::SUPPLEMENTS_e;
45 std::map<std::string,Dep::for_use_in_switch>::const_iterator it
46 = _table.find( str::toLower( strval_r ) );
47 if ( it == _table.end() )
49 ZYPP_THROW( Exception("Dep parse: illegal string value '"+strval_r+"'") );
55 ///////////////////////////////////////////////////////////////////
57 const Dep Dep::PROVIDES ( Dep::PROVIDES_e );
58 const Dep Dep::PREREQUIRES( Dep::PREREQUIRES_e );
59 const Dep Dep::REQUIRES ( Dep::REQUIRES_e );
60 const Dep Dep::CONFLICTS ( Dep::CONFLICTS_e );
61 const Dep Dep::OBSOLETES ( Dep::OBSOLETES_e );
62 const Dep Dep::RECOMMENDS ( Dep::RECOMMENDS_e );
63 const Dep Dep::SUGGESTS ( Dep::SUGGESTS_e );
64 const Dep Dep::ENHANCES ( Dep::ENHANCES_e );
65 const Dep Dep::SUPPLEMENTS( Dep::SUPPLEMENTS_e );
67 ///////////////////////////////////////////////////////////////////
69 // METHOD NAME : Dep::Dep
72 Dep::Dep( const std::string & strval_r )
73 : _type( parse( strval_r ) )
76 ///////////////////////////////////////////////////////////////////
78 // METHOD NAME : Dep::asString
79 // METHOD TYPE : const std::string &
81 const std::string & Dep::asString() const
83 static std::map<for_use_in_switch,std::string> _table;
87 _table[PROVIDES_e] = "provides";
88 _table[PREREQUIRES_e] = "prerequires";
89 _table[REQUIRES_e] = "requires";
90 _table[CONFLICTS_e] = "conflicts";
91 _table[OBSOLETES_e] = "obsoletes";
92 _table[RECOMMENDS_e] = "recommends";
93 _table[SUGGESTS_e] = "suggests";
94 _table[ENHANCES_e] = "enhances";
95 _table[SUPPLEMENTS_e] = "supplements";
100 /////////////////////////////////////////////////////////////////
102 ///////////////////////////////////////////////////////////////////