12 #ifndef ZYPP_BASE_NAMEDVALUE_H
13 #define ZYPP_BASE_NAMEDVALUE_H
40 template<
class _Tp, const
bool _WithAlias = true >
43 typedef std::map< std::string, _Tp >
NameMap;
58 typename NameMap::const_iterator it(
_nameMap.find( name_r ) );
65 bool getValue(
const std::string & name_r, _Tp & value_r )
const
67 typename NameMap::const_iterator it(
_nameMap.find( name_r ) );
74 const _Tp &
getValue(
const std::string & name_r )
const
83 bool haveName(
const std::string & value_r )
const
85 typename ValueMap::const_iterator it(
_valueMap.find( value_r ) );
92 bool getName(
const _Tp & value_r, std::string & name_r )
const
94 typename ValueMap::const_iterator it(
_valueMap.find( value_r ) );
101 const std::string &
getName(
const _Tp & value_r )
const
132 bool insert(
const _Tp & value_r,
const std::string & name_r )
134 typename NameMap::const_iterator nit(
_nameMap.find( name_r ) );
136 throw std::logic_error(
"NamedValue::insert name" );
138 typename ValueMap::const_iterator tit(
_valueMap.find( value_r ) );
142 throw std::logic_error(
"NamedValue::insert alias" );
161 #endif // ZYPP_BASE_NAMEDVALUE_H
const _Tp & getValue(const std::string &name_r) const
bool getValue(const std::string &name_r, _Tp &value_r) const
Get value mapped for name or alias.
std::map< _Tp, std::string > ValueMap
bool haveName(const std::string &value_r) const
Whether there is a name mapped for value_r.
_Inserter(NamedValue &parent_r, const _Tp &value_r)
bool getName(const _Tp &value_r, std::string &name_r) const
Get name of value.
const std::string & getName(const _Tp &value_r) const
_Inserter & operator|(const std::string &name_r)
_Inserter operator()(const _Tp &value_r)
bool insert(const _Tp &value_r, const std::string &name_r)
Remember name (1st call) or alias (subsequent calls).
bool empty() const
Whether not initialized (no (name,value) pair remembered)
bool haveValue(const std::string &name_r) const
Whether there is a value mapped for name_r.
std::map< std::string, _Tp > NameMap