Joedb 10.0.1
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
Client_Command_Processor.h
Go to the documentation of this file.
1#ifndef joedb_Client_Command_Processor_declared
2#define joedb_Client_Command_Processor_declared
3
7
8#include <chrono>
9
10namespace joedb
11{
12 class Client;
13
14 /// @ingroup ui
16 {
17 private:
18 Blob_Reader_Command_Processor blob_processor;
19
20 void pull(std::ostream &out, std::chrono::milliseconds wait);
21 void print_status(std::ostream &out);
22
23 protected:
25
26 static void sleep(int seconds, std::ostream &out);
27 virtual std::string get_name() const {return "readonly_client";}
28
29 public:
31 blob_processor(client.get_journal().get_file()),
33 {}
34
35 void write_prompt(std::ostream &out) const override;
36
38 (
39 Command_Interpreter &interpreter,
40 std::istream &in,
41 std::ostream &out
42 )
43 {
44 interpreter.add_processor(blob_processor);
45 interpreter.set_parent(this);
46 interpreter.main_loop(in, out);
47 }
48
50 (
51 const std::string &command,
52 std::istream &parameters,
53 std::istream &in,
54 std::ostream &out
55 ) override;
56 };
57
58 /// @ingroup ui
60 {
61 private:
62 Writable_Client &get_writable_client()
63 {
65 }
66
67 std::string get_name() const override {return "writable_client";}
68
69 public:
74
76 (
77 const std::string &command,
78 std::istream &parameters,
79 std::istream &in,
80 std::ostream &out
81 ) override;
82 };
83}
84
85#endif
Status process_command(const std::string &command, std::istream &parameters, std::istream &in, std::ostream &out) override
virtual std::string get_name() const
void run_interpreter(Command_Interpreter &interpreter, std::istream &in, std::ostream &out)
void write_prompt(std::ostream &out) const override
static void sleep(int seconds, std::ostream &out)
Handle concurrent access to a file with a joedb::Connection.
Definition Client.h:12
void set_parent(const Command_Interpreter *new_parent)
void main_loop(std::istream &in, std::ostream &out)
void add_processor(Command_Processor &processor)
Status process_command(const std::string &command, std::istream &parameters, std::istream &in, std::ostream &out) override
Writable specialization of Client.
Definition Blob.h:7