Wrapper to std::istringstream that eases parsing of input file command lines.
More...
#include <ParamList.h>
|
| ParamList (string params) |
| Construct given the string with all the parameters.
|
|
void | rewind () |
| Rewind to beginning of stream (useful for commands with multiple alternate syntaxes)
|
|
template<typename T > |
void | get (T &t, T tDefault, string paramName, bool required=false) |
| Retrieve a parameter from stream or, if stream ends, set it to a default value. Note that t is set to tDefault if any error occurs. More...
|
|
template<typename T > |
void | get (T &t, T tDefault, const EnumStringMap< T > &tMap, string paramName, bool required=false) |
| Retreive an enum parameter from stream with default handling. More...
|
|
string | getRemainder () |
| Get the section of the input string not yet parsed.
|
|
Wrapper to std::istringstream that eases parsing of input file command lines.
◆ get() [1/2]
template<typename T >
void ParamList::get |
( |
T & |
t, |
|
|
T |
tDefault, |
|
|
const EnumStringMap< T > & |
tMap, |
|
|
string |
paramName, |
|
|
bool |
required = false |
|
) |
| |
|
inline |
Retreive an enum parameter from stream with default handling.
- Template Parameters
-
T | Type of the enum parameter |
- Parameters
-
t | Destination for the retrieved parameter |
tDefault | Default vaue of the parameter to set if stream ends while parsing |
tMap | Map between the enum values and corresponding string names |
paramName | Name of the parameter to use in error messages |
required | If true, report an error if the stream ends instead of using the default. |
◆ get() [2/2]
template<typename T >
void ParamList::get |
( |
T & |
t, |
|
|
T |
tDefault, |
|
|
string |
paramName, |
|
|
bool |
required = false |
|
) |
| |
|
inline |
Retrieve a parameter from stream or, if stream ends, set it to a default value. Note that t is set to tDefault if any error occurs.
- Template Parameters
-
T | data type of parameter, which could be anything that std::istream supports |
- Parameters
-
t | Destination for the retrieved parameter |
tDefault | Default vaue of the parameter to set if stream ends while parsing |
paramName | Name of the parameter to use in error messages |
required | If true, report an error if the stream ends instead of using the default. |
The documentation for this class was generated from the following file: