#include <console_handler.h>
|
| | async_console_handler () |
| template<class t_server, class chain_handler> |
| bool | run (t_server *psrv, chain_handler ch_handler, std::function< std::string(void)> prompt, const std::string &usage="") |
| template<class chain_handler> |
| bool | run (chain_handler ch_handler, std::function< std::string(void)> prompt, const std::string &usage="", std::function< void(void)> exit_handler=NULL) |
| void | stop () |
| void | print_prompt () |
Definition at line 290 of file console_handler.h.
◆ async_console_handler()
| epee::async_console_handler::async_console_handler |
( |
| ) |
|
|
inline |
◆ print_prompt()
| void epee::async_console_handler::print_prompt |
( |
| ) |
|
|
inline |
Definition at line 315 of file console_handler.h.
316 {
317 std::string prompt = m_prompt();
318 if (!prompt.empty())
319 {
320#ifdef HAVE_READLINE
321 std::string color_prompt = "\001\033[1;33m\002" + prompt;
322 if (' ' != prompt.back())
323 color_prompt += " ";
324 color_prompt += "\001\033[0m\002";
325 m_stdin_reader.get_readline_buffer().set_prompt(color_prompt);
326#else
328 std::cout << prompt;
329 if (' ' != prompt.back())
330 std::cout << ' ';
332 std::cout.flush();
333#endif
334 }
335 }
void set_console_color(int color, bool bright)
void reset_console_color()
◆ run() [1/2]
template<class chain_handler>
| bool epee::async_console_handler::run |
( |
chain_handler | ch_handler, |
|
|
std::function< std::string(void)> | prompt, |
|
|
const std::string & | usage = "", |
|
|
std::function< void(void)> | exit_handler = NULL ) |
|
inline |
Definition at line 304 of file console_handler.h.
305 {
306 return run(prompt, usage, [&](
const std::string& cmd) {
return ch_handler(cmd); }, exit_handler);
307 }
bool run(t_server *psrv, chain_handler ch_handler, std::function< std::string(void)> prompt, const std::string &usage="")
◆ run() [2/2]
template<class t_server, class chain_handler>
| bool epee::async_console_handler::run |
( |
t_server * | psrv, |
|
|
chain_handler | ch_handler, |
|
|
std::function< std::string(void)> | prompt, |
|
|
const std::string & | usage = "" ) |
|
inline |
Definition at line 298 of file console_handler.h.
299 {
300 return run(prompt, usage, [&](
const std::string& cmd) {
return ch_handler(psrv, cmd); }, [&] { psrv->send_stop_signal(); });
301 }
◆ stop()
| void epee::async_console_handler::stop |
( |
| ) |
|
|
inline |
Definition at line 309 of file console_handler.h.
310 {
311 m_running = false;
312 m_stdin_reader.stop();
313 }
The documentation for this class was generated from the following file:
- /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/contrib/epee/include/console_handler.h