Joedb 10.0.1
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
Command_Interpreter.h
Go to the documentation of this file.
1#ifndef joedb_Command_Interpreter_declared
2#define joedb_Command_Interpreter_declared
3
6
7#include <vector>
8#include <functional>
9#include <stdint.h>
10
11namespace joedb
12{
13 /// @ingroup ui
15 {
16 private:
17 std::vector<std::reference_wrapper<Command_Processor>> processors;
18 const Command_Interpreter *parent = nullptr;
19 std::string prompt_string = "joedbi";
20
21 bool echo = true;
22 bool rethrow = false;
23 bool prompt = false;
24
25 void after_command
26 (
27 std::ostream &out,
28 int64_t line_number,
29 const std::string &line,
30 const Exception *exception
31 ) const;
32
33 protected:
35 (
36 const std::string &command,
37 std::istream &parameters,
38 std::istream &in,
39 std::ostream &out
40 ) override;
41
42 public:
44 void add_processor(Command_Processor &processor);
45 void set_parent(const Command_Interpreter *new_parent);
46 void set_prompt_string(std::string s) {prompt_string = std::move(s);}
47 virtual void write_prompt(std::ostream &out) const;
48 void write_whole_prompt(std::ostream &out) const;
49 void set_echo(bool new_echo) {echo = new_echo;}
50 void set_rethrow(bool new_rethrow) {rethrow = new_rethrow;}
51 void set_prompt(bool new_prompt) {prompt = new_prompt;}
52 void main_loop(std::istream &in, std::ostream &out);
53 };
54}
55
56#endif
void set_parent(const Command_Interpreter *new_parent)
void main_loop(std::istream &in, std::ostream &out)
void set_prompt(bool new_prompt)
void write_whole_prompt(std::ostream &out) const
void set_prompt_string(std::string s)
Status process_command(const std::string &command, std::istream &parameters, std::istream &in, std::ostream &out) override
void add_processor(Command_Processor &processor)
virtual void write_prompt(std::ostream &out) const
void set_rethrow(bool new_rethrow)
Definition Blob.h:7