ec9842940b1bd00209257d0fff7392af784e4802
[supertux.git] / tools / miniswig / create_wrapper.hpp
1 #ifndef __CREATE_WRAPPER_H__
2 #define __CREATE_WRAPPER_H__
3
4 #include "tree.hpp"
5
6 class WrapperCreator
7 {
8 public:
9     /// this is used for indentation
10     const char* ind;
11     // output stream
12     std::ostream& out;
13     std::ostream& hppout;
14
15     WrapperCreator(std::ostream& _out = std::cout, std::ostream& _hppout = std::cout)
16         : out(_out), hppout(_hppout)
17     {
18         ind = "  ";
19     }
20
21     void create_wrapper(Namespace* ns);
22
23 private:
24     std::string ns_prefix;
25     
26     void create_register_functions_code(Namespace* ns);
27     void create_register_function_code(Function* function, Class* _class);
28     void create_register_classes_code(Namespace* ns);
29     void create_register_class_code(Class* _class);
30     void create_register_constant_code(Field* field);
31     void create_register_constants_code(Namespace* ns);
32     void create_register_slot_code(const std::string& what,
33                                    const std::string& name);
34     
35     void create_function_list(Namespace* ns);
36     void create_const_lists(Namespace* ns);
37     void create_class_const_lists(Class* _class);
38     void create_class_wrapper(Class* _class);
39     void create_class_release_hook(Class* _class);
40     void create_squirrel_instance(Class* _class);
41     void create_function_wrapper(Class* _class, Function* function);
42     void prepare_argument(const Type& type, size_t idx, const std::string& var);
43     void push_to_stack(const Type& type, const std::string& var);
44 };
45
46 #endif
47