TQ3ObjectReadDataMethod
You can define a method to read an object of your custom type and any attached subobjects from a file object.
typedef TQ3Status (*TQ3ObjectReadDataMethod) ( TQ3Object parentObject, TQ3FileObject file);
parentObject- An object to attach your custom data to.
file- A file object.
DESCRIPTION
YourTQ3ObjectReadDataMethodfunction should read an object and any attached subobjects from the current location in the file object specified by thefileparameter and attach that object to the object specified by theparentObjectparameter. If the object read is a custom element (or a custom attribute), you should allocate space on the stack and callQ3Set_Add(orQ3AttributeSet_Add) on the object specified by theparentObjectparameter, which is a set (or an attribute set). If the object read is not an element, you should attach your custom data to the object specified by theparentObjectparameter.On entrance to your custom read method, you should read the custom object data using the primitive data type
_Readfunctions described in "Reading and Writing File Data," beginning on page 17-27 (for example,Q3Uns64_ReadandQ3Point3D_Read). In general, you know the structure of the custom object data, so you can stop reading when you've read an entire object. Alternatively, you can read data until the functionQ3File_IsEndOfDatareturnskQ3True.Once you've read the custom object data, you should read any subobjects attached to the object. Because a metafile object has subobjects only if it is in a container, you can use the
Q3File_IsEndOfContainerfunction to determine whether there are any subobjects (ifQ3File_IsEndOfContainerreturnskQ3False, there are subobjects to read). If you have created an object, pass it toQ3File_IsEndOfContainerso that the subobjects with automatic attachment methods can be attached to your object. Otherwise, pass the valueNULLtoQ3File_IsEndOfContainerto have all subobjects returned to you. Note that when you callQ3File_IsEndOfContainer, all unread parent object data is skipped and a warning is issued.At this point, you can use the functions that retrieve subobjects (for example,
Q3File_GetNextObjectTypeand Q3File_ReadObject) to iterate through the subobjects untilQ3File_IsEndOfContainerreturnskQ3True.RESULT CODES
YourTQ3ObjectReadDataMethodfunction should returnkQ3Successif it is successful andkQ3Failureotherwise.
Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help