The Compiler class is used by CmdArg classes to convert strings into desired datatypes.
More...
#include <Compiler.hh>
|
template<> |
bool | compile (const char *arg, const char *&endptr, int &value) |
|
bool | compile (const char *arg, const char *&enptr, T &value) |
| Convert the given string into the desired datatype T. More...
|
|
template<> |
bool | compile (const char *arg, const char *&endptr, double &value) |
|
template<> |
bool | compile (const char *arg, const char *&endptr, std::string &value) |
|
template<> |
bool | compile (const char *arg, const char *&endptr, bool &value) |
|
const std::string & | errorMsg () const |
| Return the error message of the last compilation. More...
|
|
template<typename T>
class Compiler< T >
The Compiler class is used by CmdArg classes to convert strings into desired datatypes.
Definition at line 64 of file Compiler.hh.
◆ compile() [1/5]
template<typename T>
bool Compiler< T >::compile |
( |
const char * |
arg, |
|
|
const char *& |
enptr, |
|
|
T & |
value |
|
) |
| |
Convert the given string into the desired datatype T.
If the compilation was not successful, false is returned and the error message is set. If endptr!=0 the function sets endptr to the first unrecognized char in arg or to 0 if there are no unrecognized chars. NOTE: This function must always successfully accept NULL strings.
- Parameters
-
arg | the string that is to be converted |
endptr | must point to first unrecognized char in arg |
value | here the converted value is stored |
- Returns
- true, if the compilation was successful
◆ errorMsg()
template<typename T>
const std::string& Compiler< T >::errorMsg |
( |
| ) |
const |
|
inline |
Return the error message of the last compilation.
- Returns
- error message
Definition at line 98 of file Compiler.hh.
◆ setErrorMsg()
template<typename T>
void Compiler< T >::setErrorMsg |
( |
const std::string & |
msg | ) |
|
|
inlineprotected |
Set the error message.
- Parameters
-
Definition at line 114 of file Compiler.hh.
◆ compile() [2/5]
template<>
bool Compiler< int >::compile |
( |
const char * |
arg, |
|
|
const char *& |
endptr, |
|
|
int & |
value |
|
) |
| |
◆ compile() [3/5]
template<>
bool Compiler< double >::compile |
( |
const char * |
arg, |
|
|
const char *& |
endptr, |
|
|
double & |
value |
|
) |
| |
◆ compile() [4/5]
template<>
bool Compiler< std::string >::compile |
( |
const char * |
arg, |
|
|
const char *& |
endptr, |
|
|
std::string & |
value |
|
) |
| |
◆ compile() [5/5]
template<>
bool Compiler< bool >::compile |
( |
const char * |
arg, |
|
|
const char *& |
endptr, |
|
|
bool & |
value |
|
) |
| |
◆ pErrorMsg
The documentation for this class was generated from the following file: