BNM 2.4.0
 
Loading...
Searching...
No Matches
BNM::Property< T > Struct Template Reference

Typed class for working with il2cpp properties. More...

#include <Property.hpp>

Public Member Functions

constexpr Property ()=default
 Create empty property.
 
template<typename OtherType>
 Property (const Property< OtherType > &other)
 Copy property.
 
 Property (const IL2CPP::PropertyInfo *info)
 Create property from il2cpp property.
 
 Property (const PropertyBase &other)
 Convert base property to typed property.
 
Property< T > & operator[] (void *instance)
 Operator for setting instance.
 
Property< T > & operator[] (IL2CPP::Il2CppObject *instance)
 Operator for setting instance.
 
Property< T > & operator[] (UnityEngine::Object *instance)
 Operator for setting instance.
 
Get () const
 Call getter.
 
 operator T () const
 Operator to call getter.
 
operator() () const
 Operator to call getter.
 
void Set (T value)
 Call setter.
 
Property< T > & operator= (T value)
 Operator to call setter.
 
Property< T > & operator= (const PropertyBase &other)
 Convert base property to typed property.
 
- Public Member Functions inherited from BNM::PropertyBase
constexpr PropertyBase () noexcept=default
 Create empty property base.
 
 PropertyBase (const PropertyBase &other)=default
 Copy property.
 
 PropertyBase (const IL2CPP::PropertyInfo *info)
 Create property from il2cpp property.
 
PropertyBaseSetInstance (IL2CPP::Il2CppObject *val)
 Set property instance if it's non-static.
 
PropertyBaseoperator[] (void *instance)
 Operator for setting instance.
 
PropertyBaseoperator[] (IL2CPP::Il2CppObject *instance)
 Operator for setting instance.
 
PropertyBaseoperator[] (UnityEngine::Object *instance)
 Operator for setting instance.
 
bool IsValid () const noexcept
 Check if property is valid.
 
std::string str () const
 Get full property name.
 
template<typename NewRet>
Property< NewRet > & cast () const
 Cast event to be able to get and set it.
 

Additional Inherited Members

- Public Attributes inherited from BNM::PropertyBase
IL2CPP::PropertyInfo * _data {}
 
MethodBase _getter {}
 
MethodBase _setter {}
 
uint8_t _hasGetter: 1 = false
 
uint8_t _hasSetter: 1 = false
 

Detailed Description

template<typename T = bool>
struct BNM::Property< T >

Typed class for working with il2cpp properties.

This class provides API for getting and setting properties.

Template Parameters
TType of property

Constructor & Destructor Documentation

◆ Property() [1/3]

template<typename T = bool>
template<typename OtherType>
BNM::Property< T >::Property ( const Property< OtherType > & other)
inline

Copy property.

Parameters
otherOther property
Template Parameters
OtherTypeType of other property

◆ Property() [2/3]

template<typename T = bool>
BNM::Property< T >::Property ( const IL2CPP::PropertyInfo * info)
inline

Create property from il2cpp property.

Parameters
infoIl2cpp property

◆ Property() [3/3]

template<typename T = bool>
BNM::Property< T >::Property ( const PropertyBase & other)
inline

Convert base property to typed property.

Parameters
otherBase property

Member Function Documentation

◆ Get()

template<typename T = bool>
T BNM::Property< T >::Get ( ) const
inline

Call getter.

Returns
Property value if it's valid, otherwise default value.

◆ operator=()

template<typename T = bool>
Property< T > & BNM::Property< T >::operator= ( const PropertyBase & other)
inline

Convert base property to typed property.

Parameters
otherBase property

◆ operator[]() [1/3]

template<typename T = bool>
Property< T > & BNM::Property< T >::operator[] ( IL2CPP::Il2CppObject * instance)
inline

Operator for setting instance.

Parameters
instanceInstance
Returns
Reference to current Property

◆ operator[]() [2/3]

template<typename T = bool>
Property< T > & BNM::Property< T >::operator[] ( UnityEngine::Object * instance)
inline

Operator for setting instance.

Parameters
instanceInstance
Returns
Reference to current Property

◆ operator[]() [3/3]

template<typename T = bool>
Property< T > & BNM::Property< T >::operator[] ( void * instance)
inline

Operator for setting instance.

Parameters
instanceInstance
Returns
Reference to current Property

◆ Set()

template<typename T = bool>
void BNM::Property< T >::Set ( T value)
inline

Call setter.

Parameters
valueNew property value