#include <console_handler.h>
|
| typedef boost::function< bool(const std::vector< std::string > &)> | callback |
| typedef std::map< std::string, std::pair< callback, std::pair< std::string, std::string > > > | lookup |
Definition at line 482 of file console_handler.h.
◆ callback
◆ lookup
◆ get_documentation()
| std::pair< std::string, std::string > epee::command_handler::get_documentation |
( |
const std::vector< std::string > & | cmd | ) |
|
|
inline |
Definition at line 498 of file console_handler.h.
499 {
500 if(cmd.empty())
501 return std::make_pair("", "");
502 auto it = m_command_handlers.find(cmd.front());
503 if(it == m_command_handlers.end())
504 return std::make_pair("", "");
505 return it->second.second;
506 }
◆ get_usage()
| std::string epee::command_handler::get_usage |
( |
| ) |
|
|
inline |
Definition at line 487 of file console_handler.h.
488 {
489 std::stringstream ss;
490
491 for(auto& x:m_command_handlers)
492 {
493 ss << x.second.second.first <<
ENDL;
494 }
495 return ss.str();
496 }
◆ process_command_str()
| bool epee::command_handler::process_command_str |
( |
const std::string & | cmd | ) |
|
|
inline |
Definition at line 530 of file console_handler.h.
531 {
532 std::vector<std::string> cmd_v;
533 boost::split(cmd_v,cmd,boost::is_any_of(" "), boost::token_compress_on);
535 }
bool process_command_vec(const std::vector< std::string > &cmd)
◆ process_command_vec()
| bool epee::command_handler::process_command_vec |
( |
const std::vector< std::string > & | cmd | ) |
|
|
inline |
Definition at line 519 of file console_handler.h.
520 {
521 if(!cmd.size())
522 return false;
523 auto it = m_command_handlers.find(cmd.front());
524 if(it == m_command_handlers.end())
525 return false;
526 std::vector<std::string> cmd_local(cmd.begin()+1, cmd.end());
527 return it->second.first(cmd_local);
528 }
◆ set_handler()
| void epee::command_handler::set_handler |
( |
const std::string & | cmd, |
|
|
const callback & | hndlr, |
|
|
const std::string & | usage = "", |
|
|
const std::string & | description = "" ) |
|
inline |
Definition at line 508 of file console_handler.h.
509 {
510 lookup::mapped_type & vt = m_command_handlers[cmd];
511 vt.first = hndlr;
512 vt.second.first = description.empty() ? cmd : usage;
513 vt.second.second = description.empty() ? usage : description;
514#ifdef HAVE_READLINE
516#endif
517 }
static void add_completion(const std::string &command)
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