ソースを参照

meta: meta_node<>::ctx -> meta_node<>::global

Michele Caini 6 年 前
コミット
c1117e260c
3 ファイル変更12 行追加12 行削除
  1. 6 6
      src/entt/meta/factory.hpp
  2. 4 4
      src/entt/meta/meta.hpp
  3. 2 2
      test/entt/meta/meta.cpp

+ 6 - 6
src/entt/meta/factory.hpp

@@ -265,11 +265,11 @@ class meta_factory {
     auto record(const ENTT_ID_TYPE identifier) ENTT_NOEXCEPT {
         auto * const node = internal::meta_info<Type>::resolve();
 
-        ENTT_ASSERT(!duplicate(identifier, *internal::meta_info<>::ctx));
-        ENTT_ASSERT(!duplicate(node, *internal::meta_info<>::ctx));
+        ENTT_ASSERT(!duplicate(identifier, *internal::meta_info<>::global));
+        ENTT_ASSERT(!duplicate(node, *internal::meta_info<>::global));
         node->identifier = identifier;
-        node->next = *internal::meta_info<>::ctx;
-        *internal::meta_info<>::ctx = node;
+        node->next = *internal::meta_info<>::global;
+        *internal::meta_info<>::global = node;
 
         return extended_meta_factory<Type>{&node->prop};
     }
@@ -772,7 +772,7 @@ inline meta_type resolve() ENTT_NOEXCEPT {
 inline meta_type resolve(const ENTT_ID_TYPE identifier) ENTT_NOEXCEPT {
     return internal::find_if([identifier](auto *node) {
         return node->identifier == identifier;
-    }, *internal::meta_info<>::ctx);
+    }, *internal::meta_info<>::global);
 }
 
 
@@ -784,7 +784,7 @@ inline meta_type resolve(const ENTT_ID_TYPE identifier) ENTT_NOEXCEPT {
 template<typename Op>
 inline std::enable_if_t<std::is_invocable_v<Op, meta_type>, void>
 resolve(Op op) ENTT_NOEXCEPT {
-    internal::iterate<meta_type>(std::move(op), *internal::meta_info<>::ctx);
+    internal::iterate<meta_type>(std::move(op), *internal::meta_info<>::global);
 }
 
 

+ 4 - 4
src/entt/meta/meta.hpp

@@ -198,7 +198,7 @@ struct meta_node;
 template<>
 struct meta_node<> {
     inline static meta_type_node *local = nullptr;
-    inline static meta_type_node **ctx = &local;
+    inline static meta_type_node **global = &local;
 };
 
 
@@ -208,7 +208,7 @@ struct meta_node<Type> {
 
     static void reset() ENTT_NOEXCEPT {
         auto * const node = resolve();
-        auto **curr = meta_node<>::ctx;
+        auto **curr = meta_node<>::global;
 
         while(*curr && *curr != node) {
             curr = &(*curr)->next;
@@ -267,7 +267,7 @@ struct meta_node<Type> {
         if constexpr(is_named_type_v<Type>) {
             auto *candidate = internal::find_if([](auto *candidate) {
                 return candidate->identifier == named_type_traits<Type>::value;
-            }, *meta_node<>::ctx);
+            }, *meta_node<>::global);
 
             return candidate ? candidate : &node;
         } else {
@@ -1733,7 +1733,7 @@ private:
 struct meta_ctx {
     /*! @brief Sets the context as the current one. */
     void set() const ENTT_NOEXCEPT {
-        internal::meta_info<>::ctx = ctx;
+        internal::meta_info<>::global = ctx;
     }
 
 private:

+ 2 - 2
test/entt/meta/meta.cpp

@@ -2014,7 +2014,7 @@ TEST_F(Meta, SharedProperties) {
 }
 
 TEST_F(Meta, Reset) {
-    ASSERT_NE(*entt::internal::meta_info<>::ctx, nullptr);
+    ASSERT_NE(*entt::internal::meta_info<>::global, nullptr);
     ASSERT_NE(entt::internal::meta_info<>::local, nullptr);
 
     entt::meta<char>().reset();
@@ -2033,7 +2033,7 @@ TEST_F(Meta, 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<>::global, nullptr);
     ASSERT_EQ(entt::internal::meta_info<>::local, nullptr);
 
     ASSERT_FALSE(entt::resolve("char"_hs));