Joedb 9.1.4
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
File_Client_h.cpp
Go to the documentation of this file.
3
4namespace joedb::generator
5{
6 ////////////////////////////////////////////////////////////////////////////
8 ////////////////////////////////////////////////////////////////////////////
9 (
10 const Compiler_Options &options
11 ):
12 Generator(".", "File_Client.h", options)
13 {
14 }
15
16 ////////////////////////////////////////////////////////////////////////////
18 ////////////////////////////////////////////////////////////////////////////
19 {
21
22 out << R"RRR(
23#include "Client.h"
24#include "joedb/journal/File.h"
25
26)RRR";
27
29
30 out << R"RRR(
31 namespace detail
32 {
33 ///////////////////////////////////////////////////////////////////////////
34 class File_Client_Data
35 ///////////////////////////////////////////////////////////////////////////
36 {
37 protected:
38 joedb::File file;
39 joedb::Connection connection;
40
41 File_Client_Data(const char *file_name):
42 file(file_name, joedb::File::lockable ? joedb::Open_Mode::shared_write : joedb::Open_Mode::write_existing_or_create_new)
43 {
44 }
45 };
46 }
47
48 /// Shortcut to directly build a @ref Client from a file name
49 class File_Client: private detail::File_Client_Data, public Client
50 {
51 public:
52 File_Client(const char *file_name):
53 detail::File_Client_Data(file_name),
54 Client(File_Client_Data::file, File_Client_Data::connection)
55 {
56 }
57
58 File_Client(const std::string &file_name):
59 File_Client(file_name.c_str())
60 {
61 }
62 };
63)RRR";
64
66 out << "\n#endif\n";
67 }
68}
const std::vector< std::string > & get_name_space() const
File_Client_h(const Compiler_Options &options)
const Compiler_Options & options
Definition Generator.h:14
void namespace_open(std::ostream &out, const std::vector< std::string > &n)
void namespace_close(std::ostream &out, const std::vector< std::string > &n)
void namespace_include_guard(std::ostream &out, const char *name, const std::vector< std::string > &n)
One code generator for each of the file generated by joedbc.
Definition Client_h.cpp:5