|
FEAT 3
Finite Element Analysis Toolbox
|
String-Mapped class template. More...
#include <string_mapped.hpp>
Public Member Functions | |
| StringMapped (ValueType_ &value, const std::map< String, ValueType_ > &value_map) | |
| Constructor. More... | |
| bool | lookup (const String &str) |
| Looks up the value in the map from a given string. More... | |
Private Attributes | |
| ValueType_ & | _value |
| the value More... | |
| const std::map< String, ValueType_ > & | _value_map |
| the string map More... | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const StringMapped &val) |
| Output stream insertion operator. More... | |
| std::istream & | operator>> (std::istream &is, StringMapped &val) |
| Input stream extraction operator. More... | |
String-Mapped class template.
This class implements an auxiliary class that can be used to look up a value of a specific type from a map of strings. The primary use of this class is to parse enumeration values from the set of command line arguments by using the SimpleArgParser class.
| ValueType_ | The type of the value that is to be mapped. Must be copy-assignable. |
Definition at line 31 of file string_mapped.hpp.
|
inlineexplicit |
Constructor.
| [in] | value | A resident reference to the value to be looked up. |
| [in] | value_map | A resident const reference to the value map to be used for lookup. |
Definition at line 49 of file string_mapped.hpp.
|
inline |
Looks up the value in the map from a given string.
This function parses the input string by looking up the corresponding value in the underlying string-value map and saves the corresponding value in this object's variable reference. If the string was not found in the underlying map, the internal value of this object is left unmodified.
| [in] | str | The string that is to be looked up. |
true, if string represents a valid key in the underlying map, or false, if the string was not found in the map. Definition at line 69 of file string_mapped.hpp.
References FEAT::StringMapped< ValueType_ >::_value, and FEAT::StringMapped< ValueType_ >::_value_map.
|
friend |
Output stream insertion operator.
| [in,out] | os | The output stream to insert to. |
| [in] | val | A rvalue-reference to the string mapped value to insert. |
os Definition at line 136 of file string_mapped.hpp.
|
friend |
Input stream extraction operator.
| [in,out] | is | The input stream to extract from. |
| [in] | val | A rvalue-reference to the string mapped value to extract. |
is Definition at line 92 of file string_mapped.hpp.
|
private |
the value
Definition at line 35 of file string_mapped.hpp.
Referenced by FEAT::StringMapped< ValueType_ >::lookup().
|
private |
the string map
Definition at line 37 of file string_mapped.hpp.
Referenced by FEAT::StringMapped< ValueType_ >::lookup().