X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=tools%2Fsetupgen%2Fsetupgen.h;fp=tools%2Fsetupgen%2Fsetupgen.h;h=98d1ab80472332d08b409cde37a0b644ebfe1599;hb=3b551a2caabdfebaac592b5fcbbeb6cbfe2fd43f;hp=0000000000000000000000000000000000000000;hpb=8420959665d2a2cfeed3e50dc0d706b9b7570414;p=libs%2Fgame.git diff --git a/tools/setupgen/setupgen.h b/tools/setupgen/setupgen.h new file mode 100644 index 0000000..98d1ab8 --- /dev/null +++ b/tools/setupgen/setupgen.h @@ -0,0 +1,55 @@ +#ifndef SETUPGEN_H_ +#define SETUPGEN_H_ + +#include +#include +#include +#include +#include +#include +#include "enum.h" +#include "struct.h" +#include "type.h" + +class SetupGen: public Msp::RegisteredApplication +{ +private: + class Loader: public Msp::DataFile::ObjectLoader + { + public: + Loader(SetupGen &); + + private: + void init_actions() override; + + void enum_def(const Msp::DataFile::Symbol &); + void name_space(const std::string &); + void struct_def(Struct::Kind, const Msp::DataFile::Symbol &); + }; + + std::string in_fn; + std::string out_fn; + std::string name_space; + std::map types; + std::vector> enums; + std::vector> structs; + std::set headers; + +public: + SetupGen(int, char **); + + int main() override; +private: + void create_standard_types(); + Type &add_type(const std::string &, Type::Kind); +public: + const Type &get_type(const std::string &) const; + +private: + void load(); + void collect_headers(); + void generate_header(Msp::IO::Base &) const; + void generate_code(Msp::IO::Base &) const; +}; + +#endif