4#include <entt/core/hashed_string.hpp>
5#include <entt/meta/container.hpp>
6#include <entt/meta/factory.hpp>
7#include <entt/meta/meta.hpp>
8#include <reflection/reflection_export.h>
14using namespace entt::literals;
21REFLECTION_EXPORT
auto get_attribute(
const meta_custom& custom,
const char*
name) ->
const meta_any&;
27 if(attr.allow_cast<T>())
29 return attr.cast<T>();
38 if(attr.allow_cast<std::string>())
40 return attr.cast<std::string>();
43 if(attr.allow_cast<
const char*>())
45 return std::string(attr.cast<
const char*>());
50REFLECTION_EXPORT
auto get_attribute(
const meta_type& t,
const char*
name) ->
const meta_any&;
58REFLECTION_EXPORT
auto get_attribute(
const meta_data& prop,
const char*
name) ->
const meta_any&;
69REFLECTION_EXPORT
auto copy_meta_any(
const entt::meta_any& src) -> entt::meta_any;
72REFLECTION_EXPORT
auto get_derived_types(
const meta_type& t) -> std::vector<meta_type>;
74REFLECTION_EXPORT
auto as_derived(meta_any& obj) -> bool;
78REFLECTION_EXPORT
auto get_pretty_name(
const meta_type& t) -> std::string;
79REFLECTION_EXPORT
auto get_name(
const meta_type& t) -> std::string;
80REFLECTION_EXPORT
auto get_pretty_name(
const meta_data& prop) -> std::string;
81REFLECTION_EXPORT
auto get_name(
const meta_data& prop) -> std::string;
82REFLECTION_EXPORT
auto get_pretty_name(
const meta_custom& prop) -> std::string;
83REFLECTION_EXPORT
auto get_name(
const meta_custom& prop) -> std::string;
90template<
typename Value,
typename... Args>
93 return {entt::internal::meta_custom_node{type_id<Value>().hash(), std::make_shared<Value>(std::forward<Args>(args)...)}};
98#define CAT_IMPL_(a, b) a##b
99#define CAT_(a, b) CAT_IMPL_(a, b)
101#define ANONYMOUS_VARIABLE(str) CAT_(str, CAT_(__COUNTER__, CAT_(__LINE__, __COUNTER__)))
103#define ANONYMOUS_VARIABLE(str) CAT_(str, __LINE__)
111 static const int s = [&f]()
120#define REFLECT_EXTERN(cls) \
121 template<typename T> \
122 extern void reflection_auto_register_reflection_function_t(); \
124 void reflection_auto_register_reflection_function_t<cls>(); \
125 static const int ANONYMOUS_VARIABLE(auto_register__) = \
126 refl_detail::get_reg<cls>(&reflection_auto_register_reflection_function_t<cls>)
128#define REFLECT_INLINE(cls) \
129 REFLECT_EXTERN(cls); \
131 inline void reflection_auto_register_reflection_function_t<cls>()
133#define REFLECT(cls) \
135 void reflection_auto_register_reflection_function_t<cls>()
137#define REFLECTION_REGISTRATION \
138 static void reflection_auto_register_reflection_function_(); \
141 struct reflection__auto__register__ \
143 reflection__auto__register__() \
145 reflection_auto_register_reflection_function_(); \
149 static const reflection__auto__register__ ANONYMOUS_VARIABLE(auto_register__); \
150 static void reflection_auto_register_reflection_function_()
auto get_derived_types(const meta_type &t) -> std::vector< meta_type >
attributes::value_type attribute
auto get_pretty_name(const meta_type &t) -> std::string
auto as_derived(meta_any &obj) -> bool
auto get_attribute_as< std::string >(const meta_custom &custom, const char *name) -> std::string
auto get_attribute_as(const meta_custom &custom, const char *name) -> T
auto copy_meta_any(const entt::meta_any &src) -> entt::meta_any
auto get_attribute(const meta_custom &custom, const char *name) -> const meta_any &
std::map< std::string, meta_any > attributes
auto property_predicate(property_predicate_t predicate) -> property_predicate_t
std::function< bool(const meta_any &)> property_predicate_t
auto get_derived_type(meta_any &obj) -> meta_type
auto get_name(const meta_type &t) -> std::string
auto make_custom(Args &&...args) -> entt::meta_custom