lib.cpp 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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/value_type.h"
  8. #include "lib.h"
  9. namespace {
  10. test::boxed_int create_boxed_int(int value) {
  11. return test::boxed_int{value};
  12. }
  13. } // namespace
  14. ENTT_API void share(const entt::locator<entt::meta_ctx>::node_type &handle) {
  15. entt::locator<entt::meta_ctx>::reset(handle);
  16. }
  17. ENTT_API void set_up() {
  18. using namespace entt::literals;
  19. entt::meta_factory<test::boxed_int>{}
  20. .type("boxed_int"_hs)
  21. .ctor<&create_boxed_int>()
  22. .data<&test::boxed_int::value>("value"_hs);
  23. entt::meta_factory<test::empty>{}
  24. .type("empty"_hs)
  25. .ctor<>();
  26. static_cast<void>(entt::meta_factory<double>{});
  27. }
  28. ENTT_API void tear_down() {
  29. entt::meta_reset<test::boxed_int>();
  30. entt::meta_reset<test::empty>();
  31. }
  32. ENTT_API entt::meta_any wrap_int(int value) {
  33. return value;
  34. }