Joedb 9.5.0
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
Local_Connection_Builder.h
Go to the documentation of this file.
1#ifndef joedb_Local_Connection_Builder_declared
2#define joedb_Local_Connection_Builder_declared
3
8
9#include <iostream>
10
11namespace joedb
12{
13 /// @ingroup ui
15 {
16 private:
17 std::unique_ptr<Local_Connector> connector;
18 std::unique_ptr<Robust_Connection> connection;
19
20 public:
21 bool has_sharing_option() const final {return true;}
22 int get_min_parameters() const final {return 1;}
23 int get_max_parameters() const final {return 1;}
24 const char *get_name() const final {return "local";}
25 const char *get_parameters_description() const final
26 {
27 return "<endpoint_path>";
28 }
29
31 (
32 const int argc,
33 const char * const * const argv,
34 Buffered_File *file
35 ) final
36 {
37 const char * const endpoint_path = argv[0];
38
39 connector = std::make_unique<Local_Connector>(endpoint_path);
40
41 if (file)
42 connection = std::make_unique<Robust_Connection>(*connector, &std::cerr);
43 else
44 connection = std::make_unique<Server_File>(*connector, &std::cerr);
45
46 return *connection;
47 }
48 };
49}
50
51#endif
Connection & build(const int argc, const char *const *const argv, Buffered_File *file) final
const char * get_parameters_description() const final
Definition Blob.h:7