Single parsed console command. More...
#include <senf/Utils/Console/Parse.hh>
Classes | |
class | ArgumentIterator |
Iterator parsing argument groups. More... | |
Public Types | |
enum | BuiltinCommand { NoBuiltin, BuiltinCD, BuiltinLS, BuiltinLL, BuiltinLR, BuiltinPUSHD, BuiltinPOPD, BuiltinEXIT, BuiltinHELP, BuiltinECHO } |
typedef CommandPath::const_iterator | path_iterator |
typedef Tokens::const_iterator | token_iterator |
typedef ArgumentIterator | argument_iterator |
typedef Tokens::size_type | size_type |
typedef boost::iterator_range< path_iterator > | CommandPathRange |
typedef boost::iterator_range< argument_iterator > | ArgumentsRange |
typedef boost::iterator_range< token_iterator > | TokensRange |
Public Member Functions | |
ParseCommandInfo () | |
BuiltinCommand | builtin () const |
Command type. More... | |
TokensRange | commandPath () const |
Command path. More... | |
ArgumentsRange | arguments () const |
Command arguments. More... | |
TokensRange | tokens () const |
All argument tokens. More... | |
void | clear () |
Clear all data members. More... | |
bool | empty () |
true , if the data is empty More... | |
void | builtin (BuiltinCommand builtin) |
Assign builtin command. More... | |
void | command (std::vector< Token > &commandPath) |
Assign non-builtin command. More... | |
void | addToken (Token const &token) |
Add argument token. More... | |
Single parsed console command.
Every command parsed is returned in a ParseCommandInfo instance. This information is purely taken from the parser, no semantic information is attached at this point, the config/console node tree is not involved in any way. ParseCommandInfo consist of
typedef boost::iterator_range<argument_iterator> senf::console::ParseCommandInfo::ArgumentsRange |
typedef boost::iterator_range<path_iterator> senf::console::ParseCommandInfo::CommandPathRange |
typedef Tokens::size_type senf::console::ParseCommandInfo::size_type |
typedef boost::iterator_range<token_iterator> senf::console::ParseCommandInfo::TokensRange |
senf::console::ParseCommandInfo::ParseCommandInfo | ( | ) |
void senf::console::ParseCommandInfo::addToken | ( | Token const & | token | ) |
Add argument token.
You must ensure, that the resulting argument tokens are properly nested regarding '()' groups, otherwise interpreting arguments using the arguments() call will crash the program.
ArgumentsRange senf::console::ParseCommandInfo::arguments | ( | ) | const |
Command arguments.
The returned range contains one TokensRange for each argument.
BuiltinCommand senf::console::ParseCommandInfo::builtin | ( | ) | const |
Command type.
NoBuiltin
, if the command is an ordinary command, otherwise the id of the built-in command void senf::console::ParseCommandInfo::builtin | ( | BuiltinCommand | builtin | ) |
Assign builtin command.
void senf::console::ParseCommandInfo::clear | ( | ) |
Clear all data members.
void senf::console::ParseCommandInfo::command | ( | std::vector< Token > & | commandPath | ) |
Assign non-builtin command.
TokensRange senf::console::ParseCommandInfo::commandPath | ( | ) | const |
Command path.
This is the path to the command if it is not a built-in command. Every element of the returned range constitutes one path element. If the first element is empty, the path is an absolute path, otherwise it is relative. If the last element is an empty string, the path ends with a '/' char.
bool senf::console::ParseCommandInfo::empty | ( | ) |
true
, if the data is empty
TokensRange senf::console::ParseCommandInfo::tokens | ( | ) | const |
All argument tokens.
The returned range contains all argument tokens in a single range not divided into separate arguments.