|
bool | isValid () const override |
| Tests if the class is valid.
|
|
void | run () override |
| Run loop, blocks until quit is called.
|
|
bool | addCommand (const std::string &name, CommandHandler handler, const std::string &desc, const std::string &help, const std::string &opts) override |
| Adds a new command to the readline loop.
|
|
void | runCommand (int argc, char *const *argv) override |
|
void | process (const std::shared_ptr< AICommon::IPollLoop > &pollLoop, epoll_event event) override |
| Callback from the PollLoop that is listening on stdin.
|
|
std::shared_ptr< const IReadLineContext > | getContext () const override |
| Returns the print context.
|
|
void | quit () const override |
| Triggers an exit from the readline loop.
|
|
void | printLn (const char *fmt,...) const override |
| Prints out the message from the command handler.
|
|
void | printLnError (const char *fmt,...) const override |
| Prints out an error message from the command handler.
|
|
|
static std::shared_ptr< ReadLine > | instance () |
|
static std::shared_ptr< IReadLine > | create () |
|
|
void | initLib () |
| Initialises access to the readline library.
|
|
char * | commandGenerator (const char *text, int state) |
| Completion function for libreadline.
|
|
void | commandLineHandler (const char *text) |
| Callback handler from the readline library.
|
|
void | commandExecute (const std::string &cmdStr, const std::vector< std::string > &args) |
| Executes the given command, called from readline callback handler.
|
|
void | helpCommand (const std::shared_ptr< const IReadLineContext > &context, const std::vector< std::string > &args) |
| Called when the user types help.
|
|
void | quitCommand (const std::shared_ptr< const IReadLineContext > &context, const std::vector< std::string > &args) |
| Called when the user types quit.
|
|
|
static char * | _commandGenerator (const char *text, int state) |
| Callback handler for the tab completion callback.
|
|
static char ** | _completionCallback (const char *text, int start, int end) |
| Callback handler for the tab completion callback.
|
|
static void | _commandLineHandler (char *text) |
| Callback handler from the readline library.
|
|
static void | signalHandler (int dummy) |
| Signal handler for capturing ctrl-c and restoring the terminal state.
|
|
|
static std::mutex | mInstanceLock |
|
static std::shared_ptr< ReadLine > | mInstance |
|
static rl_crlf_t | _rl_crlf = nullptr |
|
static rl_on_new_line_t | _rl_on_new_line = nullptr |
|
static rl_forced_update_display_t | _rl_forced_update_display = nullptr |
|
static rl_completion_matches_t | _rl_completion_matches = nullptr |
|
static rl_bind_key_t | _rl_bind_key = nullptr |
|
static rl_callback_handler_install_t | _rl_callback_handler_install = nullptr |
|
static rl_callback_read_char_t | _rl_callback_read_char = nullptr |
|
static rl_callback_handler_remove_t | _rl_callback_handler_remove = nullptr |
|
static add_history_t | _add_history = nullptr |
|
|
typedef std::function< void(const std::shared_ptr< const IReadLineContext > &readLine, const std::vector< std::string > &args)> | CommandHandler |
|
◆ addCommand()
bool ReadLine::addCommand |
( |
const std::string & |
name, |
|
|
CommandHandler |
handler, |
|
|
const std::string & |
desc, |
|
|
const std::string & |
help, |
|
|
const std::string & |
opts |
|
) |
| |
|
overridevirtual |
Adds a new command to the readline loop.
Implements IReadLine.
◆ commandGenerator()
char * ReadLine::commandGenerator |
( |
const char * |
text, |
|
|
int |
state |
|
) |
| |
|
private |
Completion function for libreadline.
Generator function for command completion. STATE lets us know whether to start from scratch; without any state (i.e. STATE == 0), then we start at the top of the list.
◆ getContext()
Returns the print context.
Implements IReadLine.
◆ initLib()
void ReadLine::initLib |
( |
| ) |
|
|
private |
Initialises access to the readline library.
Because we don't have access to the readline headers of library in the SI build system, we use dlsym to try and get the symbols.
◆ isValid()
bool ReadLine::isValid |
( |
| ) |
const |
|
overridevirtual |
Tests if the class is valid.
Implements IReadLine.
◆ printLn()
void ReadLine::printLn |
( |
const char * |
fmt, |
|
|
|
... |
|
) |
| const |
|
overridevirtual |
Prints out the message from the command handler.
Reimplemented from IReadLineContext.
◆ printLnError()
void ReadLine::printLnError |
( |
const char * |
fmt, |
|
|
|
... |
|
) |
| const |
|
overridevirtual |
Prints out an error message from the command handler.
Reimplemented from IReadLineContext.
◆ process()
void ReadLine::process |
( |
const std::shared_ptr< AICommon::IPollLoop > & |
pollLoop, |
|
|
epoll_event |
event |
|
) |
| |
|
overridevirtual |
◆ quit()
void ReadLine::quit |
( |
| ) |
const |
|
overridevirtual |
◆ run()
Run loop, blocks until quit is called.
Implements IReadLine.
◆ runCommand()
void ReadLine::runCommand |
( |
int |
argc, |
|
|
char *const * |
argv |
|
) |
| |
|
overridevirtual |
The documentation for this class was generated from the following files:
- AppInfrastructure/ReadLine/source/ReadLine.h
- AppInfrastructure/ReadLine/source/ReadLine.cpp