26 out <<
"/////////////////////////////////////////////////////////////////////////////\n";
28 out <<
"// This code was automatically generated by the joedb compiler\n";
29 out <<
"// https://www.joedb.org/\n";
33 out <<
"// joedbc compilation time: " << __DATE__
" " __TIME__
"\n";
36 out <<
"/////////////////////////////////////////////////////////////////////////////\n";
49 switch (type.get_type_id())
55 case Type::Type_Id::reference:
56 out <<
"id_of_" << options.db.get_table_name(type.get_table_id());
59 #define TYPE_MACRO(storage_tt, return_tt, type_id, read, write)\
60 case Type::Type_Id::type_id:\
61 if (return_type || setter_type)\
66 #define TYPE_MACRO_NO_REFERENCE
80 if (index.field_ids.size() > 1)
84 for (
size_t i = 0; i < index.field_ids.size(); i++)
89 const Type &type = options.db.get_field_type
95 write_type(out, type,
false,
false);
107 options.db.get_field_type(index.table_id, index.field_ids[0]),
130 write_tuple_type(out, index,
false);
132 out <<
", id_of_" << options.db.get_table_name(index.table_id) <<
">";
138 #define STRINGIFY(X) #X
139 #define EXPAND_AND_STRINGIFY(X) STRINGIFY(X)
145 static constexpr char const *
const types[] =
148 #define TYPE_MACRO(a, b, type_id, d, e) EXPAND_AND_STRINGIFY(type_id),
159 static char const *
const cpp_types[] =
162 #define TYPE_MACRO(a, type, c, d, e) EXPAND_AND_STRINGIFY(type),
173 static char const *
const storage_types[] =
176 #define TYPE_MACRO(storage, b, c, d, e) EXPAND_AND_STRINGIFY(storage),
183 #undef EXPAND_AND_STRINGIFY
190 std::string dir_name,
191 std::string file_name,
194 dir_name(std::move(dir_name)),
195 file_name(std::move(file_name)),
204 const std::string dir_string =
const std::string & get_name_space_back() const
const Freedom_Keeper & get_freedom(Table_Id table_id) const override
const std::map< Table_Id, std::string > & get_tables() const override
Record_Id get_used_count() const
Type_Id get_type_id() const
static const char * get_storage_type_string(Type type)
static const char * get_type_string(Type type)
void write_index_type(std::ostream &out, const Compiler_Options::Index &index)
static const char * get_cpp_type_string(Type type)
const std::string file_name
const Compiler_Options & options
const std::string dir_name
virtual void write(std::ostream &out)=0
bool db_has_values() const
void write_tuple_type(std::ostream &out, const Compiler_Options::Index &index, bool reference)
void write_initial_comment(std::ostream &out)
Generator(std::string dir_name, std::string file_name, const Compiler_Options &options)
void write_type(std::ostream &out, Type type, bool return_type, bool setter_type)
constexpr const char * get_version()
std::string get_time_string_of_now()
One code generator for each of the file generated by joedbc.
void write_source_code(const std::string &dir_name, const std::string &file_name, const std::function< void(std::ostream &)> &write)