|
@@ -143,35 +143,41 @@ struct concrete_type: an_abstract_type, another_abstract_type {
|
|
|
|
|
|
|
|
struct Meta: ::testing::Test {
|
|
struct Meta: ::testing::Test {
|
|
|
static void SetUpTestCase() {
|
|
static void SetUpTestCase() {
|
|
|
- entt::reflect<double>().conv<int>();
|
|
|
|
|
|
|
+ entt::meta<double>().conv<int>();
|
|
|
|
|
|
|
|
- entt::reflect<char>("char"_hs, std::make_pair(properties::prop_int, 42))
|
|
|
|
|
|
|
+ entt::meta<char>()
|
|
|
|
|
+ .type("char"_hs, std::make_pair(properties::prop_int, 42))
|
|
|
.data<&set<char>, &get<char>>("value"_hs);
|
|
.data<&set<char>, &get<char>>("value"_hs);
|
|
|
|
|
|
|
|
- entt::reflect<properties>()
|
|
|
|
|
|
|
+ entt::meta<properties>()
|
|
|
.data<properties::prop_bool>("prop_bool"_hs)
|
|
.data<properties::prop_bool>("prop_bool"_hs)
|
|
|
.data<properties::prop_int>("prop_int"_hs)
|
|
.data<properties::prop_int>("prop_int"_hs)
|
|
|
.data<&set<properties>, &get<properties>>("value"_hs);
|
|
.data<&set<properties>, &get<properties>>("value"_hs);
|
|
|
|
|
|
|
|
- entt::reflect<unsigned int>().data<0u>("min"_hs).data<100u>("max"_hs);
|
|
|
|
|
|
|
+ entt::meta<unsigned int>().data<0u>("min"_hs).data<100u>("max"_hs);
|
|
|
|
|
|
|
|
- entt::reflect<base_type>("base"_hs);
|
|
|
|
|
|
|
+ entt::meta<base_type>()
|
|
|
|
|
+ .type("base"_hs);
|
|
|
|
|
|
|
|
- entt::reflect<derived_type>("derived"_hs, std::make_pair(properties::prop_int, 99))
|
|
|
|
|
|
|
+ entt::meta<derived_type>()
|
|
|
|
|
+ .type("derived"_hs, std::make_pair(properties::prop_int, 99))
|
|
|
.base<base_type>()
|
|
.base<base_type>()
|
|
|
.ctor<const base_type &, int, char>(std::make_pair(properties::prop_bool, false))
|
|
.ctor<const base_type &, int, char>(std::make_pair(properties::prop_bool, false))
|
|
|
.ctor<&derived_factory>(std::make_pair(properties::prop_int, 42))
|
|
.ctor<&derived_factory>(std::make_pair(properties::prop_int, 42))
|
|
|
.conv<&derived_type::f>()
|
|
.conv<&derived_type::f>()
|
|
|
.conv<&derived_type::g>();
|
|
.conv<&derived_type::g>();
|
|
|
|
|
|
|
|
- entt::reflect<empty_type>("empty"_hs)
|
|
|
|
|
|
|
+ entt::meta<empty_type>()
|
|
|
|
|
+ .type("empty"_hs)
|
|
|
.dtor<&empty_type::destroy>();
|
|
.dtor<&empty_type::destroy>();
|
|
|
|
|
|
|
|
- entt::reflect<fat_type>("fat"_hs)
|
|
|
|
|
|
|
+ entt::meta<fat_type>()
|
|
|
|
|
+ .type("fat"_hs)
|
|
|
.base<empty_type>()
|
|
.base<empty_type>()
|
|
|
.dtor<&fat_type::destroy>();
|
|
.dtor<&fat_type::destroy>();
|
|
|
|
|
|
|
|
- entt::reflect<data_type>("data"_hs)
|
|
|
|
|
|
|
+ entt::meta<data_type>()
|
|
|
|
|
+ .type("data"_hs)
|
|
|
.data<&data_type::i, entt::as_alias_t>("i"_hs, std::make_pair(properties::prop_int, 0))
|
|
.data<&data_type::i, entt::as_alias_t>("i"_hs, std::make_pair(properties::prop_int, 0))
|
|
|
.data<&data_type::j>("j"_hs, std::make_pair(properties::prop_int, 1))
|
|
.data<&data_type::j>("j"_hs, std::make_pair(properties::prop_int, 1))
|
|
|
.data<&data_type::h>("h"_hs, std::make_pair(properties::prop_int, 2))
|
|
.data<&data_type::h>("h"_hs, std::make_pair(properties::prop_int, 2))
|
|
@@ -179,11 +185,13 @@ struct Meta: ::testing::Test {
|
|
|
.data<&data_type::empty>("empty"_hs)
|
|
.data<&data_type::empty>("empty"_hs)
|
|
|
.data<&data_type::v, entt::as_void_t>("v"_hs);
|
|
.data<&data_type::v, entt::as_void_t>("v"_hs);
|
|
|
|
|
|
|
|
- entt::reflect<array_type>("array"_hs)
|
|
|
|
|
|
|
+ entt::meta<array_type>()
|
|
|
|
|
+ .type("array"_hs)
|
|
|
.data<&array_type::global>("global"_hs)
|
|
.data<&array_type::global>("global"_hs)
|
|
|
.data<&array_type::local>("local"_hs);
|
|
.data<&array_type::local>("local"_hs);
|
|
|
|
|
|
|
|
- entt::reflect<func_type>("func"_hs)
|
|
|
|
|
|
|
+ entt::meta<func_type>()
|
|
|
|
|
+ .type("func"_hs)
|
|
|
.func<entt::overload<int(const base_type &, int, int)>(&func_type::f)>("f3"_hs)
|
|
.func<entt::overload<int(const base_type &, int, int)>(&func_type::f)>("f3"_hs)
|
|
|
.func<entt::overload<int(int, int)>(&func_type::f)>("f2"_hs, std::make_pair(properties::prop_bool, false))
|
|
.func<entt::overload<int(int, int)>(&func_type::f)>("f2"_hs, std::make_pair(properties::prop_bool, false))
|
|
|
.func<entt::overload<int(int) const>(&func_type::f)>("f1"_hs, std::make_pair(properties::prop_bool, false))
|
|
.func<entt::overload<int(int) const>(&func_type::f)>("f1"_hs, std::make_pair(properties::prop_bool, false))
|
|
@@ -193,34 +201,40 @@ struct Meta: ::testing::Test {
|
|
|
.func<&func_type::v, entt::as_void_t>("v"_hs)
|
|
.func<&func_type::v, entt::as_void_t>("v"_hs)
|
|
|
.func<&func_type::a, entt::as_alias_t>("a"_hs);
|
|
.func<&func_type::a, entt::as_alias_t>("a"_hs);
|
|
|
|
|
|
|
|
- entt::reflect<setter_getter_type>("setter_getter"_hs)
|
|
|
|
|
|
|
+ entt::meta<setter_getter_type>()
|
|
|
|
|
+ .type("setter_getter"_hs)
|
|
|
.data<&setter_getter_type::static_setter, &setter_getter_type::static_getter>("x"_hs)
|
|
.data<&setter_getter_type::static_setter, &setter_getter_type::static_getter>("x"_hs)
|
|
|
.data<&setter_getter_type::setter, &setter_getter_type::getter>("y"_hs)
|
|
.data<&setter_getter_type::setter, &setter_getter_type::getter>("y"_hs)
|
|
|
.data<&setter_getter_type::static_setter, &setter_getter_type::getter>("z"_hs)
|
|
.data<&setter_getter_type::static_setter, &setter_getter_type::getter>("z"_hs)
|
|
|
.data<&setter_getter_type::setter_with_ref, &setter_getter_type::getter_with_ref>("w"_hs);
|
|
.data<&setter_getter_type::setter_with_ref, &setter_getter_type::getter_with_ref>("w"_hs);
|
|
|
|
|
|
|
|
- entt::reflect<an_abstract_type>("an_abstract_type"_hs, std::make_pair(properties::prop_bool, false))
|
|
|
|
|
|
|
+ entt::meta<an_abstract_type>()
|
|
|
|
|
+ .type("an_abstract_type"_hs, std::make_pair(properties::prop_bool, false))
|
|
|
.data<&an_abstract_type::i>("i"_hs)
|
|
.data<&an_abstract_type::i>("i"_hs)
|
|
|
.func<&an_abstract_type::f>("f"_hs)
|
|
.func<&an_abstract_type::f>("f"_hs)
|
|
|
.func<&an_abstract_type::g>("g"_hs);
|
|
.func<&an_abstract_type::g>("g"_hs);
|
|
|
|
|
|
|
|
- entt::reflect<another_abstract_type>("another_abstract_type"_hs, std::make_pair(properties::prop_int, 42))
|
|
|
|
|
|
|
+ entt::meta<another_abstract_type>()
|
|
|
|
|
+ .type("another_abstract_type"_hs, std::make_pair(properties::prop_int, 42))
|
|
|
.data<&another_abstract_type::j>("j"_hs)
|
|
.data<&another_abstract_type::j>("j"_hs)
|
|
|
.func<&another_abstract_type::h>("h"_hs);
|
|
.func<&another_abstract_type::h>("h"_hs);
|
|
|
|
|
|
|
|
- entt::reflect<concrete_type>("concrete"_hs)
|
|
|
|
|
|
|
+ entt::meta<concrete_type>()
|
|
|
|
|
+ .type("concrete"_hs)
|
|
|
.base<an_abstract_type>()
|
|
.base<an_abstract_type>()
|
|
|
.base<another_abstract_type>()
|
|
.base<another_abstract_type>()
|
|
|
.func<&concrete_type::f>("f"_hs);
|
|
.func<&concrete_type::f>("f"_hs);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void SetUpAfterUnregistration() {
|
|
static void SetUpAfterUnregistration() {
|
|
|
- entt::reflect<double>().conv<float>();
|
|
|
|
|
|
|
+ entt::meta<double>().conv<float>();
|
|
|
|
|
|
|
|
- entt::reflect<derived_type>("my_type"_hs, std::make_pair(properties::prop_bool, false))
|
|
|
|
|
|
|
+ entt::meta<derived_type>()
|
|
|
|
|
+ .type("my_type"_hs, std::make_pair(properties::prop_bool, false))
|
|
|
.ctor<>();
|
|
.ctor<>();
|
|
|
|
|
|
|
|
- entt::reflect<another_abstract_type>("your_type"_hs)
|
|
|
|
|
|
|
+ entt::meta<another_abstract_type>()
|
|
|
|
|
+ .type("your_type"_hs)
|
|
|
.data<&another_abstract_type::j>("a_data_member"_hs)
|
|
.data<&another_abstract_type::j>("a_data_member"_hs)
|
|
|
.func<&another_abstract_type::h>("a_member_function"_hs);
|
|
.func<&another_abstract_type::h>("a_member_function"_hs);
|
|
|
}
|
|
}
|
|
@@ -1968,25 +1982,25 @@ TEST_F(Meta, Variables) {
|
|
|
ASSERT_EQ(c, 'x');
|
|
ASSERT_EQ(c, 'x');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-TEST_F(Meta, Unregister) {
|
|
|
|
|
|
|
+TEST_F(Meta, Reset) {
|
|
|
ASSERT_NE(*entt::internal::meta_info<>::ctx, nullptr);
|
|
ASSERT_NE(*entt::internal::meta_info<>::ctx, nullptr);
|
|
|
ASSERT_NE(entt::internal::meta_info<>::local, nullptr);
|
|
ASSERT_NE(entt::internal::meta_info<>::local, nullptr);
|
|
|
|
|
|
|
|
- entt::unregister<char>();
|
|
|
|
|
- entt::unregister<concrete_type>();
|
|
|
|
|
- entt::unregister<setter_getter_type>();
|
|
|
|
|
- entt::unregister<fat_type>();
|
|
|
|
|
- entt::unregister<data_type>();
|
|
|
|
|
- entt::unregister<func_type>();
|
|
|
|
|
- entt::unregister<array_type>();
|
|
|
|
|
- entt::unregister<double>();
|
|
|
|
|
- entt::unregister<properties>();
|
|
|
|
|
- entt::unregister<base_type>();
|
|
|
|
|
- entt::unregister<derived_type>();
|
|
|
|
|
- entt::unregister<empty_type>();
|
|
|
|
|
- entt::unregister<an_abstract_type>();
|
|
|
|
|
- entt::unregister<another_abstract_type>();
|
|
|
|
|
- entt::unregister<unsigned int>();
|
|
|
|
|
|
|
+ entt::meta<char>().reset();
|
|
|
|
|
+ entt::meta<concrete_type>().reset();
|
|
|
|
|
+ entt::meta<setter_getter_type>().reset();
|
|
|
|
|
+ entt::meta<fat_type>().reset();
|
|
|
|
|
+ entt::meta<data_type>().reset();
|
|
|
|
|
+ entt::meta<func_type>().reset();
|
|
|
|
|
+ entt::meta<array_type>().reset();
|
|
|
|
|
+ entt::meta<double>().reset();
|
|
|
|
|
+ entt::meta<properties>().reset();
|
|
|
|
|
+ entt::meta<base_type>().reset();
|
|
|
|
|
+ entt::meta<derived_type>().reset();
|
|
|
|
|
+ entt::meta<empty_type>().reset();
|
|
|
|
|
+ entt::meta<an_abstract_type>().reset();
|
|
|
|
|
+ entt::meta<another_abstract_type>().reset();
|
|
|
|
|
+ entt::meta<unsigned int>().reset();
|
|
|
|
|
|
|
|
ASSERT_EQ(*entt::internal::meta_info<>::ctx, nullptr);
|
|
ASSERT_EQ(*entt::internal::meta_info<>::ctx, nullptr);
|
|
|
ASSERT_EQ(entt::internal::meta_info<>::local, nullptr);
|
|
ASSERT_EQ(entt::internal::meta_info<>::local, nullptr);
|