Fawkes API
Fawkes Development Version
|
Generator that transforms input from the InterfaceParser into valid ToLua++ package file. More...
#include <>>
Public Member Functions | |
ToLuaInterfaceGenerator (std::string directory, std::string interface_name, std::string config_basename, std::string author, std::string year, std::string creation_date, std::string data_comment, const unsigned char *hash, size_t hash_size, const std::vector< InterfaceConstant > &constants, const std::vector< InterfaceEnumConstant > &enum_constants, const std::vector< InterfaceField > &data_fields, const std::vector< InterfacePseudoMap > &pseudo_maps, const std::vector< InterfaceMessage > &messages) | |
Constructor. More... | |
~ToLuaInterfaceGenerator () | |
Destructor. More... | |
void | write_toluaf (FILE *f) |
Write h file. More... | |
void | write_header (FILE *f, std::string filename) |
Write header to file. More... | |
void | write_constants_h (FILE *f) |
Write constants to h file. More... | |
void | write_messages_h (FILE *f) |
Write messages to h file. More... | |
void | write_message_superclass_h (FILE *f) |
Write superclass methods. More... | |
void | write_superclass_h (FILE *f) |
Write superclass methods. More... | |
void | write_lua_code (FILE *f, std::string classname) |
Write additional Lua code to file. More... | |
void | write_methods_h (FILE *f, std::string is, std::vector< InterfaceField > fields) |
Write methods to h file. More... | |
void | write_methods_h (FILE *f, std::string is, std::vector< InterfaceField > fields, std::vector< InterfacePseudoMap > pseudo_maps) |
Write methods to h file. More... | |
void | write_message_ctor_dtor_h (FILE *f, std::string is, std::string classname, std::vector< InterfaceField > fields) |
Write constructor and destructor for message to h file. More... | |
void | write_ctor_dtor_h (FILE *f, std::string is, std::string classname) |
Write constructor and destructor to h file. More... | |
void | generate () |
Generator cpp and h files. More... | |
const char * | convert_type (std::string c_type) |
Convert C type to Lua type. More... | |
Generator that transforms input from the InterfaceParser into valid ToLua++ package file.
Definition at line 36 of file tolua_generator.h.
ToLuaInterfaceGenerator::ToLuaInterfaceGenerator | ( | std::string | directory, |
std::string | interface_name, | ||
std::string | config_basename, | ||
std::string | author, | ||
std::string | year, | ||
std::string | creation_date, | ||
std::string | data_comment, | ||
const unsigned char * | hash, | ||
size_t | hash_size, | ||
const std::vector< InterfaceConstant > & | constants, | ||
const std::vector< InterfaceEnumConstant > & | enum_constants, | ||
const std::vector< InterfaceField > & | data_fields, | ||
const std::vector< InterfacePseudoMap > & | pseudo_maps, | ||
const std::vector< InterfaceMessage > & | messages | ||
) |
Constructor.
directory | Directory where to create the files |
interface_name | name of the interface, should end with Interface |
config_basename | basename of the config without suffix |
author | author of interface |
year | year of copyright |
creation_date | user-supplied creation date of interface |
data_comment | comment in data block. |
hash | MD5 hash of the config file that was used to generate the interface |
hash_size | size in bytes of hash |
constants | constants |
enum_constants | constants defined as an enum |
data_fields | data fields of the interface |
pseudo_maps | pseudo maps of the interface |
messages | messages defined in the interface |
Definition at line 59 of file tolua_generator.cpp.
ToLuaInterfaceGenerator::~ToLuaInterfaceGenerator | ( | ) |
Destructor.
Definition at line 100 of file tolua_generator.cpp.
const char * ToLuaInterfaceGenerator::convert_type | ( | std::string | c_type | ) |
Convert C type to Lua type.
tolua++ does not deal well with stdint types, therefore we convert them to "traditional" types.
c_type | C type to convert |
Definition at line 112 of file tolua_generator.cpp.
void ToLuaInterfaceGenerator::generate | ( | ) |
Generator cpp and h files.
Definition at line 508 of file tolua_generator.cpp.
void ToLuaInterfaceGenerator::write_constants_h | ( | FILE * | f | ) |
Write constants to h file.
f | file to write to |
Definition at line 209 of file tolua_generator.cpp.
void ToLuaInterfaceGenerator::write_ctor_dtor_h | ( | FILE * | f, |
std::string | is, | ||
std::string | classname | ||
) |
Write constructor and destructor to h file.
f | file to write to |
is | indentation space |
classname | name of class |
Definition at line 264 of file tolua_generator.cpp.
void ToLuaInterfaceGenerator::write_header | ( | FILE * | f, |
std::string | filename | ||
) |
Write header to file.
f | file to write to |
filename | name of file |
Definition at line 174 of file tolua_generator.cpp.
void ToLuaInterfaceGenerator::write_lua_code | ( | FILE * | f, |
std::string | classname | ||
) |
Write additional Lua code to file.
The code is required for correctly type message access.
f | file to write to |
classname | name of the interface class |
Definition at line 395 of file tolua_generator.cpp.
void ToLuaInterfaceGenerator::write_message_ctor_dtor_h | ( | FILE * | f, |
std::string | is, | ||
std::string | classname, | ||
std::vector< InterfaceField > | fields | ||
) |
Write constructor and destructor for message to h file.
f | file to write to |
is | indentation space |
classname | name of class |
fields | vector of data fields of message |
Definition at line 282 of file tolua_generator.cpp.
void ToLuaInterfaceGenerator::write_message_superclass_h | ( | FILE * | f | ) |
Write superclass methods.
f | file to write to |
Definition at line 366 of file tolua_generator.cpp.
void ToLuaInterfaceGenerator::write_messages_h | ( | FILE * | f | ) |
Write messages to h file.
f | file to write to |
Definition at line 243 of file tolua_generator.cpp.
void ToLuaInterfaceGenerator::write_methods_h | ( | FILE * | f, |
std::string | is, | ||
std::vector< InterfaceField > | fields | ||
) |
Write methods to h file.
f | file to write to |
is | indentation space. |
fields | fields to write accessor methods for. |
Definition at line 415 of file tolua_generator.cpp.
void ToLuaInterfaceGenerator::write_methods_h | ( | FILE * | f, |
std::string | is, | ||
std::vector< InterfaceField > | fields, | ||
std::vector< InterfacePseudoMap > | pseudo_maps | ||
) |
Write methods to h file.
f | file to write to |
is | indentation space. |
fields | fields to write accessor methods for. |
pseudo_maps | pseudo maps |
Definition at line 459 of file tolua_generator.cpp.
void ToLuaInterfaceGenerator::write_superclass_h | ( | FILE * | f | ) |
Write superclass methods.
f | file to write to |
Definition at line 313 of file tolua_generator.cpp.
void ToLuaInterfaceGenerator::write_toluaf | ( | FILE * | f | ) |