Unravel Engine C++ Reference
Loading...
Searching...
No Matches
registration.h
Go to the documentation of this file.
1#ifndef REFLECTION_REGISTRATION_H
2#define REFLECTION_REGISTRATION_H
3
4#include <entt/meta/resolve.hpp>
5
6
7template<typename T, typename... Args>
8struct crtp_meta_type : public Args...
9{
10 virtual auto get_meta_type() const -> entt::meta_type
11 {
12 return entt::resolve<T>();
13 }
14
15 static auto get_static_meta_type() -> entt::meta_type
16 {
17 return entt::resolve<T>();
18 }
19
20 template<typename U>
21 auto is() const -> bool
22 {
23 return get_meta_type() == entt::resolve<U>();
24 }
25
26 auto is(const entt::meta_type& type) const -> bool
27 {
28 return get_meta_type() == type;
29 }
30
31 // virtual auto as_derived(const entt::meta_type& type) const -> entt::meta_any
32 // {
33 // auto type = get_meta_type();
34 // return type.from_void(static_cast<const T*>(this));
35 // }
36
37 virtual auto as_derived() -> entt::meta_any
38 {
39 auto type = get_meta_type();
40 return type.from_void(static_cast<T*>(this));
41 }
42};
43
44#endif // REFLECTION_REGISTRATION_H
manifold_type type
static auto get_static_meta_type() -> entt::meta_type
virtual auto as_derived() -> entt::meta_any
auto is(const entt::meta_type &type) const -> bool
virtual auto get_meta_type() const -> entt::meta_type
auto is() const -> bool