clang-tags
C/C++ source code indexing tool based on libclang
|
Request parser. More...
#include <request.hxx>
Public Member Functions | |
Parser (std::string description="") | |
Constructor. | |
Parser & | prompt (std::string p) |
Set a global prompt. | |
Parser & | echo (bool activate=true) |
Set echo. | |
Parser & | add (CommandParser *command) |
Add a command parser. | |
void | help (std::ostream &cout) |
Display help about the command parser. | |
void | parse (std::istream &cin, std::ostream &cout) |
Parse a stream of plain-text requests and run the associated commands. | |
void | parseJson (std::istream &cin, std::ostream &cout, bool verbose=false) |
Parse a stream of JSON requests and run the associated commands. |
Request parser.
Parses a request to identify the command, and run it.
|
inline |
Constructor.
description | global description for the request parser |
|
inline |
Add a command parser.
command | pointer to a command parser |
|
inline |
Set echo.
When reading an plain-text request and echo is activated, read lines are echoed after the prompt. This is moslty useful when reading a plain-text request non-interactively (for exemple for testing purposes).
activate | true to activate echo |
|
inline |
Display help about the command parser.
Displays the command parser description, along with a list of all recognised commands.
cout | output stream where help will be displayed |
|
inline |
Parse a stream of plain-text requests and run the associated commands.
cin | input stream where the request is read |
cout | output stream where results are printed |
|
inline |
Parse a stream of JSON requests and run the associated commands.
JSON requests must be separated by blank lines.
cin | input stream where requests are read |
cout | output stream where results are printed |
verbose | if true , output progress information |
|
inline |
Set a global prompt.
This prompt will be used at the top level for interactive plain-text requests.
p | prompt string |