Object Functions
Functions:
MTK_Object_AddMetadataField
int MTK_Object_AddMetadataField( MTK_Object* obj, const char* name, const char* value ); Version added: 9.0.0.1030
Description
Add a new metadata field with value.
Parameters
obj
pointer to an MTK_Object struct
name
the field name (const char*)
field
the field value (const char*)
Return Value
0
success
other
failure
See Also
MTK_Object_ClearMetadata
int MTK_Object_ClearMetadata(MTK_Object* obj); Version added: 9.0.0.1030
Description
Remove all metadata from the object.
Parameters
obj
pointer to an MTK_Object struct
Return Value
0
success
other
failure
See Also
MTK_Object_RemoveMetadataField_Index
MTK_Object_RemoveMetadataField_Name
MTK_Object_Close
int MTK_Object_Close(MTK_Object* object);
Description
Clean up the object.
Parameters
object
pointer to an MTK_Object struct
Return Value
0
success
other
failure
MTK_Object_GetColour
int MTK_Object_GetColour( MTK_Object* obj, int* r, int* g, int* b );
Description
Get the RGB colour (0 to 255) of an object.
Parameters
obj
pointer to an MTK_Object struct
r
red (int*)
g
green (int*)
b
blue (int*)
Return Value
0
success
other
failure
MTK_Object_GetColourIndex
int MTK_Object_GetColourIndex(MTK_Object* obj, int* index);
Description
Get the colour index of an object.
Parameters
obj
pointer to an MTK_Object struct
index
object colour index (int*)
Return Value
0
success
other
failure
MTK_Object_GetDescription
int MTK_Object_GetDescription(MTK_Object* obj, char* desc);
Description
Get the name of an object.
Parameters
obj
pointer to an MTK_Object struct
desc
buffer of length MTK_BUFFER_SIZE to receive the object description (char*)
Return Value
0
success
other
failure
MTK_Object_GetFeature
int MTK_Object_GetFeature(MTK_Object* obj, char* feature);
Description
Get the feature name of an object.
Parameters
obj
pointer to an MTK_Object struct
feature
buffer of length MTK_BUFFER_SIZE to receive the object feature (char*)
Return Value
0
success
other
failure
MTK_Object_GetGroup
int MTK_Object_GetGroup(MTK_Object* obj, char* group);
Description
Get the group of an object.
Parameters
obj
pointer to an MTK_Object struct
group
buffer of length MTK_BUFFER_SIZE to receive the object group (char*)
Return Value
0
success
other
failure
MTK_Object_GetMetadataFieldIndex
int MTK_Object_GetMetadataFieldIndex( MTK_Object* obj, const char* field, int* index ); Version added: 9.0.0.1030
Description
Get the metadata field index from a specified name.
Parameters
obj
pointer to an MTK_Object struct
index
the field name (const char*)
field
the field index (int*)
Return Value
0
success
other
failure
See Also
MTK_Object_GetMetadataFieldValue_Name
MTK_Object_SetMetadataFieldValue_Name
MTK_Object_GetMetadataFieldName
int MTK_Object_GetMetadataFieldName( MTK_Object* obj, const int& index, char* field ); Version added: 9.0.0.1030
Description
Get the metadata field name from a specified index.
Parameters
obj
pointer to an MTK_Object struct
index
the field index (int)
field
the field name (char*)
Return Value
0
success
other
failure
See Also
MTK_Object_GetMetadataFieldValue_Index
MTK_Object_SetMetadataFieldValue_Index
MTK_Object_GetMetadataFieldValue_Index
int MTK_Object_GetMetadataFieldValue_Index( MTK_Object* obj, const int& index, char* value ); Version added: 9.0.0.1030
Description
Get the metadata field value from a specified index.
Parameters
obj
pointer to an MTK_Object struct
index
the field index (int)
value
the field value (char*)
Return Value
0
success
other
failure
See Also
MTK_Object_SetMetadataFieldValue_Index
MTK_Object_GetMetadataFieldValue_Name
int MTK_Object_GetMetadataFieldValue_Name( MTK_Object* obj, const char* name, char* value ); Version added: 9.0.0.1030
Description
Get the metadata field value from a specified name.
Parameters
obj
pointer to an MTK_Object struct
name
the field name (const char*)
value
the field value (char*)
Return Value
0
success
other
failure
See Also
MTK_Object_SetMetadataFieldValue_Name
MTK_Object_GetName
int MTK_Object_GetName(MTK_Object* obj, char* name);
Description
Get the name of an object.
Parameters
obj
pointer to an MTK_Object struct
name
buffer of length MTK_BUFFER_SIZE to receive the object name (char*)
Return Value
0
success
other
failure
MTK_Object_GetPrimitive
int MTK_Object_GetPrimitive(MTK_Object* obj, char* primitive);
Description
Get the primitive name of an object.
Parameters
obj
pointer to an MTK_Object struct
primitive
buffer of length MTK_BUFFER_SIZE to receive the object primitive (char*)
Return Value
0
success
other
failure
MTK_Object_GetType
int MTK_Object_GetType(MTK_Object* obj, MTK_ObjectType* type);
Description
Get the type of an object.
Parameters
obj
pointer to an MTK_Object struct
type
object type (MTK_ObjectType*)
Return Value
0
success
other
failure
MTK_Object_GetValue
int MTK_Object_GetValue(MTK_Object* obj, double* value);
Description
Get the value of an object.
Parameters
obj
pointer to an MTK_Object struct
value
the number (double*)
Return Value
0
success
other
failure
MTK_Object_HasMetadata
int MTK_Object_HasMetadata(MTK_Object* obj); Version added: 9.0.0.1030
Description
Checks if the object has metadata.
Parameters
obj
pointer to an MTK_Object struct
Return Value
1
the object has metadata
0
the object does not have metadata
other
failure
MTK_Object_HasMetadataField
int MTK_Object_HasMetadataField(MTK_Object* obj, const char* field); Version added: 9.0.0.1030
Description
Get if an object has a specified metadata field.
Parameters
obj
pointer to an MTK_Object struct
field
the field name (const char*)
Return Value
1
the object has the field
0
the object does not have the field
other
failure
See Also
MTK_Object_RemoveMetadataField_Name
MTK_Object_New
MTK_Object* MTK_Object_New();
Description
Create a blank MTK_Object that values can be set to.
Parameters
None
Return Value
Pointer to an empty MTK_Object struct
success
Null pointer
failure
MTK_Object_NMetadataFields
int MTK_Object_NMetadataFields(MTK_Object* obj); Version added: 9.0.0.1030
Description
Get the number of metadata fields in an object.
Parameters
obj
pointer to an MTK_Object struct
Return Value
int
number of metadata fields in the object
below 0
failure
See Also
MTK_Object_RemoveMetadataField_Index
int MTK_Object_RemoveMetadataField_Index(MTK_Object* obj, const int& index); Version added: 9.0.0.1030
Description
Remove a metadata field.
Parameters
obj
pointer to an MTK_Object struct
index
the index of the field to remove (int)
Return Value
0
success
other
failure
See Also
MTK_Object_RemoveMetadataField_Name
int MTK_Object_RemoveMetadataField_Name(MTK_Object* obj, const char* field); Version added: 9.0.0.1030
Description
Remove a metadata field.
Parameters
obj
pointer to an MTK_Object struct
field
the name of the field to remove (const char*)
Return Value
0
success
other
failure
See Also
MTK_Object_SetColour
int MTK_Object_SetColour(MTK_Object* obj, const int& colour);
Description
Set the colour of an object.
Parameters
obj
pointer to an MTK_Object struct
colour
object colour (const int)
Return Value
0
success
other
failure
MTK_Object_SetDescription
int MTK_Object_SetDescription(MTK_Object* obj, const char* desc);
Description
Set the description of an object.
Parameters
obj
pointer to an MTK_Object struct
desc
object description (const char*)
Return Value
0
success
other
failure
MTK_Object_SetFeature
int MTK_Object_SetFeature(MTK_Object* obj, const char* feature);
Description
Set the feature of an object.
Parameters
obj
pointer to an MTK_Object struct
group
object feature (const char*)
Return Value
0
success
other
failure
MTK_Object_SetGroup
int MTK_Object_SetGroup(MTK_Object* obj, const char* group);
Description
Set the group of an object.
Parameters
obj
pointer to an MTK_Object struct
group
object group (const char*)
Return Value
0
success
other
failure
MTK_Object_SetMetadataFieldValue_Index
int MTK_Object_SetMetadataFieldValue_Index( MTK_Object* obj, const int& index, const char* value ); Version added: 9.0.0.1030
Description
Set the value of a metadata field.
Parameters
obj
pointer to an MTK_Object struct
index
the index of the field to set (int)
value
the desired value (const char*)
Return Value
0
success
other
failure
See Also
MTK_Object_GetMetadataFieldValue_Index
MTK_Object_SetMetadataFieldValue_Name
int MTK_Object_SetMetadataFieldValue_Name( MTK_Object* obj, const char* field, const char* value ); Version added: 9.0.0.1030
Description
Set the value of a metadata field.
Parameters
obj
pointer to an MTK_Object struct
name
the name of the field to set (const char*)
value
the desired value (const char*)
Return Value
0
success
other
failure
See Also
MTK_Object_GetMetadataFieldValue_Name
MTK_Object_SetName
int MTK_Object_SetName(MTK_Object* obj, const char* name);
Description
Set the name of an object.
Parameters
obj
pointer to an MTK_Object struct
name
object name (const char*)
Return Value
0
success
other
failure
MTK_Object_SetPrimitive
int MTK_Object_SetPrimitive(MTK_Object* obj, const char* primitive);
Description
Set the primitive of an object.
Parameters
obj
pointer to an MTK_Object struct
group
object primitive (const char*)
Return Value
0
success
other
failure
MTK_Object_SetType
int MTK_Object_SetType(MTK_Object* obj, const MTK_ObjectType& type);
Description
Set the type of an object. This will clear the object completely. This function should be called sparingly, usually immediately after MTK_Object_New .
Parameters
obj
pointer to an MTK_Object struct
type
object type (MTK_ObjectType)
Return Value
0
success
other
failure
MTK_Object_SetValue
int MTK_Object_SetValue(MTK_Object* obj, const double& value);
Description
Set the value of an object.
Parameters
obj
pointer to an MTK_Object struct
value
the value to be assigned (double)
Return Value
0
success
other
failure