#include <readline_buffer.h>
Definition at line 10 of file readline_buffer.h.
◆ readline_buffer()
| rdln::readline_buffer::readline_buffer |
( |
| ) |
|
Definition at line 46 of file readline_buffer.cpp.
47 : std::stringbuf(), m_cout_buf(NULL), m_prompt_length(0)
◆ add_completion()
| void rdln::readline_buffer::add_completion |
( |
const std::string & |
command | ) |
|
|
static |
Definition at line 96 of file readline_buffer.cpp.
98 if(std::find(completion_commands().begin(), completion_commands().end(), command) != completion_commands().end())
100 completion_commands().push_back(command);
◆ get_completions()
| const std::vector< std::string > & rdln::readline_buffer::get_completions |
( |
| ) |
|
|
static |
◆ get_line()
Definition at line 70 of file readline_buffer.cpp.
72 boost::lock_guard<boost::mutex> lock(sync_mutex);
74 rl_callback_read_char();
◆ is_running()
| bool rdln::readline_buffer::is_running |
( |
| ) |
const |
|
inline |
◆ set_prompt()
| void rdln::readline_buffer::set_prompt |
( |
const std::string & |
prompt | ) |
|
Definition at line 84 of file readline_buffer.cpp.
86 if(m_cout_buf == NULL)
88 boost::lock_guard<boost::mutex> lock(sync_mutex);
89 rl_set_prompt(
std::string(m_prompt_length,
' ').c_str());
91 rl_set_prompt(prompt.c_str());
93 m_prompt_length = prompt.size();
◆ start()
| void rdln::readline_buffer::start |
( |
| ) |
|
Definition at line 52 of file readline_buffer.cpp.
54 if(m_cout_buf != NULL)
56 m_cout_buf = std::cout.rdbuf();
57 std::cout.rdbuf(
this);
58 install_line_handler();
◆ stop()
| void rdln::readline_buffer::stop |
( |
| ) |
|
Definition at line 61 of file readline_buffer.cpp.
63 if(m_cout_buf == NULL)
65 std::cout.rdbuf(m_cout_buf);
67 remove_line_handler();
◆ sync()
| int rdln::readline_buffer::sync |
( |
| ) |
|
|
protectedvirtual |
Definition at line 108 of file readline_buffer.cpp.
110 boost::lock_guard<boost::mutex> lock(sync_mutex);
111 #if RL_READLINE_VERSION < 0x0700 112 char lbuf[2] = {0,0};
114 int end = 0, point = 0;
117 if (rl_end || (rl_prompt && *rl_prompt))
119 #if RL_READLINE_VERSION >= 0x0700 120 rl_clear_visible_line();
122 line = rl_line_buffer;
125 rl_line_buffer = lbuf;
135 m_cout_buf->sputc( this->sgetc() );
137 while ( this->snextc() != EOF );
139 #if RL_READLINE_VERSION < 0x0700 140 if (end || (rl_prompt && *rl_prompt))
143 rl_line_buffer = line;
The documentation for this class was generated from the following files: