Joedb 10.0.1
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 Open_Mode default_open_mode,
42 DB_Type default_db_type,
43 Arguments &arguments
44 );
45
46 Client *get() {return client.get();}
47 bool has_file() const {return file_parser.get_file() != nullptr;}
48
49 void print_help(std::ostream &out) const
50 {
51 file_parser.print_help(out);
52 connection_parser.print_help(out);
53 }
54 };
55}
56
57#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 Buffered_File by parsing command-line arguments.
Definition File_Parser.h:21
Buffered_File * get_file() const
Definition File_Parser.h:50
void print_help(std::ostream &out) const
Open_Mode
Definition Open_Mode.h:8
Definition Blob.h:7