BNM 2.4.0
 
Loading...
Searching...
No Matches
BNM::MethodBase Struct Reference

Class base for working with il2cpp methods. More...

#include <MethodBase.hpp>

Public Member Functions

constexpr MethodBase ()=default
 Create empty method base.
 
 MethodBase (const MethodBase &other)=default
 Copy method.
 
 MethodBase (const IL2CPP::MethodInfo *info)
 Create method from il2cpp method.
 
 MethodBase (const IL2CPP::Il2CppReflectionMethod *reflectionMethod)
 Create method from il2cpp reflection method.
 
MethodBaseSetInstance (IL2CPP::Il2CppObject *val)
 Set method instance if it's non-static.
 
IL2CPP::MethodInfo * GetInfo () const
 Get MethodInfo.
 
BNM_PTR GetOffset () const
 Get method offset.
 
MethodBase GetGeneric (const std::initializer_list< CompileTimeClass > &templateTypes) const
 Get typed version of current generic method.
 
MethodBase GetOverride () const
 Get overridden method of current virtual method.
 
MethodBaseoperator[] (void *instance)
 Operator for setting instance.
 
MethodBaseoperator[] (IL2CPP::Il2CppObject *instance)
 Operator for setting instance.
 
MethodBaseoperator[] (UnityEngine::Object *instance)
 Operator for setting instance.
 
bool IsValid () const noexcept
 Check if method is valid.
 
std::string str () const
 Get full method name.
 
template<typename NewType>
Method< NewType > & cast () const
 Cast method to be able to call it.
 

Public Attributes

IL2CPP::MethodInfo * _data {}
 
IL2CPP::Il2CppObject * _instance {}
 
uint8_t _isStatic: 1 = false
 
uint8_t _isVirtual: 1 = false
 

Detailed Description

Class base for working with il2cpp methods.

This class provides fields and some basic functions to allow to call methods.

Constructor & Destructor Documentation

◆ MethodBase() [1/3]

BNM::MethodBase::MethodBase ( const MethodBase & other)
inlinedefault

Copy method.

Parameters
otherOther method

◆ MethodBase() [2/3]

BNM::MethodBase::MethodBase ( const IL2CPP::MethodInfo * info)

Create method from il2cpp method.

Parameters
infoIl2cpp method

◆ MethodBase() [3/3]

BNM::MethodBase::MethodBase ( const IL2CPP::Il2CppReflectionMethod * reflectionMethod)

Create method from il2cpp reflection method.

Parameters
reflectionMethodIl2cpp reflection method

Member Function Documentation

◆ GetGeneric()

MethodBase BNM::MethodBase::GetGeneric ( const std::initializer_list< CompileTimeClass > & templateTypes) const

Get typed version of current generic method.

Returns
Typed method if method is valid and generic, otherwise empty method.

◆ GetInfo()

IL2CPP::MethodInfo * BNM::MethodBase::GetInfo ( ) const
inline

Get MethodInfo.

Returns
MethodInfo

◆ GetOffset()

BNM_PTR BNM::MethodBase::GetOffset ( ) const
inline

Get method offset.

Returns
Method offset if method is valid, otherwise zero.

◆ GetOverride()

MethodBase BNM::MethodBase::GetOverride ( ) const

Get overridden method of current virtual method.

Returns
Overridden method if method is valid and virtual, otherwise empty method.

◆ IsValid()

bool BNM::MethodBase::IsValid ( ) const
inlinenodiscardnoexcept

Check if method is valid.

Returns
State of method

◆ operator[]() [1/3]

MethodBase & BNM::MethodBase::operator[] ( IL2CPP::Il2CppObject * instance)
inline

Operator for setting instance.

Parameters
instanceInstance
Returns
Reference to current MethodBase

◆ operator[]() [2/3]

MethodBase & BNM::MethodBase::operator[] ( UnityEngine::Object * instance)
inline

Operator for setting instance.

Parameters
instanceInstance
Returns
Reference to current MethodBase

◆ operator[]() [3/3]

MethodBase & BNM::MethodBase::operator[] ( void * instance)
inline

Operator for setting instance.

Parameters
instanceInstance
Returns
Reference to current MethodBase

◆ SetInstance()

MethodBase & BNM::MethodBase::SetInstance ( IL2CPP::Il2CppObject * val)

Set method instance if it's non-static.

Parameters
instanceInstance
Returns
Reference to current MethodBase

◆ str()

std::string BNM::MethodBase::str ( ) const
inline

Get full method name.

Returns string with full method name: ClassFullName.(method name){arguments count: ...} (static)/nothing

Returns
Method's full name or "Dead method".