#pragma once #include "UTemplate/Type.hpp" #include #include using Ubpa::Name; using Ubpa::type_name; namespace refl { class UClass; class ArgsView; using Offset = uint32_t; using Method = void*; using DefaultMember = const ArgsView (*)(); using DefaultMethod = std::pair(*)(); enum FieldFlag:uint32_t { FIELD_NONE_FLAG = 0, FIELD_MEMBER_FLAG = 1 << 0, FIELD_ATTRIBUTE_FLAG = 1 << 1, FIELD_METHOD_FLAG = 1 << 2, FIELD_METHOD_VALUE_FLAG = 1 << 3 }; struct FieldPtr { union Data { Offset offset; Method method; constexpr Data() : method(nullptr) {} constexpr Data(Offset& offset) : offset(offset) {} constexpr Data(Method& method) : method(method) {} constexpr Data(const Method& method) : method(method) {} }; union Default { DefaultMember member; DefaultMethod method; constexpr Default(): method(nullptr) {} constexpr Default(DefaultMember& member) : member(member) {} constexpr Default(DefaultMethod& method) : method(method) {} }; Name name; const UClass* type{}; Data data{}; Default value{}; uint32_t flag{}; //safe bool Invoke(std::vector& ArgsList)const; //unsafe bool Invoke(const std::vector& ArgsList)const; std::vector GetParams() const; }; /* template consteval V* fetch_member_v(V T::*) { return nullptr; } template consteval auto fetch_method_v(R (T::* ptr)(Args...)) { using MethodType = R(*)(T*, Args...); return MethodType{nullptr}; } template consteval auto fetch_method_v(R(*ptr)(Args...)) { return ptr; } template consteval auto FetchMembers(const std::tuple&) { return std::make_tuple(fetch_member_v(Args{nullptr})...); } template consteval auto FetchMethods(const std::tuple&) { return std::make_tuple(fetch_method_v(Args{ nullptr })...); } template class FieldMembers{ public: constexpr FieldMembers() {} FieldMembers(const std::tuple&) { } constexpr static int GetSize() { return sizeof...(Args); } }; template class FieldMethods{ public: constexpr FieldMethods() {} FieldMethods(const std::tuple&) { } constexpr static int GetSize() { return sizeof...(Args); } };*/ }