create_wrapper.hpp 1.6 KB

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