Simple value<>name mapping supporting aliases.
More...
#include <base/NamedValue.h>
|
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.
|
|
bool | getValue (const std::string &name_r, Tp &value_r) const |
| Get value mapped for name or alias.
|
|
const Tp & | getValue (const std::string &name_r) const |
|
|
bool | haveName (const std::string &value_r) const |
| Whether there is a name mapped for 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 |
|
|
typedef std::map< std::string, Tp > | NameMap |
|
typedef std::map< Tp, std::string > | ValueMap |
|
template<class Tp, const
bool _tWithAlias = true>
class zypp::NamedValue< Tp, _tWithAlias >
Simple value<>name mapping supporting aliases.
enum Commands {
CMD_1,
CMD_2
};
clist( CMD_1 ) | "cmd1";
clist( CMD_2 ) | "cmd2" | "second";
std::string name( clist.
getName( CMD_1 ) );
Commands cmd( clist.
getValue(
"second" ) );
Simple value<>name mapping supporting aliases.
bool getValue(const std::string &name_r, Tp &value_r) const
Get value mapped for name or alias.
bool getName(const Tp &value_r, std::string &name_r) const
Get name of value.
Definition at line 41 of file NamedValue.h.
◆ NameMap
template<class Tp , const
bool _tWithAlias = true>
typedef std::map< std::string, Tp > zypp::NamedValue< Tp, _tWithAlias >::NameMap |
|
private |
◆ ValueMap
template<class Tp , const
bool _tWithAlias = true>
typedef std::map< Tp, std::string > zypp::NamedValue< Tp, _tWithAlias >::ValueMap |
|
private |
◆ empty()
template<class Tp , const
bool _tWithAlias = true>
Whether not initialized (no (name,value) pair remembered)
Definition at line 48 of file NamedValue.h.
◆ haveValue()
template<class Tp , const
bool _tWithAlias = true>
Whether there is a value
mapped for name_r.
Definition at line 56 of file NamedValue.h.
◆ getValue() [1/2]
template<class Tp , const
bool _tWithAlias = true>
bool zypp::NamedValue< Tp, _tWithAlias >::getValue |
( |
const std::string & |
name_r, |
|
|
Tp & |
value_r |
|
) |
| const |
|
inline |
Get value mapped for name or alias.
- Returns
true
if name or alias was found.
Definition at line 65 of file NamedValue.h.
◆ getValue() [2/2]
template<class Tp , const
bool _tWithAlias = true>
const Tp & zypp::NamedValue< Tp, _tWithAlias >::getValue |
( |
const std::string & |
name_r | ) |
const |
|
inline |
◆ haveName()
template<class Tp , const
bool _tWithAlias = true>
Whether there is a name
mapped for value_r.
Definition at line 83 of file NamedValue.h.
◆ getName() [1/2]
template<class Tp , const
bool _tWithAlias = true>
bool zypp::NamedValue< Tp, _tWithAlias >::getName |
( |
const Tp & |
value_r, |
|
|
std::string & |
name_r |
|
) |
| const |
|
inline |
Get name of value.
- Returns
true
if name or alias was found.
Definition at line 92 of file NamedValue.h.
◆ getName() [2/2]
template<class Tp , const
bool _tWithAlias = true>
const std::string & zypp::NamedValue< Tp, _tWithAlias >::getName |
( |
const Tp & |
value_r | ) |
const |
|
inline |
◆ operator()()
template<class Tp , const
bool _tWithAlias = true>
◆ insert()
template<class Tp , const
bool _tWithAlias = true>
Remember name (1st call) or alias (subsequent calls).
- Returns
- \C true if this is the 1st call for value_r.
- Exceptions
-
std::logic_error | if name_r is already used as name or alias. |
std::logic_error | if _tWithAlias is false and a name for value_r is already defined. |
Definition at line 132 of file NamedValue.h.
◆ _nameMap
template<class Tp , const
bool _tWithAlias = true>
◆ _valueMap
template<class Tp , const
bool _tWithAlias = true>
The documentation for this class was generated from the following file: