5#include <Foundation/Reflection/Implementation/AbstractProperty.h>
6#include <Foundation/Reflection/Implementation/VariantAdapter.h>
9template <
class R,
class... Args>
18 virtual const plRTTI*
GetReturnType()
const override {
return plGetStaticRTTI<typename plCleanType<R>::RttiType>(); }
23 template <std::size_t... I>
24 const plRTTI* GetParameterTypeImpl(plUInt32 uiParamIndex, std::index_sequence<I...>)
const
28 return params[uiParamIndex];
33 return GetParameterTypeImpl(uiParamIndex, std::make_index_sequence<
sizeof...(Args)>{});
36 template <std::size_t... I>
41 plPropertyFlags::GetParameterFlags<
typename getArgument<I, Args...>::Type>()..., plPropertyFlags::Void};
42 return params[uiParamIndex];
47 return GetParameterFlagsImpl(uiParamIndex, std::make_index_sequence<
sizeof...(Args)>{});
51template <
typename FUNC>
56template <
class CLASS,
class R,
class... Args>
60 using TargetFunction = R (CLASS::*)(Args...);
73 template <std::size_t... I>
76 CLASS* pTargetInstance =
static_cast<CLASS*
>(pInstance);
77 if constexpr (std::is_same<R, void>::value)
91 ExecuteImpl(pInstance, out_returnValue, arguments, std::make_index_sequence<
sizeof...(Args)>{});
95 TargetFunction m_Function;
98template <
class CLASS,
class R,
class... Args>
102 using TargetFunction = R (CLASS::*)(Args...)
const;
116 template <std::size_t... I>
117 PL_FORCE_INLINE
void ExecuteImpl(
const void* pInstance,
plVariant& out_returnValue,
plArrayPtr<plVariant> arguments, std::index_sequence<I...>)
const
119 const CLASS* pTargetInstance =
static_cast<const CLASS*
>(pInstance);
120 if constexpr (std::is_same<R, void>::value)
134 ExecuteImpl(pInstance, out_returnValue, arguments, std::make_index_sequence<
sizeof...(Args)>{});
138 TargetFunction m_Function;
141template <
class R,
class... Args>
145 using TargetFunction = R (*)(Args...);
155 template <std::size_t... I>
162 template <std::size_t... I>
171 ExecuteImpl(
plTraitInt<std::is_same<R, void>::value>(), out_returnValue, arguments, std::make_index_sequence<
sizeof...(Args)>{});
175 TargetFunction m_Function;
179template <
class CLASS,
class... Args>
190 template <std::size_t... I>
198 template <std::size_t... I>
204 out_returnValue = pInstance;
The base class for a property that represents a function.
Definition AbstractProperty.h:535
plAbstractFunctionProperty(const char *szPropertyName)
Passes the property name through to plAbstractProperty.
Definition AbstractProperty.h:538
This class encapsulates an array and it's size. It is recommended to use this class instead of plain ...
Definition ArrayPtr.h:37
Definition FunctionProperty.h:181
virtual plFunctionType::Enum GetFunctionType() const override
Returns the type of function, see plFunctionPropertyType::Enum.
Definition FunctionProperty.h:188
virtual void Execute(void *pInstance, plArrayPtr< plVariant > arguments, plVariant &out_returnValue) const override
Calls the function. Provide the instance on which the function is supposed to be called.
Definition FunctionProperty.h:207
virtual void Execute(void *pInstance, plArrayPtr< plVariant > arguments, plVariant &out_returnValue) const override
Calls the function. Provide the instance on which the function is supposed to be called.
Definition FunctionProperty.h:169
virtual plFunctionType::Enum GetFunctionType() const override
Returns the type of function, see plFunctionPropertyType::Enum.
Definition FunctionProperty.h:153
virtual void Execute(void *pInstance, plArrayPtr< plVariant > arguments, plVariant &out_returnValue) const override
Calls the function. Provide the instance on which the function is supposed to be called.
Definition FunctionProperty.h:132
virtual plFunctionType::Enum GetFunctionType() const override
Returns the type of function, see plFunctionPropertyType::Enum.
Definition FunctionProperty.h:111
virtual plFunctionType::Enum GetFunctionType() const override
Returns the type of function, see plFunctionPropertyType::Enum.
Definition FunctionProperty.h:68
virtual void Execute(void *pInstance, plArrayPtr< plVariant > arguments, plVariant &out_returnValue) const override
Calls the function. Provide the instance on which the function is supposed to be called.
Definition FunctionProperty.h:89
Definition FunctionProperty.h:53
This class holds information about reflected types. Each instance represents one type that is known t...
Definition RTTI.h:30
Definition FunctionProperty.h:11
virtual const plRTTI * GetArgumentType(plUInt32 uiParamIndex) const override
Returns the type of the given argument.
Definition FunctionProperty.h:31
virtual plBitflags< plPropertyFlags > GetReturnFlags() const override
Returns property flags of the return value.
Definition FunctionProperty.h:19
virtual plUInt32 GetArgumentCount() const override
Returns the number of arguments.
Definition FunctionProperty.h:21
virtual plBitflags< plPropertyFlags > GetArgumentFlags(plUInt32 uiParamIndex) const override
Returns the property flags of the given argument.
Definition FunctionProperty.h:45
virtual const plRTTI * GetReturnType() const override
Returns the type of the return value.
Definition FunctionProperty.h:18
plVariant is a class that can store different types of variables, which is useful in situations where...
Definition Variant.h:44
Use getArgument<N, Args...>::Type to get the type of the Nth argument in Args.
Definition AbstractProperty.h:383
The plBitflags class allows you to work with type-safe bitflags.
Definition Bitflags.h:82
Definition VariantAdapter.h:28
Enum
Definition AbstractProperty.h:525
@ StaticMember
A static member function, instance pointer will be ignored.
Definition AbstractProperty.h:527
@ Member
A normal member function, a valid instance pointer must be provided to call.
Definition AbstractProperty.h:526
@ Constructor
A constructor. Return value is a void* pointing to the new instance allocated with the default alloca...
Definition AbstractProperty.h:528
Used to determine if the given type is a build-in standard variant type.
Definition VariantAdapter.h:74
@ Const
Property value is const.
Definition AbstractProperty.h:58
Type traits.
Definition TypeTraits.h:12
Used to implicitly retrieve any value from an plVariant to be used as a function argument using the a...
Definition VariantAdapter.h:211
Used to automatically assign any value to an plVariant using the assignment rules outlined in plAbstr...
Definition VariantAdapter.h:118