Generator that transforms input from the InterfaceParser into valid ToLua++ package file. More...
#include <interfaces/generator/tolua_generator.h>
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. | |
| ~ToLuaInterfaceGenerator () | |
| Destructor. | |
| void | write_toluaf (FILE *f) |
| Write h file. | |
| void | write_header (FILE *f, std::string filename) |
| Write header to file. | |
| void | write_constants_h (FILE *f) |
| Write constants to h file. | |
| void | write_messages_h (FILE *f) |
| Write messages to h file. | |
| void | write_superclass_h (FILE *f) |
| Write superclass methods. | |
| void | write_methods_h (FILE *f, std::stringis, std::vector< InterfaceField > fields) |
| Write methods to h file. | |
| void | write_methods_h (FILE *f, std::stringis, std::vector< InterfaceField > fields, std::vector< InterfacePseudoMap > pseudo_maps) |
| Write methods to h file. | |
| void | write_message_ctor_dtor_h (FILE *f, std::stringis, std::string classname, std::vector< InterfaceField > fields) |
| Write constructor and destructor for message to h file. | |
| void | write_ctor_dtor_h (FILE *f, std::stringis, std::string classname) |
| Write constructor and destructor to h file. | |
| void | generate () |
| Generator cpp and h files. | |
| const char * | convert_type (std::string c_type) |
| Convert C type to Lua type. | |
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.
Referenced by write_constants_h(), write_message_ctor_dtor_h(), and write_methods_h().
| void ToLuaInterfaceGenerator::generate | ( | ) |
Generator cpp and h files.
Definition at line 445 of file tolua_generator.cpp.
References write_toluaf().
| 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.
References convert_type().
Referenced by write_toluaf().
| 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 259 of file tolua_generator.cpp.
Referenced by write_message_ctor_dtor_h().
| 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_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 277 of file tolua_generator.cpp.
References convert_type(), and write_ctor_dtor_h().
Referenced by write_messages_h().
| void ToLuaInterfaceGenerator::write_messages_h | ( | FILE * | f | ) |
Write messages to h file.
| f | file to write to |
Definition at line 239 of file tolua_generator.cpp.
References write_message_ctor_dtor_h(), and write_methods_h().
Referenced by write_toluaf().
| 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 400 of file tolua_generator.cpp.
References convert_type(), and write_methods_h().
| 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 356 of file tolua_generator.cpp.
References convert_type().
Referenced by write_messages_h(), write_methods_h(), and write_toluaf().
| void ToLuaInterfaceGenerator::write_superclass_h | ( | FILE * | f | ) |
Write superclass methods.
| f | file to write to |
Definition at line 308 of file tolua_generator.cpp.
Referenced by write_toluaf().
| void ToLuaInterfaceGenerator::write_toluaf | ( | FILE * | f | ) |
Write h file.
| f | file to write to |
Definition at line 422 of file tolua_generator.cpp.
References write_constants_h(), write_messages_h(), write_methods_h(), and write_superclass_h().
Referenced by generate().
1.6.1