class MonoClass

Contains information about a single Mono (managed) class.

Public

Methods

~MonoClass

~MonoClass()

GetNamespace

const String &GetNamespace() const

Returns the namespace of this class.

GetTypeName

const String &GetTypeName() const

Returns the type name of this class.

GetFullName

const String &GetFullName() const

Returns the full name (Namespace::TypeName) of this class.

GetAssembly

const MonoAssembly *GetAssembly() const

Returns the assembly this class is a part of.

GetMethod

MonoMethod *GetMethod(const String &name, u32 numParams = 0) const

Returns an object referencing a method with the specified name and number of parameters.

GetField

MonoField *GetField(const String &name) const

Returns an object referencing a field with the specified name.

GetProperty

MonoProperty *GetProperty(const String &name) const

Returns an object referencing a property with the specified name.

GetAttribute

MonoObject *GetAttribute(MonoClass *monoClass) const

Returns an instance of an attribute of the specified that is part of this class.

Returns null if this class type does not have that type of attribute.

GetBaseClass

MonoClass *GetBaseClass() const

Returns the base class of this class.

Null if this class has no base.

GetMethodExact

MonoMethod *GetMethodExact(const String &name, const String &signature) const

Returns an object referencing a method, expects exact method name with parameters.

GetAllFields

const Vector<MonoField *> &GetAllFields() const

Returns all fields belonging to this class.

GetAllProperties

const Vector<MonoProperty *> &GetAllProperties() const

Returns all properties belonging to this class.

GetAllMethods

const Vector<MonoMethod *> &GetAllMethods() const

Returns all methods belonging to this class.

GetAllAttributes

Vector<MonoClass *> GetAllAttributes() const

Gets all attributes applied to this class.

HasAttribute

bool HasAttribute(MonoClass *monoClass) const

Check if this class has an attribute of the type .

HasField

bool HasField(const String &name) const

Check if this class has a field with the specified name.

Does not check base classes.

IsSubClassOf

bool IsSubClassOf(const MonoClass *monoClass) const

Checks if this class is a sub class of the specified class.

IsInstanceOfType

bool IsInstanceOfType(MonoObject *object) const

Checks is the provided object instance of this class' type.

GetInstanceSize

u32 GetInstanceSize() const

Returns the size of an instance of this class, in bytes.

InvokeMethod

MonoObject *InvokeMethod(const String &name, MonoObject *instance = nullptr, void **params = nullptr, u32 numParams = 0)

Shortcut for invoking a method on a class.

Invokes a method with the provided name and number of parameters.

name
Name of the method to invoke (no parameter list or brackets.
instance
Object instance on invoke the method on. Null if method is static.
params
Array containing pointers to method parameters. Array length must be equal to number of parameters. Can be null if method has no parameters. For value types parameters should be pointers to the values and for reference types they should be pointers to MonoObject.
numParams
Number of parameters the method accepts.

AddInternalCall

void AddInternalCall(const String &name, const void *method)

Hooks up an internal call that will trigger the provided method callback when the managed method with the specified name is called.

If name is not valid this will silently fail.

CreateInstance

MonoObject *CreateInstance(bool construct = true) const

Creates a new instance of this class and optionally constructs it.

If you don't construct the instance then you should invoke the ".ctor" method manually afterwards.

CreateInstance

MonoObject *CreateInstance(void **params, u32 numParams)

Creates a new instance of this class and then constructs it using the constructor with the specified number of parameters.

params
Array containing pointers to constructor parameters. Array length must be equal to number of parameters.
numParams
Number of parameters the constructor accepts.

CreateInstance

MonoObject *CreateInstance(const String &ctorSignature, void **params)

Creates a new instance of this class and then constructs it using the constructor with the specified signature.

ctorSignature
Method signature. Example: "Vector2,int[]"
params
Array containing pointers to constructor parameters. Array length must be equal to number of parameters.

GetInternalClass

::MonoClass *GetInternalClass() const

Returns the internal mono representation of the class.

staticConstruct

static void Construct(MonoObject *object)

Invokes the parameterless constructor on the provided object.

Private

Constructors

MonoClass

MonoClass(const String &ns, const String &type, ::MonoClass *monoClass, const MonoAssembly *parentAssembly)

Constructs a new mono class object.

ns
Namespace the class belongs to.
type
Type name of the class.
monoClass
Internal mono class.
parentAssembly
Assembly to which this class belongs.

Fields

mParentAssembly

const MonoAssembly * mParentAssembly

mClass

::MonoClass * mClass

mNamespace

String mNamespace

mTypeName

String mTypeName

mFullName

String mFullName

mMethods

UnorderedMap<MethodId, MonoMethod *, MethodId::Hash, MethodId::Equals> mMethods

mFields

UnorderedMap<String, MonoField *> mFields

mProperties

UnorderedMap<String, MonoProperty *> mProperties

mHasCachedFields

bool mHasCachedFields

mCachedFieldList

Vector<MonoField *> mCachedFieldList

mHasCachedProperties

bool mHasCachedProperties

mCachedPropertyList

Vector<MonoProperty *> mCachedPropertyList

mHasCachedMethods

bool mHasCachedMethods

mCachedMethodList

Vector<MonoMethod *> mCachedMethodList