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

meta: try to follow my own naming convention :)

Michele Caini 3 лет назад
Родитель
Сommit
33383bd0c3
4 измененных файлов с 36 добавлено и 36 удалено
  1. 16 16
      src/entt/meta/meta.hpp
  2. 2 2
      src/entt/meta/node.hpp
  3. 15 15
      src/entt/meta/resolve.hpp
  4. 3 3
      src/entt/meta/utility.hpp

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

@@ -656,8 +656,8 @@ struct meta_prop {
      * @return A wrapper containing the value stored with the property.
      */
     [[nodiscard]] meta_any value() const {
-        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{};
+        const auto &context_TODO = internal::meta_context::from(locator<meta_ctx>::value_or());
+        return node->value ? node->type(context_TODO).from_void(nullptr, node->value.get()) : meta_any{};
     }
 
     /**
@@ -988,8 +988,8 @@ public:
      */
     meta_type(const internal::meta_base_node &curr) noexcept
         : meta_type{} {
-        if(const auto &ctx_TODO = internal::meta_context::from(locator<meta_ctx>::value_or()); curr.type) {
-            node = curr.type(ctx_TODO);
+        if(const auto &context_TODO = internal::meta_context::from(locator<meta_ctx>::value_or()); curr.type) {
+            node = curr.type(context_TODO);
         }
     }
 
@@ -1080,8 +1080,8 @@ public:
      * doesn't refer to a pointer type.
      */
     [[nodiscard]] meta_type remove_pointer() const noexcept {
-        const auto &ctx_TODO = internal::meta_context::from(locator<meta_ctx>::value_or());
-        return node.remove_pointer(ctx_TODO);
+        const auto &context_TODO = internal::meta_context::from(locator<meta_ctx>::value_or());
+        return node.remove_pointer(context_TODO);
     }
 
     /**
@@ -1135,8 +1135,8 @@ public:
      * @return The tag for the class template of the underlying type.
      */
     [[nodiscard]] inline meta_type template_type() const noexcept {
-        const auto &ctx_TODO = internal::meta_context::from(locator<meta_ctx>::value_or());
-        return node.templ.type ? meta_type{node.templ.type(ctx_TODO)} : meta_type{};
+        const auto &context_TODO = internal::meta_context::from(locator<meta_ctx>::value_or());
+        return node.templ.type ? meta_type{node.templ.type(context_TODO)} : meta_type{};
     }
 
     /**
@@ -1145,8 +1145,8 @@ public:
      * @return The type of the i-th template argument of a type.
      */
     [[nodiscard]] inline meta_type template_arg(const size_type index) const noexcept {
-        const auto &ctx_TODO = internal::meta_context::from(locator<meta_ctx>::value_or());
-        return index < template_arity() ? meta_type{node.templ.arg(index, ctx_TODO)} : meta_type{};
+        const auto &context_TODO = internal::meta_context::from(locator<meta_ctx>::value_or());
+        return index < template_arity() ? meta_type{node.templ.arg(index, context_TODO)} : meta_type{};
     }
 
     /**
@@ -1447,8 +1447,8 @@ bool meta_any::set(const id_type id, Type &&value) {
 
     if(const auto *value = data(); node.details) {
         for(auto &&curr: node.details->base) {
-            const auto &ctx_TODO = internal::meta_context::from(locator<meta_ctx>::value_or());
-            const auto &as_const = curr.second.type(ctx_TODO).from_void(nullptr, curr.second.cast(value));
+            const auto &context_TODO = internal::meta_context::from(locator<meta_ctx>::value_or());
+            const auto &as_const = curr.second.type(context_TODO).from_void(nullptr, curr.second.cast(value));
 
             if(auto other = as_const.allow_cast(type); other) {
                 return other;
@@ -1486,8 +1486,8 @@ inline bool meta_any::assign(meta_any &&other) {
 }
 
 [[nodiscard]] inline meta_type meta_data::type() const noexcept {
-    const auto &ctx_TODO = internal::meta_context::from(locator<meta_ctx>::value_or());
-    return node->type(ctx_TODO);
+    const auto &context_TODO = internal::meta_context::from(locator<meta_ctx>::value_or());
+    return node->type(context_TODO);
 }
 
 [[nodiscard]] inline meta_type meta_data::arg(const size_type index) const noexcept {
@@ -1496,8 +1496,8 @@ inline bool meta_any::assign(meta_any &&other) {
 }
 
 [[nodiscard]] inline meta_type meta_func::ret() const noexcept {
-    const auto &ctx_TODO = internal::meta_context::from(locator<meta_ctx>::value_or());
-    return node->ret(ctx_TODO);
+    const auto &context_TODO = internal::meta_context::from(locator<meta_ctx>::value_or());
+    return node->ret(context_TODO);
 }
 
 [[nodiscard]] inline meta_type meta_func::arg(const size_type index) const noexcept {

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

@@ -154,10 +154,10 @@ template<typename... Args>
     }
 
     if(from.details) {
-        const auto &ctx_TODO = meta_context::from(locator<meta_ctx>::value_or());
+        const auto &context_TODO = meta_context::from(locator<meta_ctx>::value_or());
 
         for(auto &&curr: from.details->base) {
-            if(const void *elem = try_cast(curr.second.type(ctx_TODO), to, curr.second.cast(instance)); elem) {
+            if(const void *elem = try_cast(curr.second.type(context_TODO), to, curr.second.cast(instance)); elem) {
                 return elem;
             }
         }

+ 15 - 15
src/entt/meta/resolve.hpp

@@ -14,33 +14,33 @@ namespace entt {
 /**
  * @brief Returns the meta type associated with a given type.
  * @tparam Type Type to use to search for a meta type.
- * @param context The context from which to search for meta types.
+ * @param ctx The context from which to search for meta types.
  * @return The meta type associated with the given type, if any.
  */
 template<typename Type>
-[[nodiscard]] meta_type resolve(const meta_ctx &context = locator<meta_ctx>::value_or()) noexcept {
-    auto &&ctx = internal::meta_context::from(context);
-    return internal::resolve<std::remove_cv_t<std::remove_reference_t<Type>>>(ctx);
+[[nodiscard]] meta_type resolve(const meta_ctx &ctx = locator<meta_ctx>::value_or()) noexcept {
+    auto &&context = internal::meta_context::from(ctx);
+    return internal::resolve<std::remove_cv_t<std::remove_reference_t<Type>>>(context);
 }
 
 /**
  * @brief Returns a range to use to visit all meta types.
- * @param context The context from which to search for meta types.
+ * @param ctx The context from which to search for meta types.
  * @return An iterable range to use to visit all meta types.
  */
-[[nodiscard]] inline meta_range<meta_type, typename decltype(internal::meta_context::value)::const_iterator> resolve(const meta_ctx &context = locator<meta_ctx>::value_or()) noexcept {
-    auto &&ctx = internal::meta_context::from(context);
-    return {ctx.value.cbegin(), ctx.value.cend()};
+[[nodiscard]] inline meta_range<meta_type, typename decltype(internal::meta_context::value)::const_iterator> resolve(const meta_ctx &ctx = locator<meta_ctx>::value_or()) noexcept {
+    auto &&context = internal::meta_context::from(ctx);
+    return {context.value.cbegin(), context.value.cend()};
 }
 
 /**
  * @brief Returns the meta type associated with a given identifier, if any.
  * @param id Unique identifier.
- * @param context The context from which to search for meta types.
+ * @param ctx The context from which to search for meta types.
  * @return The meta type associated with the given identifier, if any.
  */
-[[nodiscard]] inline meta_type resolve(const id_type id, const meta_ctx &context = locator<meta_ctx>::value_or()) noexcept {
-    for(auto &&curr: resolve(context)) {
+[[nodiscard]] inline meta_type resolve(const id_type id, const meta_ctx &ctx = locator<meta_ctx>::value_or()) noexcept {
+    for(auto &&curr: resolve(ctx)) {
         if(curr.second.id() == id) {
             return curr.second;
         }
@@ -52,12 +52,12 @@ template<typename Type>
 /**
  * @brief Returns the meta type associated with a given type info object.
  * @param info The type info object of the requested type.
- * @param context The context from which to search for meta types.
+ * @param ctx The context from which to search for meta types.
  * @return The meta type associated with the given type info object, if any.
  */
-[[nodiscard]] inline meta_type resolve(const type_info &info, const meta_ctx &context = locator<meta_ctx>::value_or()) noexcept {
-    auto &&ctx = internal::meta_context::from(context);
-    const auto *elem = internal::try_resolve(info, ctx);
+[[nodiscard]] inline meta_type resolve(const type_info &info, const meta_ctx &ctx = locator<meta_ctx>::value_or()) noexcept {
+    auto &&context = internal::meta_context::from(ctx);
+    const auto *elem = internal::try_resolve(info, context);
     return elem ? *elem : meta_type{};
 }
 

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

@@ -176,9 +176,9 @@ meta_any meta_dispatch([[maybe_unused]] Type &&value) {
  * @return The meta type of the i-th element of the list of arguments.
  */
 template<typename Type>
-[[nodiscard]] static meta_type meta_arg(const std::size_t index, const meta_ctx &context = locator<meta_ctx>::value_or()) noexcept {
-    auto &&ctx = internal::meta_context::from(context);
-    return internal::meta_arg_node(Type{}, index, ctx);
+[[nodiscard]] static meta_type meta_arg(const std::size_t index, const meta_ctx &ctx = locator<meta_ctx>::value_or()) noexcept {
+    auto &&context = internal::meta_context::from(ctx);
+    return internal::meta_arg_node(Type{}, index, context);
 }
 
 /**