23 #include <interfaces/generator/cpp_generator.h> 24 #include <interfaces/generator/tolua_generator.h> 25 #include <interfaces/generator/parser.h> 26 #include <interfaces/generator/digest.h> 27 #include <interfaces/generator/exceptions.h> 29 #include <utils/system/argparser.h> 30 #include <utils/system/file.h> 40 main(
int argc,
char **argv)
45 const vector<const char *> & items = argp->
items();
46 if ( items.size() == 0 || argp->
has_arg(
"h") ) {
47 cout <<
"Fawkes Interface generator - Usage Instructions" << endl
48 <<
"===============================================================================" << endl
49 <<
"Usage: " << argv[0] <<
" [-h] [-d dir] [-v] config.xml [config2.xml...]" << endl
50 <<
"where [options] is one or more of:" << endl
51 <<
" -h These help instructions" << endl
52 <<
" -d dir Directory where to write generated files" << endl
53 <<
" -v Verbose console output." << endl
61 for ( vector<const char *>::const_iterator i = items.begin(); i != items.end(); ++i) {
66 if ( ( pos = s.find_last_of (
".")) != string::npos ) {
67 prefix = s.substr(0, pos);
72 if ( ( pos = s.find_last_of (
"/")) != string::npos ) {
73 prefix = s.substr(pos + 1);
78 if ( ! File::exists( *i ) ) {
79 cout <<
"File " << *i <<
" does not exist" << endl;
81 }
else if (! File::is_regular( *i ) ) {
82 cout << *i <<
" is not a regular file" << endl;
128 toluaigen->generate();
136 cout <<
"Generating the interface failed." << endl;
const char * arg(const char *argn)
Get argument value.
const std::vector< const char *> & items() const
Get non-option items.
void parse()
Parse config.
Fawkes library namespace.
const unsigned char * get_hash()
Get hash.
Parse command line arguments.
void generate()
Generator cpp and h files.
Parser used to get information out of interface template.
void print()
Print parsed data.
std::string getInterfaceAuthor()
Get interface author.
std::string getDataComment()
Get data comment.
Base class for exceptions in Fawkes.
size_t get_hash_size()
Get hash size.
Generator that transforms input from the InterfaceParser into valid C++ classes.
Generator that transforms input from the InterfaceParser into valid ToLua++ package file...
std::vector< InterfaceMessage > getMessages()
Get messages.
std::vector< InterfaceField > getDataFields()
Get data fields.
std::string getInterfaceCreationDate()
Get interface creation date as string Only valid after parse().
void print_trace()
Prints trace to stderr.
std::vector< InterfacePseudoMap > getPseudoMaps(xmlpp::Node *node, std::vector< InterfaceField > &fields)
Get parsed pseudo maps.
std::string getInterfaceName()
Get interface name.
Interface digest generator.
std::vector< InterfaceEnumConstant > getEnumConstants()
Get enum constants.
bool has_arg(const char *argn)
Check if argument has been supplied.
std::string getInterfaceYear()
Get interface copyright year.
std::vector< InterfaceConstant > getConstants()
Get constants.