Joedb 10.2.1
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
Websocket_Connection_Builder.h
Go to the documentation of this file.
1#ifndef joedb_Websocket_Connection_Builder_declared
2#define joedb_Websocket_Connection_Builder_declared
3
6
7namespace joedb
8{
9 /// @ingroup ui
11 {
12 public:
13 const char *get_name() const override {return "websocket";}
14 std::string get_connection_parameters() const override
15 {
16 return "<host> <port> <path>";
17 }
18
19 void build_connector(Arguments &arguments) override
20 {
21 const std::string_view host = arguments.get_next();
22 const std::string_view port = arguments.get_next();
23 const std::string_view path = arguments.get_next();
24
25 if (arguments.missing())
26 return;
27
28 connector = std::make_unique<Websocket_Connector>
29 (
30 std::string(host),
31 std::string(port),
32 std::string(path)
33 );
34 }
35 };
36}
37
38#endif
Class for conveniently parsing command-line arguments.
Definition Arguments.h:19
bool missing() const
Definition Arguments.h:146
std::string_view get_next()
std::unique_ptr< Connector > connector
void build_connector(Arguments &arguments) override
std::string get_connection_parameters() const override