EnTT 3.14.0
Loading...
Searching...
No Matches
resolve.hpp
1#ifndef ENTT_META_RESOLVE_HPP
2#define ENTT_META_RESOLVE_HPP
3
4#include <type_traits>
5#include "../core/type_info.hpp"
6#include "../locator/locator.hpp"
7#include "context.hpp"
8#include "meta.hpp"
9#include "node.hpp"
10#include "range.hpp"
11
12namespace entt {
13
20template<typename Type>
21[[nodiscard]] meta_type resolve(const meta_ctx &ctx) noexcept {
22 auto &&context = internal::meta_context::from(ctx);
23 return {ctx, internal::resolve<std::remove_cv_t<std::remove_reference_t<Type>>>(context)};
24}
25
31template<typename Type>
35
41[[nodiscard]] inline meta_range<meta_type, typename decltype(internal::meta_context::value)::const_iterator> resolve(const meta_ctx &ctx) noexcept {
42 auto &&context = internal::meta_context::from(ctx);
43 return {{ctx, context.value.cbegin()}, {ctx, context.value.cend()}};
44}
45
50[[nodiscard]] inline meta_range<meta_type, typename decltype(internal::meta_context::value)::const_iterator> resolve() noexcept {
52}
53
60[[nodiscard]] inline meta_type resolve(const meta_ctx &ctx, const id_type id) noexcept {
61 for(auto &&curr: resolve(ctx)) {
62 if(curr.second.id() == id) {
63 return curr.second;
64 }
65 }
66
67 return meta_type{};
68}
69
75[[nodiscard]] inline meta_type resolve(const id_type id) noexcept {
77}
78
85[[nodiscard]] inline meta_type resolve(const meta_ctx &ctx, const type_info &info) noexcept {
86 auto &&context = internal::meta_context::from(ctx);
87 const auto *elem = internal::try_resolve(context, info);
88 return (elem != nullptr) ? meta_type{ctx, *elem} : meta_type{};
89}
90
96[[nodiscard]] inline meta_type resolve(const type_info &info) noexcept {
98}
99
100} // namespace entt
101
102#endif
Service locator, nothing more.
Definition locator.hpp:27
Opaque meta context type.
Definition context.hpp:34
Opaque wrapper for types.
Definition meta.hpp:1153
EnTT default namespace.
Definition dense_map.hpp:22
constexpr Type make_obj_using_allocator(const Allocator &allocator, Args &&...args)
Uses-allocator construction utility (waiting for C++20).
Definition memory.hpp:219
std::uint32_t id_type
Alias declaration for type identifiers.
Definition fwd.hpp:14
meta_type resolve() noexcept
Returns the meta type associated with a given type.
Definition resolve.hpp:32
Utility class to create an iterable object from a pair of iterators.
Definition iterator.hpp:141
Implementation specific information about a type.