Просмотр исходного кода

meta: context aware meta_prop_node

Michele Caini 3 лет назад
Родитель
Сommit
9c969fb6ac
3 измененных файлов с 8 добавлено и 4 удалено
  1. 3 2
      src/entt/meta/factory.hpp
  2. 3 1
      src/entt/meta/meta.hpp
  3. 2 1
      src/entt/meta/node.hpp

+ 3 - 2
src/entt/meta/factory.hpp

@@ -11,6 +11,7 @@
 #include "../core/fwd.hpp"
 #include "../core/fwd.hpp"
 #include "../core/type_info.hpp"
 #include "../core/type_info.hpp"
 #include "../core/type_traits.hpp"
 #include "../core/type_traits.hpp"
+#include "../locator/locator.hpp" // TODO
 #include "context.hpp"
 #include "context.hpp"
 #include "meta.hpp"
 #include "meta.hpp"
 #include "node.hpp"
 #include "node.hpp"
@@ -489,13 +490,13 @@ public:
                 *bucket,
                 *bucket,
                 id,
                 id,
                 internal::meta_prop_node{
                 internal::meta_prop_node{
-                    &internal::resolve_TODO<void>});
+                    &internal::resolve<void>});
         } else {
         } else {
             internal::meta_extend(
             internal::meta_extend(
                 *bucket,
                 *bucket,
                 id,
                 id,
                 internal::meta_prop_node{
                 internal::meta_prop_node{
-                    &internal::resolve_TODO<std::decay_t<Value>>...,
+                    &internal::resolve<std::decay_t<Value>>...,
                     std::make_shared<std::decay_t<Value>>(std::forward<Value>(value))...});
                     std::make_shared<std::decay_t<Value>>(std::forward<Value>(value))...});
         }
         }
 
 

+ 3 - 1
src/entt/meta/meta.hpp

@@ -13,6 +13,7 @@
 #include "../core/type_info.hpp"
 #include "../core/type_info.hpp"
 #include "../core/type_traits.hpp"
 #include "../core/type_traits.hpp"
 #include "../core/utility.hpp"
 #include "../core/utility.hpp"
+#include "../locator/locator.hpp" // TODO
 #include "adl_pointer.hpp"
 #include "adl_pointer.hpp"
 #include "context.hpp"
 #include "context.hpp"
 #include "fwd.hpp"
 #include "fwd.hpp"
@@ -655,7 +656,8 @@ struct meta_prop {
      * @return A wrapper containing the value stored with the property.
      * @return A wrapper containing the value stored with the property.
      */
      */
     [[nodiscard]] meta_any value() const {
     [[nodiscard]] meta_any value() const {
-        return node->value ? node->type().from_void(nullptr, node->value.get()) : meta_any{};
+        const auto &ctx_TODO = internal::meta_context::from(locator<meta_ctx>::value_or());
+        return node->value ? node->type(ctx_TODO).from_void(nullptr, node->value.get()) : meta_any{};
     }
     }
 
 
     /**
     /**

+ 2 - 1
src/entt/meta/node.hpp

@@ -13,6 +13,7 @@
 #include "../core/type_info.hpp"
 #include "../core/type_info.hpp"
 #include "../core/type_traits.hpp"
 #include "../core/type_traits.hpp"
 #include "../core/utility.hpp"
 #include "../core/utility.hpp"
+#include "../locator/locator.hpp" // TODO
 #include "context.hpp"
 #include "context.hpp"
 #include "type_traits.hpp"
 #include "type_traits.hpp"
 
 
@@ -48,7 +49,7 @@ enum class meta_traits : std::uint32_t {
 struct meta_type_node;
 struct meta_type_node;
 
 
 struct meta_prop_node {
 struct meta_prop_node {
-    meta_type_node (*type)() noexcept {};
+    meta_type_node (*type)(const meta_context &) noexcept {};
     std::shared_ptr<void> value{};
     std::shared_ptr<void> value{};
 };
 };