Joedb 10.3.0
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
File_Parser.h
Go to the documentation of this file.
1#ifndef joedb_File_Parser_declared
2#define joedb_File_Parser_declared
3
7
8#ifdef JOEDB_HAS_SSH
9#include "joedb/ssh/Session.h"
10#include "joedb/ssh/SFTP.h"
11#endif
12
13#include <memory>
14#include <iosfwd>
15#include <optional>
16
17namespace joedb
18{
19 /// Create an instance of a @ref Abstract_File by parsing command-line arguments
20 /// @ingroup ui
22 {
23 private:
24 const Open_Mode default_open_mode;
25 const bool default_only;
26 const bool include_shared;
27 const bool include_server;
28
29#ifdef JOEDB_HAS_SSH
30 std::optional<ssh::Session> ssh_session;
31 std::optional<ssh::SFTP> sftp;
32#endif
33 std::unique_ptr<Abstract_File> file;
34
35 public:
37 (
39 bool default_only = false,
40 bool include_shared = true,
41 bool include_server = false
42 ):
43 default_open_mode(default_open_mode),
44 default_only(default_only),
45 include_shared(include_shared),
46 include_server(include_server)
47 {
48 }
49
50 Abstract_File *parse(joedb::Logger &log, Arguments &arguments);
51 Abstract_File *get_file() const {return file.get();}
52 void print_help(std::ostream &out) const;
53 };
54}
55
56#endif
Class for conveniently parsing command-line arguments.
Definition Arguments.h:19
Create an instance of a Abstract_File by parsing command-line arguments.
Definition File_Parser.h:22
Abstract_File * parse(joedb::Logger &log, Arguments &arguments)
Abstract_File * get_file() const
Definition File_Parser.h:51
void print_help(std::ostream &out) const
File_Parser(Open_Mode default_open_mode=Open_Mode::write_existing_or_create_new, bool default_only=false, bool include_shared=true, bool include_server=false)
Definition File_Parser.h:37
Open_Mode
Definition Open_Mode.h:8
@ write_existing_or_create_new
either write_existing or create_new depending on whether the file exists. Racy in Posix,...