Class MClass
Contains information about a single managed class.
Inheritance
Assembly: FlaxEngine.dll
File: Engine/Scripting/ManagedCLR/MClass.h
Syntax
public class MClass
Constructors
~MClass()
MClass(const MAssembly* parentAssembly, void* handle, const char* name, const char* fullname, const char* namespace_, MTypeAttributes typeAttributes)
Declaration
public MClass(const MAssembly* parentAssembly, void* handle, const char* name, const char* fullname, const char* namespace_, MTypeAttributes typeAttributes)
Parameters
MAssembly
parentAssembly
|
void
handle
|
char
name
|
char
fullname
|
char
namespace_
|
MTypeAttributes
typeAttributes
|
Methods
CreateInstance()
Creates a new instance of this class and constructs it.
Declaration
public MObject* CreateInstance() const
Returns
MObject
The created managed object. |
FindMethod(const char* name, int32 numParams, bool checkBaseClasses=true)
Returns an object referencing a method with the specified name and number of parameters. Optionally checks the base classes.
Declaration
public MMethod* FindMethod(const char* name, int32 numParams, bool checkBaseClasses=true) const
Parameters
char
name
The method name. |
int32
numParams
The method parameters count. |
bool
checkBaseClasses
True if check base classes when searching for the given method. |
Returns
MMethod
The method or null if failed to find it. |
GetAssembly()
GetAttribute(const MClass* klass)
Returns an instance of an attribute of the specified type. Returns null if the class doesn't have such an attribute.
Declaration
public MObject* GetAttribute(const MClass* klass) const
Parameters
MClass
klass
The attribute class to take. |
Returns
MObject
The attribute object. |
GetAttributes()
Returns an instance of all attributes connected with given class. Returns null if the class doesn't have any attributes.
Declaration
public Array<MObject* > GetAttributes() const
Returns
Array<MObject >
The array of attribute objects. |
GetBaseClass()
Returns the base class of this class. Null if this class has no base.
Declaration
public MClass* GetBaseClass() const
Returns
MClass
|
GetElementClass()
Returns the class of the array type elements.
Declaration
public MClass* GetElementClass() const
Returns
MClass
|
GetEvent(const char* name)
Returns an object referencing a event with the specified name.
Declaration
public MEvent* GetEvent(const char* name) const
Parameters
char
name
The event name. |
Returns
MEvent
The event object. |
GetEvents()
Returns all events belonging to this class.
Declaration
public Array<MEvent* > GetEvents() const
Returns
Array<MEvent >
The list of events. |
GetField(const char* name)
Returns an object referencing a field with the specified name.
Does not query base class fields. Returns null if field cannot be found.
Declaration
public MField* GetField(const char* name) const
Parameters
char
name
The field name. |
Returns
MField
The field or null if failed. |
GetFields()
Returns all fields belonging to this class.
Be aware this will not include the fields of any base classes.
Declaration
public Array<MField* > GetFields() const
Returns
Array<MField >
The list of fields. |
GetFullName()
Gets the full name of the class (namespace and typename).
Declaration
public StringAnsi GetFullName() const
Returns
StringAnsi
|
GetInstanceSize()
Returns the size of an instance of this class, in bytes.
Declaration
public uint32 GetInstanceSize() const
Returns
uint32
|
GetInterfaces()
Returns all interfaces implemented by this class (excluding interfaces from base classes).
Be aware this will not include the interfaces of any base classes.
Declaration
public Array<MClass* > GetInterfaces() const
Returns
Array<MClass >
The list of interfaces. |
GetMethod(const char* name, int32 numParams = 0)
Returns an object referencing a method with the specified name and number of parameters.
If the type contains more than one method of the given name and parameters count the returned value can be non-deterministic (one of the matching methods).
Declaration
public MMethod* GetMethod(const char* name, int32 numParams = 0) const
Parameters
char
name
The method name. |
int32
numParams
The method parameters count. |
Returns
MMethod
The method or null if failed to get it. |
GetMethods()
Returns all methods belonging to this class.
Be aware this will not include the methods of any base classes.
Declaration
public Array<MMethod* > GetMethods() const
Returns
Array<MMethod >
The list of methods. |
GetName()
Gets the name of the class.
Declaration
public StringAnsiView GetName() const
Returns
StringAnsiView
|
GetNamespace()
Gets the namespace of the class.
Declaration
public StringAnsiView GetNamespace() const
Returns
StringAnsiView
|
GetNative()
Declaration
public void* GetNative() const
Returns
void
|
GetProperties()
Returns all properties belonging to this class.
Be aware this will not include the properties of any base classes.
Declaration
public Array<MProperty* > GetProperties() const
Returns
Array<MProperty >
The list of properties. |
GetProperty(const char* name)
Returns an object referencing a property with the specified name.
Does not query base class properties. Returns null if property cannot be found.
Declaration
public MProperty* GetProperty(const char* name) const
Parameters
char
name
The property name. |
Returns
MProperty
The property. |
GetType()
Gets the class type.
Declaration
public MType* GetType() const
Returns
MType
|
GetVisibility()
HasAttribute()
Checks if class has an attribute of any type.
Declaration
public bool HasAttribute() const
Returns
bool
True if has any custom attribute, otherwise false. |
HasAttribute(const MClass* klass)
Checks if class has an attribute of the specified type.
Declaration
public bool HasAttribute(const MClass* klass) const
Parameters
MClass
klass
The attribute class to check. |
Returns
bool
True if has attribute of that class type, otherwise false. |
HasInterface(const MClass* klass)
Checks if this class implements the specified interface (including any base types).
Declaration
public bool HasInterface(const MClass* klass) const
Parameters
MClass
klass
The interface class. |
Returns
bool
True if this class implements the specified interface. |
IsAbstract()
Gets if class is abstract
Declaration
public bool IsAbstract() const
Returns
bool
|
IsEnum()
Gets if class is enumeration
Declaration
public bool IsEnum() const
Returns
bool
|
IsGeneric()
Gets if class is generic
Declaration
public bool IsGeneric() const
Returns
bool
|
IsInstanceOfType(MObject* object)
Checks is the provided object instance of this class' type.
Declaration
public bool IsInstanceOfType(MObject* object) const
Parameters
MObject
object
The object to check. |
Returns
bool
True if object is an instance the this class. |
IsInterface()
Gets if class is interface
Declaration
public bool IsInterface() const
Returns
bool
|
IsSealed()
Gets if class is sealed
Declaration
public bool IsSealed() const
Returns
bool
|
IsStatic()
Gets if class is static
Declaration
public bool IsStatic() const
Returns
bool
|
IsSubClassOf(const MClass* klass, bool checkInterfaces=false)
Checks if this class is a sub class of the specified class (including any derived types).
Declaration
public bool IsSubClassOf(const MClass* klass, bool checkInterfaces=false) const
Parameters
MClass
klass
The class. |
bool
checkInterfaces
True if check interfaces, otherwise just base class. |
Returns
bool
True if this class is a sub class of the specified class. |
IsValueType()
Gets if class is value type (eg. enum or structure) but not reference type (eg. class, string, array, interface)
Declaration
public bool IsValueType() const
Returns
bool
|