Class MField
Encapsulates information about a single Mono (managed) fields belonging to some managed class. This object also allows you to access the field data of an object instance.
Inheritance
Assembly: FlaxEngine.dll
File: Engine/Scripting/ManagedCLR/MField.h
Syntax
public class MField
Constructors
MField(MClass* parentClass, void* handle, const char* name, void* type, int fieldOffset, MFieldAttributes attributes)
Declaration
public MField(MClass* parentClass, void* handle, const char* name, void* type, int fieldOffset, MFieldAttributes attributes)
Parameters
MClass
parentClass
|
void
handle
|
char
name
|
void
type
|
int
fieldOffset
|
MFieldAttributes
attributes
|
Fields
_attributes
Declaration
protected Array<MObject* > _attributes
Field Value
Array<MObject >
|
_fieldOffset
Declaration
protected int32 _fieldOffset
Field Value
int32
|
_handle
Declaration
protected void* _handle
Field Value
void
|
_hasCachedAttributes
Declaration
protected int32 _hasCachedAttributes
Field Value
int32
|
_isStatic
Declaration
protected int32 _isStatic
Field Value
int32
|
_name
_parentClass
_type
Declaration
protected void* _type
Field Value
void
|
_visibility
Methods
GetAttribute(const MClass* klass)
Returns an instance of an attribute of the specified type. Returns null if the field 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 field. Returns null if the field doesn't have any attributes.
Declaration
public Array<MObject* > GetAttributes() const
Returns
Array<MObject >
The array of attribute objects. |
GetName()
GetOffset()
Gets the field offset (in bytes) from the start of the parent object.
Declaration
public int32 GetOffset() const
Returns
int32
|
GetParentClass()
Returns the parent class that this method is contained with.
Declaration
public MClass* GetParentClass() const
Returns
MClass
|
GetType()
Gets field type class.
Declaration
public MType* GetType() const
Returns
MType
|
GetValue(MObject* instance, void* result)
Retrieves value currently set in the field on the specified object instance. If field is static object instance can be null.
Value will be a pointer to raw data type for value types (for example int, float), and a MObject* for reference types.
Declaration
public void GetValue(MObject* instance, void* result) const
Parameters
MObject
instance
The object of given type to get value from. |
void
result
The return value of undefined type. |
GetValueBoxed(MObject* instance)
Retrieves value currently set in the field on the specified object instance. If field is static object instance can be null. If returned value is a value type it will be boxed.
Declaration
public MObject* GetValueBoxed(MObject* instance) const
Parameters
MObject
instance
The object of given type to get value from. |
Returns
MObject
The boxed value object. |
GetValueReference(MObject* instance, void* result)
Retrieves value currently set in the field on the specified object instance. If field is static object instance can be null.
Value will be a pointer.
Declaration
public void GetValueReference(MObject* instance, void* result) const
Parameters
MObject
instance
The object of given type to get value from. |
void
result
The return value of undefined type. |
GetVisibility()
Gets field visibility in the class.
Declaration
public MVisibility GetVisibility() const
Returns
MVisibility
|
HasAttribute()
Checks if field 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 field 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. |
IsStatic()
Returns true if field is static.
Declaration
public bool IsStatic() const
Returns
bool
|
SetValue(MObject* instance, void* value)
Sets a value for the field on the specified object instance. If field is static object instance can be null.
Value should be a pointer to raw data type for value types (for example int, float), and a MObject* for reference types.
Declaration
public void SetValue(MObject* instance, void* value) const
Parameters
MObject
instance
The object of given type to set value to. |
void
value
Th value of undefined type. |