Parse commands. More...
#include <senf/Utils/Console/Parse.hh>

Classes | |
| struct | ParserErrorException |
| Exception thrown when the parser detects an error. More... | |
| struct | SetIncremental |
Public Types | |
| typedef boost::function< void(ParseCommandInfo const &)> | Callback |
Public Member Functions | |
| void | parse (std::string const &command, Callback cb) |
| Parse string. More... | |
| void | parseFile (std::string const &filename, Callback cb) |
| Parse file. More... | |
| void | parseArguments (std::string const &arguments, ParseCommandInfo &info) |
| Parse arguments. More... | |
| void | parsePath (std::string const &path, ParseCommandInfo &info) |
| Parse path. More... | |
| std::string::size_type | parseIncremental (std::string const &commands, Callback cb) |
| Incremental parse. More... | |
Static Public Member Functions | |
| static bool | isSpecialChar (char ch) |
| Check, if ch is a special character. More... | |
| static bool | isPunctuationChar (char ch) |
| Check, if ch is a punctuation character. More... | |
| static bool | isSpaceChar (char ch) |
| Check, if ch is a space character. More... | |
| static bool | isInvalidChar (char ch) |
| Check, if ch is an invalid character. More... | |
| static bool | isWordChar (char ch) |
| Check, if ch is a word character. More... | |
Structors and default members | |
| CommandParser () | |
| ~CommandParser () | |
Parse commands.
This class implements a parser for the console/config language. It supports parsing strings as well as files. For every parsed command, a callback function is called.
| typedef boost::function<void (ParseCommandInfo const &)> senf::console::CommandParser::Callback |
|
static |
|
static |
|
static |
|
static |
|
static |
| void senf::console::CommandParser::parse | ( | std::string const & | command, |
| Callback | cb | ||
| ) |
| void senf::console::CommandParser::parseArguments | ( | std::string const & | arguments, |
| ParseCommandInfo & | info | ||
| ) |
Parse arguments.
parseArguments() parses the string arguments which contains arbitrary command arguments (without the name of the command). The argument tokens are written into info.
| void senf::console::CommandParser::parseFile | ( | std::string const & | filename, |
| Callback | cb | ||
| ) |
Parse file.
| SystemException | if the file cannot be read. |
| std::string::size_type senf::console::CommandParser::parseIncremental | ( | std::string const & | commands, |
| Callback | cb | ||
| ) |
Incremental parse.
An incremental parse will parse all complete statements in commands. parseIncremental() will return the number of characters successfully parsed from commands.
| void senf::console::CommandParser::parsePath | ( | std::string const & | path, |
| ParseCommandInfo & | info | ||
| ) |
Parse path.
parsePath() parses the string path as an arbitrary command path. The result is written into info.