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";
48 switch (type.get_type_id())
54 case Type::Type_Id::reference:
55 out <<
"id_of_" << options.db.get_table_name(type.get_table_id());
58 #define TYPE_MACRO(storage_tt, return_tt, type_id, read, write)\
59 case Type::Type_Id::type_id:\
60 if (return_type || setter_type)\
65 #define TYPE_MACRO_NO_REFERENCE
78 for (
size_t i = 0; i < index.
field_ids.size(); i++)
124 #define STRINGIFY(X) #X
125 #define EXPAND_AND_STRINGIFY(X) STRINGIFY(X)
131 static constexpr char const *
const types[] =
134 #define TYPE_MACRO(a, b, type_id, d, e) EXPAND_AND_STRINGIFY(type_id),
145 static char const *
const cpp_types[] =
148 #define TYPE_MACRO(a, type, c, d, e) EXPAND_AND_STRINGIFY(type),
159 static char const *
const storage_types[] =
162 #define TYPE_MACRO(storage, b, c, d, e) EXPAND_AND_STRINGIFY(storage),
169 #undef EXPAND_AND_STRINGIFY
176 const char *dir_name,
177 const char *file_name,
184 std::filesystem::create_directory(dir_string);
185 std::string file_string = dir_string +
"/" + std::string(file_name);
187 out.exceptions(std::ios::badbit | std::ios::failbit);
188 out.open(file_string, std::ios::trunc);
const std::vector< std::string > & get_name_space() const
const Compact_Freedom_Keeper & get_freedom(Table_Id table_id) const override
const std::map< Table_Id, std::string > & get_tables() const override
const Type & get_field_type(Table_Id table_id, Field_Id field_id) const override
const std::string & get_table_name(Table_Id table_id) const
Type_Id get_type_id() const
void write_index_type(const Compiler_Options::Index &index)
static const char * get_storage_type_string(Type type)
static const char * get_type_string(Type type)
void write_tuple_type(const Compiler_Options::Index &index)
void write_type(Type type, bool return_type, bool setter_type)
static const char * get_cpp_type_string(Type type)
void write_initial_comment()
const Compiler_Options & options
bool db_has_values() const
Generator(const char *dir_name, const char *file_name, const Compiler_Options &options)
std::string get_time_string_of_now()
One code generator for each of the file generated by joedbc.
constexpr const char * get_version()
std::vector< Field_Id > field_ids