Joedb 9.1.4
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
20 bool echo = true;
21 bool rethrow = false;
22 bool prompt = false;
23
24 void after_command
25 (
26 std::ostream &out,
27 int64_t line_number,
28 const std::string &line,
29 const Exception *exception
30 ) const;
31
32 protected:
34 (
35 const std::string &command,
36 std::istream &parameters,
37 std::istream &in,
38 std::ostream &out
39 ) override;
40
41 public:
43 void add_processor(Command_Processor &processor);
44 void set_parent(const Command_Interpreter *new_parent);
45 virtual void write_prompt(std::ostream &out) const;
46 void write_whole_prompt(std::ostream &out) const;
47 void set_echo(bool new_echo) {echo = new_echo;}
48 void set_rethrow(bool new_rethrow) {rethrow = new_rethrow;}
49 void set_prompt(bool new_prompt) {prompt = new_prompt;}
50 void main_loop(std::istream &in, std::ostream &out);
51 };
52}
53
54#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
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