Joedb 9.5.0
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
File_Database_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_Database.h", options)
13 {
14 }
15
16 ////////////////////////////////////////////////////////////////////////////
18 ////////////////////////////////////////////////////////////////////////////
19 {
21
22 out << R"RRR(
23#include "Writable_Database.h"
24#include "joedb/journal/File.h"
25
26)RRR";
27
28
30
31 out << R"RRR(
32 namespace detail
33 {
34 class File_Database_Data
35 {
36 protected:
37 joedb::File file;
38
39 File_Database_Data(const char *file_name, joedb::Open_Mode mode):
40 file(file_name, mode)
41 {
42 }
43 };
44 }
45
46 /// Shortcut to directly build a @ref Writable_Database from a file name
47 class File_Database:
48 protected detail::File_Database_Data,
49 public Writable_Database
50 {
51 public:
52 File_Database
53 (
54 const char *file_name,
55 joedb::Open_Mode mode = joedb::Open_Mode::write_existing_or_create_new
56 ):
57 File_Database_Data(file_name, mode),
58 Writable_Database(file)
59 {
60 }
61
62 File_Database
63 (
64 const std::string &file_name,
65 joedb::Open_Mode mode = joedb::Open_Mode::write_existing_or_create_new
66 ):
67 File_Database(file_name.c_str(), mode)
68 {
69 }
70 };
71)RRR";
72
74 out << "\n#endif\n";
75 }
76}
const std::vector< std::string > & get_name_space() const
File_Database_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