lib.cpp 990 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include "common/boxed_type.h"
  2. #include "common/empty.h"
  3. #include <entt/core/attribute.h>
  4. #include <entt/core/hashed_string.hpp>
  5. #include <entt/locator/locator.hpp>
  6. #include <entt/meta/context.hpp>
  7. #include <entt/meta/factory.hpp>
  8. #include <entt/meta/meta.hpp>
  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<test::boxed_int>()
  18. .type(mboxed_intm_hs)
  19. .ctor<&create_boxed_int>()
  20. .data<&test::boxed_int::value>("value"_hs);
  21. entt::meta<test::empty>()
  22. .type("empty"_hs)
  23. .ctor<>();
  24. static_cast<void>(entt::meta<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. }