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;
92 return std::move(predicate);
96template<
typename Value,
typename... Args>
99 return {entt::internal::meta_custom_node{type_id<Value>().hash(), std::make_shared<Value>(std::forward<Args>(args)...)}};
103auto is_property_visible(
const entt::meta_any&
object,
const entt::meta_data& prop) -> bool;
106auto is_property_visible(
const entt::meta_any&
object,
const entt::meta_custom& custom) -> bool;
107auto is_property_readonly(
const entt::meta_any&
object,
const entt::meta_custom& custom) -> bool;
109auto get_property_hint(
const entt::meta_any&
object,
const entt::meta_data& prop) -> std::string;
114#define CAT_IMPL_(a, b) a##b
115#define CAT_(a, b) CAT_IMPL_(a, b)
117#define ANONYMOUS_VARIABLE(str) CAT_(str, CAT_(__COUNTER__, CAT_(__LINE__, __COUNTER__)))
119#define ANONYMOUS_VARIABLE(str) CAT_(str, __LINE__)
127 static const int s = [&f]()
136#define REFLECT_EXTERN(cls) \
137 template<typename T> \
138 extern void reflection_auto_register_reflection_function_t(); \
140 void reflection_auto_register_reflection_function_t<cls>(); \
141 static const int ANONYMOUS_VARIABLE(auto_register__) = \
142 refl_detail::get_reg<cls>(&reflection_auto_register_reflection_function_t<cls>)
144#define REFLECT_INLINE(cls) \
145 REFLECT_EXTERN(cls); \
147 inline void reflection_auto_register_reflection_function_t<cls>()
149#define REFLECT(cls) \
151 void reflection_auto_register_reflection_function_t<cls>()
153#define REFLECTION_REGISTRATION \
154 static void reflection_auto_register_reflection_function_(); \
157 struct reflection__auto__register__ \
159 reflection__auto__register__() \
161 reflection_auto_register_reflection_function_(); \
165 static const reflection__auto__register__ ANONYMOUS_VARIABLE(auto_register__); \
166 static void reflection_auto_register_reflection_function_()
auto property_predicate(property_predicate_t< T > predicate) -> property_predicate_t< T >
auto get_derived_types(const meta_type &t) -> std::vector< meta_type >
auto get_property_hint(const entt::meta_any &object, const entt::meta_data &prop) -> std::string
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 is_property_visible(const entt::meta_any &object, const entt::meta_data &prop) -> bool
auto get_attribute_as(const meta_custom &custom, const char *name) -> T
auto copy_meta_any(const entt::meta_any &src) -> entt::meta_any
std::function< T(const meta_any &)> property_predicate_t
auto get_attribute(const meta_custom &custom, const char *name) -> const meta_any &
std::map< std::string, meta_any > attributes
auto is_property_readonly(const entt::meta_any &object, const entt::meta_data &prop) -> bool
auto is_property_flattable(const entt::meta_any &object, const entt::meta_data &prop) -> bool
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