#include <senf/Utils/Console/Traits.hh>
ArgumentTraits provides argument parsing, Additionally, this class provides a way to get a string-description of a type and to convert a value back into it's string representation used to display default values.
The default implementation provided here
boost::lexical_cast
and thereby iostreams
to convert an argument consisting of a single input token into the required type."string"
for std::string
).Definition at line 63 of file Traits.hh.
Public Types |
|
typedef Type | type |
Static Public Member Functions |
|
static void | parse (ParseCommandInfo::TokensRange const &tokens, Type &out) |
Parse token range into value. |
|
static std::string | description () |
String description of type. |
|
static std::string | str (Type const &value) |
Stringify value. |
|
Static Public Attributes |
|
static bool const | singleToken |
Related Functions |
|
(Note that these are not member functions.) |
|
template<class Type > | |
bool | senf_console_parse_argument (ParseCommandInfo::TokensRange const &tokens, Type &out) |
Argument parser. |
typedef Type senf::console::ArgumentTraits< Type >:: | ||||
type | ||||
Reimplemented in senf::console::detail::CharArgumentTraits< CharT >.
std::string senf::console::ArgumentTraits< Enum >:: | ||||
description | () | |||
String description of type.
Returns the string description of Type. Used to generate online help.
Reimplemented in senf::console::detail::CharArgumentTraits< CharT >.
Definition at line 62 of file Traits.cci.
void senf::console::ArgumentTraits< Type >:: | ||||
parse | ( | ParseCommandInfo::TokensRange const & | tokens, | |
Type & | out | ) | ||
Parse token range into value.
This function needs to parse tokens and write the parsed value into out. This function needs to parse the complete list of tokens, additional tokens must be considered as syntax error.
SyntaxErrorException |
[in] | tokens | tokens to parse |
[out] | out | parsed value |
Definition at line 57 of file Traits.cti.
std::string senf::console::ArgumentTraits< Type >:: | ||||
str | ( | Type const & | value | ) |
Stringify value.
To show default values in the online help, this function converts a value back into a one-line string representation. The default implementation uses the ReturnValueTraits for this conversion.
Definition at line 87 of file Traits.cti.
bool | ||||
senf_console_parse_argument | ( | ParseCommandInfo::TokensRange const & | tokens, | |
Type & | out | ) | ||
Argument parser.
bool const senf::console::ArgumentTraits< Type >::singleToken | ||||
[static] | ||||
Initial value:
boost::is_same< typeof(senf_console_parse_argument( *static_cast<ParseCommandInfo::TokensRange const *>(0), *static_cast<Type*>(0))), bool >::value