Joedb 10.3.0
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
Client_Parser.h
Go to the documentation of this file.
1#ifndef joedb_Client_Parser_declared
2#define joedb_Client_Parser_declared
3
8
9namespace joedb
10{
11//#define PERSISTENCE_TEST
12 /// @ingroup ui
13 class Client_Parser // TODO: rename into "parsed client"
14 {
15 public:
16 enum class DB_Type
17 {
18 none,
20 dump,
22 sql,
24#ifdef PERSISTENCE_TEST
25 joedb
26#endif
27 };
28
29 private:
30 const Open_Mode default_open_mode;
31 const DB_Type default_db_type;
32
33 File_Parser file_parser;
34 Connection_Parser connection_parser;
35
36 std::unique_ptr<Client> client;
37
38 public:
40 (
41 Logger &logger,
42 Open_Mode default_open_mode,
43 DB_Type default_db_type,
44 Arguments &arguments
45 );
46
47 Client *get() {return client.get();}
48 bool has_file() const {return file_parser.get_file() != nullptr;}
49
50 void print_help(std::ostream &out) const
51 {
52 file_parser.print_help(out);
53 connection_parser.print_help(out);
54 }
55 };
56}
57
58#endif
Class for conveniently parsing command-line arguments.
Definition Arguments.h:19
bool has_file() const
void print_help(std::ostream &out) const
Handle concurrent access to a file with a joedb::Connection.
Definition Client.h:12
Create an instance of a Connection by parsing command-line arguments.
void print_help(std::ostream &out) const
Create an instance of a Abstract_File by parsing command-line arguments.
Definition File_Parser.h:22
Abstract_File * get_file() const
Definition File_Parser.h:51
void print_help(std::ostream &out) const
Open_Mode
Definition Open_Mode.h:8