25 out <<
"/////////////////////////////////////////////////////////////////////////////\n";
27 out <<
"// This code was automatically generated by the joedb compiler\n";
28 out <<
"// https://www.joedb.org/\n";
32 out <<
"// joedbc compilation time: " << __DATE__ <<
' ' << __TIME__ <<
'\n';
35 out <<
"/////////////////////////////////////////////////////////////////////////////\n";
47 switch (type.get_type_id())
53 case Type::Type_Id::reference:
54 out <<
"id_of_" << options.db.get_table_name(type.get_table_id());
57 #define TYPE_MACRO(storage_tt, return_tt, type_id, read, write)\
58 case Type::Type_Id::type_id:\
59 if (return_type || setter_type)\
64 #define TYPE_MACRO_NO_REFERENCE
77 for (
size_t i = 0; i < index.
field_ids.size(); i++)
126 #define STRINGIFY(X) #X
127 #define EXPAND_AND_STRINGIFY(X) STRINGIFY(X)
133 static constexpr char const *
const types[] =
136 #define TYPE_MACRO(a, b, type_id, d, e) EXPAND_AND_STRINGIFY(type_id),
147 static char const *
const cpp_types[] =
150 #define TYPE_MACRO(a, type, c, d, e) EXPAND_AND_STRINGIFY(type),
161 static char const *
const storage_types[] =
164 #define TYPE_MACRO(storage, b, c, d, e) EXPAND_AND_STRINGIFY(storage),
171 #undef EXPAND_AND_STRINGIFY
178 const char *dir_name,
179 const char *file_name
182 const std::string dir_string =
183 options.output_path +
"/" +
184 options.get_name_space_back() +
"/" +
185 std::string(dir_name);
187 std::filesystem::create_directories(dir_string);
189 return dir_string +
"/" + std::string(file_name);
196 const char *dir_name,
197 const char *file_name,
const 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
Record_Id get_used_count() const
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)
std::string get_file_string(const char *dir_name, const char *file_name)
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
void write_tuple_type(const Compiler_Options::Index &index, bool reference)
Generator(const char *dir_name, const char *file_name, const Compiler_Options &options)
constexpr const char * get_version()
@ truncate
create new file, or truncate existing file, and locks the file
std::string get_time_string_of_now()
One code generator for each of the file generated by joedbc.
std::vector< Field_Id > field_ids