Debian Codegraph @

contrib/epee/include/readline_buffer.h

raw symbols SCIP
1 #pragma once
2
3 #include <streambuf>
4 #include <sstream>
5 #include <vector>
6
7 namespace rdln
8 {
9 typedef enum { empty, partial, full } linestatus;
10 class readline_buffer : public std::stringbuf
11 {
12 public:
13 readline_buffer();
14 void start();
15 void stop();
16 bool is_running() const
17 {
18 return m_cout_buf != NULL;
19 }
20 linestatus get_line(std::string& line) const;
21 void set_prompt(const std::string& prompt);
22 static void add_completion(const std::string& command);
23 static const std::vector<std::string>& get_completions();
24
25 protected:
26 virtual int sync();
27
28 private:
29 std::streambuf* m_cout_buf;
30 size_t m_prompt_length;
31 static std::vector<std::string>& completion_commands();
32 };
33
34 class suspend_readline
35 {
36 public:
37 suspend_readline();
38 ~suspend_readline();
39 private:
40 readline_buffer* m_buffer;
41 bool m_restart;
42 };
43
44 void clear_screen();
45 }
46