MetaClass: 2.6 Utility Messages: Variable Data Messages

Up: GEOS SDK TechDocs | Up | Prev: 2.5 Event Messages | Next: 2.7 Notification Messages

Variable data is instance data that can appear or not appear within the object's instance chunk. For information on variable data and how these three messages are used, see the GEOS Programming chapter.

MSG_META_ADD_VAR_DATA

void	MSG_META_ADD_VAR_DATA(@stack
        word	dataType,
        word	dataSize,
        word	*data)

This message adds a variable data type to the recipient object's instance data. If the variable data field was already present, this will change its value. This is useful for adding hints to generic objects at run-time.

If it is possible that you are adding the object's first/only field of variable data, set the object's OCF_VARDATA_RELOC flag by means of the ObjSetFlags() routine or MSG_META_SET_FLAGS.

Note that the object will be marked dirty even if nothing was changed.

NOTE: The dataType should have VDF_SAVE_TO_STATE set as desired. VDF_EXTRA_DATA is ignored; it will be set correctly by this routine.

Source: Unrestricted.

Destination: Any object.

Interception: Generally not intercepted; default MetaClass handling performs the desired function.

Parameters: dataType Data type (e.g. ATTR_PRINT_CONTROL_APP_UI).

dataSize
Size of data, if any.
data
If no extra data, NULL. If dataSize is non-zero, then this may be a pointer to data to initialize data with.

Return: Nothing. Object marked dirty even if data type already exists.

MSG_META_DELETE_VAR_DATA

Boolean	MSG_META_DELETE_VAR_DATA(
        word	dataType);

This message removes a particular variable data entry from the recipient object's instance data. This is useful for removing hints from generic objects at run-time.

Source: Unrestricted.

Destination: Any object.

Interception: Generally not intercepted; default MetaClass handling performs the desired function.

Parameters: dataType Data type to delete. VarDataFlags ignored.

Return: Returns false if data deleted, true if data was not found. Object marked dirty if data type found and deleted.

MSG_META_INITIALIZE_VAR_DATA

word	MSG_META_INITIALIZE_VAR_DATA(
        word	dataType);

This message is sent to an object any time the ObjVarDerefData() routine is called and the data type is not found. It should be subclassed by any object that defines a variable type that will be used with ObjVarDerefData() . The object must create and initialize the data and return its offset.

Sent to an object having a variable data entry which code somewhere is attempting to access via ObjVarDerefData() . It is the object that defines the variable data entry type's responsibility to create the data entry and initialize it at this time, and to return a pointer to the extra data (if any), as returned by ObjVarAddData() .

Source: ObjVarDerefData() routine. Should not be used as a replacement for ObjVarAddData() , or MSG_ADD_VAR_DATA_ENTRY , but may be used any time code is ready to access a particular piece of variable data instance data, knows that the variable data has not yet been created, and wishes to ensure that it does exist.

Destination: Any object stored in an LMem Object block.

Interception: Required by any class which defines a variable data entry type that needs to be initialized before usage. Objects handling this message should first compare the passed data type against variable data types it understands, and pass any unknown types onto the superclass for handling.

Parameters: Variable data type.

Return: Offset to extra data created (or, if no extra data, the start of data entry plus the size of VarDataEntry ). Normally, this would just be the offset returned by the call to ObjVarAddData() .

MSG_META_GET_VAR_DATA

word MSG_META_GET_VAR_DATA( /* returns size of data returned in buf;
              * -1 if not found */
        word 	dataType,
        word 	bufSize,
        void 	*buf);

This message fetches variable data of a given type from an object.

Source: Unrestricted.

Destination: Any object.

Interception: Generally not intercepted; default MetaClass handling performs the desired function.

Parameters: dataType The variable data category to return.

bufSize
Size available to return data.
buf
Pointer to buffer to hold returned data.

Return: The size of the data returned. If the vardata entry was not found, then message will return -1.

buf
Filled with vardata's data, if any.

Up: GEOS SDK TechDocs | Up | Prev: 2.5 Event Messages | Next: 2.7 Notification Messages