Class for working with il2cpp classes. More...
#include <Class.hpp>
Public Member Functions | |
constexpr | Class ()=default |
Create empty class. | |
Class (const BNM::IL2CPP::Il2CppClass *_class) | |
Create class from il2cpp class. | |
Class (const BNM::IL2CPP::Il2CppObject *object) | |
Create class from il2cpp object. | |
Class (const BNM::IL2CPP::Il2CppType *type) | |
Create class from il2cpp type. | |
Class (const BNM::MonoType *type) | |
Create class from mono type. | |
Class (const BNM::CompileTimeClass &compileTimeClass) | |
Create class from compile time class. | |
Class (const std::string_view &_namespace, const std::string_view &name) | |
Create class from name and namespace. | |
Class (const std::string_view &_namespace, const std::string_view &name, const BNM::Image &image) | |
Create class from name, namespace and image. | |
std::vector< BNM::Class > | GetInnerClasses (bool includeParent=true) const |
Get all inner classes of target class. | |
std::vector< BNM::FieldBase > | GetFields (bool includeParent=true) const |
Get all fields of target class. | |
std::vector< BNM::MethodBase > | GetMethods (bool includeParent=true) const |
Get all methods of target class. | |
std::vector< BNM::PropertyBase > | GetProperties (bool includeParent=true) const |
Get all properties of target class. | |
std::vector< BNM::EventBase > | GetEvents (bool includeParent=true) const |
Get all events of target class. | |
BNM::MethodBase | GetMethod (const std::string_view &name, int parameters=-1) const |
Get method by name and parameters count. | |
BNM::MethodBase | GetMethod (const std::string_view &name, const std::initializer_list< std::string_view > ¶meterNames) const |
Get method by name and parameters name. | |
BNM::MethodBase | GetMethod (const std::string_view &name, const std::initializer_list< BNM::CompileTimeClass > ¶meterTypes) const |
Get method by name and parameters types. | |
BNM::PropertyBase | GetProperty (const std::string_view &name) const |
Get property by name. | |
BNM::Class | GetInnerClass (const std::string_view &name) const |
Get inner class by name. | |
BNM::FieldBase | GetField (const std::string_view &name) const |
Get field by name. | |
BNM::EventBase | GetEvent (const std::string_view &name) const |
Get event by name. | |
BNM::Class | GetParent () const |
Get parent. | |
BNM::Class | GetArray () const |
Get array class. | |
BNM::Class | GetPointer () const |
Get pointer to class. | |
BNM::Class | GetReference () const |
Get reference class. | |
BNM::Class | GetGeneric (const std::initializer_list< BNM::CompileTimeClass > &templateTypes) const |
Get typed generic class. | |
BNM::IL2CPP::Il2CppType * | GetIl2CppType () const |
Get Il2CppType. | |
BNM::MonoType * | GetMonoType () const |
Get MonoType. | |
BNM::IL2CPP::Il2CppClass * | GetClass () const |
Get Il2CppClass. | |
BNM::CompileTimeClass | GetCompileTimeClass () const |
Get CompileTimeClass. | |
BNM::Image | GetImage () const |
Get Image of class. | |
operator BNM::IL2CPP::Il2CppType * () const | |
Get Il2CppType. | |
operator BNM::MonoType * () const | |
Get MonoType. | |
operator BNM::IL2CPP::Il2CppClass * () const | |
Get Il2CppClass. | |
operator BNM::CompileTimeClass () const | |
Get CompileTimeClass. | |
BNM::IL2CPP::Il2CppObject * | CreateNewInstance () const |
Create class instance. | |
template<typename T> | |
BNM::Structures::Mono::Array< T > * | NewArray (IL2CPP::il2cpp_array_size_t size=0) const |
Create array of this type. | |
template<typename T> | |
Structures::Mono::List< T > * | NewList () const |
Create list of this type. | |
template<typename T> | |
Structures::Mono::List< T > * | NewListBNM () const |
Create list of this type. | |
template<typename T, typename = std::enable_if<!std::is_pointer<T>::value>> | |
IL2CPP::Il2CppObject * | BoxObject (T obj) const |
Box object of this type. | |
template<typename ... Parameters> | |
BNM::IL2CPP::Il2CppObject * | CreateNewObjectParameters (Parameters ...parameters) const |
Create class instance. | |
template<typename ... Parameters> | |
BNM::IL2CPP::Il2CppObject * | CreateNewObjectTypes (const std::initializer_list< std::string_view > ¶meterNames, Parameters ...parameters) const |
Create class instance. | |
bool | IsValid () const |
Check if class is valid. | |
bool | Alive () const |
Check if class is valid. | |
operator bool () const | |
Check if class is valid. | |
std::string | str () const |
Get full class name. | |
Public Attributes | |
BNM::IL2CPP::Il2CppClass * | _data {} |
Class for working with il2cpp classes.
This class allows to find classes or get class from types, objects and work with it.
|
inline |
Create class from il2cpp class.
_class | Il2cpp class |
BNM::Class::Class | ( | const BNM::IL2CPP::Il2CppObject * | object | ) |
Create class from il2cpp object.
Creates class using type of object, that passed as parameter.
object | Il2cpp object |
BNM::Class::Class | ( | const BNM::IL2CPP::Il2CppType * | type | ) |
Create class from il2cpp type.
Creates class using type, that passed as parameter.
type | Il2cpp type |
BNM::Class::Class | ( | const BNM::MonoType * | type | ) |
Create class from mono type.
Creates class using mono type (il2cpp vm's type), that passed as parameter.
type | Mono type |
BNM::Class::Class | ( | const BNM::CompileTimeClass & | compileTimeClass | ) |
Create class from compile time class.
Creates class using compile time class, that passed as parameter.
compileTimeClass | CompileTimeClass type |
BNM::Class::Class | ( | const std::string_view & | _namespace, |
const std::string_view & | name ) |
BNM::Class::Class | ( | const std::string_view & | _namespace, |
const std::string_view & | name, | ||
const BNM::Image & | image ) |
|
inlinenodiscard |
|
inline |
Box object of this type.
Box object that you pass into it, used to pass int
and other system types as Il2CppObject. If you unsure, read C# documentation about object boxing.
T | Non pointer object type |
|
nodiscard |
Create class instance.
Creates instance of current class. The same as new Object()
in C#, but without calling the constructor (.ctor).
BNM::IL2CPP::Il2CppObject * BNM::Class::CreateNewObjectParameters | ( | Parameters ... | parameters | ) | const |
Create class instance.
Creates instance of current class and calls constructor. The same as new Object()
in C# with calling the constructor by number of parameters.
Parameters | Constructor parameter types |
parameters | Constructor parameters |
BNM::IL2CPP::Il2CppObject * BNM::Class::CreateNewObjectTypes | ( | const std::initializer_list< std::string_view > & | parameterNames, |
Parameters ... | parameters ) const |
Create class instance.
Creates instance of current class and calls constructor. The same as new Object()
in C# with calling the constructor by parameter names.
Parameters | Constructor parameters |
parameters | Constructor parameters |
|
nodiscard |
Get array class.
Gets array class of current class (class[]).
|
inlinenodiscard |
Get Il2CppClass.
Gets Il2CppClass object of current class.
|
nodiscard |
|
nodiscard |
Get event by name.
Tries to get event using its name. If event isn't found in target class, the code will search event in parents.
name | Target event name |
|
nodiscard |
Get all events of target class.
Gets all events of target class and of its parent.
includeParent | Should include events from parents |
|
nodiscard |
Get field by name.
Tries to get field using its name. If field isn't found in target class, the code will search field in parents.
name | Target field name |
|
nodiscard |
Get all fields of target class.
Gets all fields of target class and of its parents.
includeParent | Should include fields from parents |
|
nodiscard |
Get typed generic class.
Gets typed generic class of current class (class <types from the list>).
templateTypes | List of template types |
|
nodiscard |
Get Il2CppType.
Gets Il2CppType object of current class.
|
nodiscard |
|
nodiscard |
Get inner class by name.
Tries to get inner class using its name. If inner class isn't found in target class, the code will search inner class in parents.
name | Target property name |
|
nodiscard |
Get all inner classes of target class.
Gets all inner classes of target class and of its parents.
includeParent | Should include inner classes from parents |
|
nodiscard |
Get method by name and parameters types.
Tries to get method using its name and parameter types. If method isn't found in target class, the code will search method in parents.
name | Target method name |
parameterTypes | Target method parameter types |
|
nodiscard |
Get method by name and parameters name.
Tries to get method using its name and parameter names. If method isn't found in target class, the code will search method in parents.
name | Target method name |
parameterNames | Target method parameter names |
|
nodiscard |
Get method by name and parameters count.
Tries to get method using its name and parameters count. If method isn't found in target class, the code will search method in parents.
name | Target method name |
parameters | Target method parameters count |
|
nodiscard |
Get all methods of target class.
Gets all methods of target class and of its parents.
includeParent | Should include methods from parents |
|
nodiscard |
|
nodiscard |
Get parent.
Gets parent of current class.
|
nodiscard |
Get pointer to class.
Gets pointer class of current class (class *).
|
nodiscard |
Get all properties of target class.
Gets all properties of target class and of its parents.
includeParent | Should include properties from parents |
|
nodiscard |
Get property by name.
Tries to get property using its name. If property isn't found in target class, the code will search property in parents.
name | Target property name |
|
nodiscard |
Get reference class.
Gets reference class of current class (class &).
|
inlinenodiscard |
Check if class is valid.
|
inline |
Create array of this type.
Creates new array with set size (capacity). The same as new Object[]
in C#.
size | New array size |
T | Array element type |
Structures::Mono::List< T > * BNM::Class::NewList | ( | ) | const |
Create list of this type.
Creates new list of this types. The same as new List<Object>()
in C#.
T | List element type |
|
inline |
Create list of this type.
Creates new list of this types, but new list will use BNM code instead of il2cpp. This can be useful if you want to create list of struct that doesn't exist in target Unity app.
T | List element type |
BNM::Class::operator BNM::CompileTimeClass | ( | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |