lib.cpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include <entt/config/config.h>
  2. #include <entt/core/hashed_string.hpp>
  3. #include <entt/locator/locator.hpp>
  4. #include <entt/meta/context.hpp>
  5. #include <entt/meta/factory.hpp>
  6. #include <entt/meta/meta.hpp>
  7. #include "../../../common/boxed_type.h"
  8. #include "../../../common/empty.h"
  9. test::boxed_int create_boxed_int(int value) {
  10. return test::boxed_int{value};
  11. }
  12. ENTT_API void share(const entt::locator<entt::meta_ctx>::node_type &handle) {
  13. entt::locator<entt::meta_ctx>::reset(handle);
  14. }
  15. ENTT_API void set_up() {
  16. using namespace entt::literals;
  17. entt::meta_factory<test::boxed_int>{}
  18. .type("boxed_int"_hs)
  19. .ctor<&create_boxed_int>()
  20. .data<&test::boxed_int::value>("value"_hs);
  21. entt::meta_factory<test::empty>{}
  22. .type("empty"_hs)
  23. .ctor<>();
  24. static_cast<void>(entt::meta_factory<double>{});
  25. }
  26. ENTT_API void tear_down() {
  27. entt::meta_reset<test::boxed_int>();
  28. entt::meta_reset<test::empty>();
  29. }
  30. ENTT_API entt::meta_any wrap_int(int value) {
  31. return value;
  32. }