Joedb 9.1.4
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
Readonly_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(".", "Readonly_Database.h", options)
13 {
14 }
15
16 ////////////////////////////////////////////////////////////////////////////
18 ////////////////////////////////////////////////////////////////////////////
19 {
20 namespace_include_guard(out, "Readonly_Database", options.get_name_space());
21
22 out << R"RRR(
23#include "Database.h"
24#include "joedb/journal/File.h"
25
26)RRR";
27
29
30 out << R"RRR(
31 /// Load a database from a read-only file
32 class Readonly_Database: public Database
33 {
34 public:
35 Readonly_Database(joedb::Readonly_Journal &journal)
36 {
37 initialize_with_readonly_journal(journal);
38 }
39
40 Readonly_Database(joedb::Readonly_Journal &&journal):
41 Readonly_Database(journal)
42 {
43 }
44
45 Readonly_Database(joedb::Buffered_File &file):
46 Readonly_Database(joedb::Readonly_Journal(file))
47 {
48 }
49
50 Readonly_Database(joedb::Buffered_File &&file):
51 Readonly_Database(file)
52 {
53 }
54
55 Readonly_Database(const char *file_name):
56 Readonly_Database
57 (
58 joedb::File(file_name, joedb::Open_Mode::read_existing)
59 )
60 {
61 }
62
63 Readonly_Database(const std::string &file_name):
64 Readonly_Database(file_name.c_str())
65 {
66 }
67 };
68)RRR";
69
71 out << "\n#endif\n";
72 }
73}
const std::vector< std::string > & get_name_space() const
const Compiler_Options & options
Definition Generator.h:14
Readonly_Database_h(const Compiler_Options &options)
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