CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::MetaAccessorProperty< GetterType, SetterType > Class Template Reference

An implementation of MetaProperty that uses a getter and setter method pairs to access the property. More...

#include <CeresEngine/Reflection/Class.define.hpp>

Inheritance diagram for CeresEngine::MetaAccessorProperty< GetterType, SetterType >:
CeresEngine::ClassProperty CeresEngine::ClassMember CeresEngine::MetaItem

Public Member Functions

 MetaAccessorProperty (Class &owner, const StringView name, GetterType getter, SetterType setter) noexcept
 Creates a new property by using accessors.
 
bool isStatic () const noexcept override
 
bool isReadOnly () const noexcept override
 
TypeID getGetterReturnTypeID () const noexcept override
 
TypeID getSetterParameterTypeID () const noexcept override
 
Box get (const Box &target) const override
 
void set (const Box &target, const Box &value) const override
 
void set (const Box &target, Box &&value) const override
 
- Public Member Functions inherited from CeresEngine::ClassProperty
 ClassProperty (Class &owner, StringView name)
 
 ~ClassProperty () noexcept override
 
MetaCategory getCategory () const final
 Gets the category of the item.
 
TypeID getTypeID () const noexcept
 
Type getType () const
 
Type getGetterReturnType () const
 
template<typename T >
requires (!std::is_same_v<std::decay_t<T>, Box> && !std::is_same_v<std::decay_t<T>, Box>)
auto get (T &target) const
 
Box get () const
 Gets the value of a static property.
 
Type getSetterParameterType () const
 
template<typename T , typename V >
requires (!std::is_same_v<std::decay_t<T>, Box> && !std::is_same_v<std::decay_t<V>, Box>)
void set (T &target, const V &value) const
 
template<typename T , typename V >
requires (!std::is_same_v<std::decay_t<T>, Box> && !std::is_same_v<std::decay_t<V>, Box>)
void set (T &target, V &value) const
 
template<typename T , typename V >
requires (!std::is_same_v<std::decay_t<T>, Box> && !std::is_same_v<std::decay_t<V>, Box>)
void set (T &target, V &&value) const
 
void set (const Box &value) const
 Sets the property value.
 
void set (Box &&value) const
 
template<typename V >
requires (!std::is_same_v<std::decay_t<V>, Box>)
void set (const V &value) const
 
template<typename V >
requires (!std::is_same_v<std::decay_t<V>, Box>)
void set (V &value) const
 
template<typename V >
requires (!std::is_same_v<std::decay_t<V>, Box>)
void set (V &&value) const
 
- Public Member Functions inherited from CeresEngine::MetaItem
virtual ~MetaItem () noexcept=default
 

Private Types

using GetterTraits = function_traits< GetterType >
 A type trait for the getter function or method.
 
using SetterTraits = function_traits< SetterType >
 A type trait for the setter function or method.
 
using T = typename GetterTraits::result_type
 The type returned by the getter function.
 
using SetterArgument = typename SetterTraits::template arg< 0 >
 The type taken by the setter function.
 

Private Attributes

const GetterType mGetter
 The getter function.
 
const SetterType mSetter
 The setter function.
 

Static Private Attributes

static constexpr auto valid
 

Additional Inherited Members

- Public Attributes inherited from CeresEngine::ClassProperty
StringView name
 
ReflectionAttributeContainer attributes
 
- Static Public Attributes inherited from CeresEngine::ClassProperty
static constexpr MetaCategory kCategory = MetaCategory::Property
 Gets the category of the item.
 

Detailed Description

template<typename GetterType, typename SetterType>
class CeresEngine::MetaAccessorProperty< GetterType, SetterType >

An implementation of MetaProperty that uses a getter and setter method pairs to access the property.

Template Parameters
GetterTypeThe type of the property getter.
SetterTypeThe type of the property setter.

Member Typedef Documentation

◆ GetterTraits

A type trait for the getter function or method.

◆ SetterArgument

using CeresEngine::MetaAccessorProperty< GetterType, SetterType >::SetterArgument = typename SetterTraits::template arg<0>
private

The type taken by the setter function.

◆ SetterTraits

A type trait for the setter function or method.

◆ T

The type returned by the getter function.

Constructor & Destructor Documentation

◆ MetaAccessorProperty()

CeresEngine::MetaAccessorProperty< GetterType, SetterType >::MetaAccessorProperty ( Class owner,
const StringView  name,
GetterType  getter,
SetterType  setter 
)
inlineexplicitnoexcept

Creates a new property by using accessors.

Parameters
ownerThe class that owns the property.
nameThe name of the property.
getterThe getter to be called to get the property value.
setterThe setter to be called to set the property value.

Member Function Documentation

◆ get()

Box CeresEngine::MetaAccessorProperty< GetterType, SetterType >::get ( const Box target) const
inlineoverridevirtual

◆ getGetterReturnTypeID()

TypeID CeresEngine::MetaAccessorProperty< GetterType, SetterType >::getGetterReturnTypeID ( ) const
inlineoverridevirtualnoexcept

◆ getSetterParameterTypeID()

TypeID CeresEngine::MetaAccessorProperty< GetterType, SetterType >::getSetterParameterTypeID ( ) const
inlineoverridevirtualnoexcept

◆ isReadOnly()

bool CeresEngine::MetaAccessorProperty< GetterType, SetterType >::isReadOnly ( ) const
inlineoverridevirtualnoexcept

◆ isStatic()

bool CeresEngine::MetaAccessorProperty< GetterType, SetterType >::isStatic ( ) const
inlineoverridevirtualnoexcept

◆ set() [1/2]

void CeresEngine::MetaAccessorProperty< GetterType, SetterType >::set ( const Box target,
Box &&  value 
) const
inlineoverridevirtual

◆ set() [2/2]

void CeresEngine::MetaAccessorProperty< GetterType, SetterType >::set ( const Box target,
const Box value 
) const
inlineoverridevirtual

Member Data Documentation

◆ mGetter

◆ mSetter

◆ valid

Initial value:
= (std::is_function_v<GetterType> && (std::is_void_v<SetterType> || std::is_function_v<SetterType>)) ||
(std::is_member_function_pointer_v<GetterType> && (std::is_void_v<SetterType> || std::is_member_function_pointer_v<SetterType>))

The documentation for this class was generated from the following file: