Joedb 9.1.4
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 joedb::Readonly_Journal::Check check = joedb::Readonly_Journal::Check::all,
57 joedb::Commit_Level commit_level = joedb::Commit_Level::no_commit
58 ):
59 File_Database_Data(file_name, mode),
60 Writable_Database(file, check, commit_level)
61 {
62 }
63
64 File_Database
65 (
66 const std::string &file_name,
67 joedb::Open_Mode mode = joedb::Open_Mode::write_existing_or_create_new,
68 joedb::Readonly_Journal::Check check = joedb::Readonly_Journal::Check::all,
69 joedb::Commit_Level commit_level = joedb::Commit_Level::no_commit
70 ):
71 File_Database(file_name.c_str(), mode, check, commit_level)
72 {
73 }
74 };
75)RRR";
76
78 out << "\n#endif\n";
79 }
80}
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