lib.cpp 1.1 KB

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