Simplify readline support

And don't use std::mutex
This commit is contained in:
Howard Chu 2017-08-21 12:55:06 +01:00
parent 4466b6d1b0
commit c088d38a57
No known key found for this signature in database
GPG key ID: FD2A70B44AB11BA7
3 changed files with 88 additions and 143 deletions

View file

@ -8,25 +8,25 @@
namespace rdln
{
typedef enum { empty, partial, full } linestatus;
class readline_buffer : public std::stringbuf
{
public:
readline_buffer();
void start();
void stop();
int process();
bool is_running() const
{
return m_cout_buf != NULL;
}
void get_line(std::string& line) const;
linestatus get_line(std::string& line) const;
void set_prompt(const std::string& prompt);
static void add_completion(const std::string& command);
static const std::vector<std::string>& get_completions();
protected:
virtual int sync();
private:
std::streambuf* m_cout_buf;
static std::vector<std::string>& completion_commands();