diff options
-rw-r--r-- | contrib/epee/include/console_handler.h | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/contrib/epee/include/console_handler.h b/contrib/epee/include/console_handler.h index 4ea3fa54b..0e22a971c 100644 --- a/contrib/epee/include/console_handler.h +++ b/contrib/epee/include/console_handler.h @@ -401,13 +401,19 @@ eof: template<class t_server, class t_handler> - bool start_default_console(t_server* ptsrv, t_handler handlr, const std::string& prompt, const std::string& usage = "") + bool start_default_console(t_server* ptsrv, t_handler handlr, std::function<std::string(void)> prompt, const std::string& usage = "") { std::shared_ptr<async_console_handler> console_handler = std::make_shared<async_console_handler>(); boost::thread([=](){console_handler->run<t_server, t_handler>(ptsrv, handlr, prompt, usage);}).detach(); return true; } + template<class t_server, class t_handler> + bool start_default_console(t_server* ptsrv, t_handler handlr, const std::string& prompt, const std::string& usage = "") + { + return start_default_console(ptsrv, handlr, [prompt](){ return prompt; }, usage); + } + template<class t_server> bool start_default_console(t_server* ptsrv, const std::string& prompt, const std::string& usage = "") { @@ -421,19 +427,31 @@ eof: } template<class t_server, class t_handler> - bool run_default_console_handler_no_srv_param(t_server* ptsrv, t_handler handlr, const std::string& prompt, const std::string& usage = "") + bool run_default_console_handler_no_srv_param(t_server* ptsrv, t_handler handlr, std::function<std::string(void)> prompt, const std::string& usage = "") { async_console_handler console_handler; return console_handler.run(ptsrv, boost::bind<bool>(no_srv_param_adapter<t_server, t_handler>, _1, _2, handlr), prompt, usage); } template<class t_server, class t_handler> - bool start_default_console_handler_no_srv_param(t_server* ptsrv, t_handler handlr, const std::string& prompt, const std::string& usage = "") + bool run_default_console_handler_no_srv_param(t_server* ptsrv, t_handler handlr, const std::string& prompt, const std::string& usage = "") + { + return run_default_console_handler_no_srv_param(ptsrv, handlr, [prompt](){return prompt;},usage); + } + + template<class t_server, class t_handler> + bool start_default_console_handler_no_srv_param(t_server* ptsrv, t_handler handlr, std::function<std::string(void)> prompt, const std::string& usage = "") { boost::thread( boost::bind(run_default_console_handler_no_srv_param<t_server, t_handler>, ptsrv, handlr, prompt, usage) ); return true; } + template<class t_server, class t_handler> + bool start_default_console_handler_no_srv_param(t_server* ptsrv, t_handler handlr, const std::string& prompt, const std::string& usage = "") + { + return start_default_console_handler_no_srv_param(ptsrv, handlr, [prompt](){return prompt;}, usage); + } + /*template<class a> bool f(int i, a l) { |