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