Joedb 10.0.1
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
6
7#ifdef JOEDB_HAS_SSH
8#include "joedb/ssh/Session.h"
9#include "joedb/ssh/SFTP.h"
10#endif
11
12#include <memory>
13#include <iosfwd>
14#include <optional>
15
16namespace joedb
17{
18 /// Create an instance of a @ref Buffered_File by parsing command-line arguments
19 /// @ingroup ui
21 {
22 private:
23 const Open_Mode default_open_mode;
24 const bool default_only;
25 const bool include_shared;
26 const bool include_server;
27
28#ifdef JOEDB_HAS_SSH
29 std::optional<ssh::Session> ssh_session;
30 std::optional<ssh::SFTP> sftp;
31#endif
32 std::unique_ptr<Buffered_File> file;
33
34 public:
36 (
38 bool default_only = false,
39 bool include_shared = true,
40 bool include_server = false
41 ):
42 default_open_mode(default_open_mode),
43 default_only(default_only),
44 include_shared(include_shared),
45 include_server(include_server)
46 {
47 }
48
49 Buffered_File *parse(std::ostream &out, Arguments &arguments);
50 Buffered_File *get_file() const {return file.get();}
51 void print_help(std::ostream &out) const;
52 };
53}
54
55#endif
Class for conveniently parsing command-line arguments.
Definition Arguments.h:19
Create an instance of a Buffered_File by parsing command-line arguments.
Definition File_Parser.h:21
Buffered_File * parse(std::ostream &out, Arguments &arguments)
Buffered_File * get_file() const
Definition File_Parser.h:50
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:36
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,...
Definition Blob.h:7