Important: The information in this document is obsolete and should not be used for new development.
MyFlattenProc
You provide theMyFlattenProc
function to read or write flattened collection data.
OSErr MyFlattenProc(long size, void *data, void *refCon);
size
- The size of the block of flattened data to read or write.
data
- A pointer to the block of flattened data. When flattening, this pointer points to the data your callback function should write. When unflattening, your callback function should read flattened data into the memory pointed to by this parameter.
refCon
- A value you provide to the
FlattenCollection
function orUnflattenCollection
function that the Collection Manager passes on to your callback function.DESCRIPTION
You create this function to pass to theFlattenCollection
,FlattenPartialCollection
, andUnflattenCollection
functions when flattening or unflattening a collection.As the Collection Manager is flattening a collection, it repeatedly calls this callback function to process sequential blocks of flattened data. Each time it calls this function, it provides a pointer to the current block of flattened data in the
data
parameter and the size of the current block in thesize
parameter. You can process this data in a number of ways: appending it to a handle-based block of memory, writing it to disk, and so on.When unflattening a collection, the Collection Manager repeatedly calls this function to obtain blocks of flattened data. The Collection Manager specifies the size of the requested block in the
size
parameter, and your function should read or copy the requested number of bytes of flattened data into the block of memory pointed to by thedata
parameter.In either case, the Collection Manager passes in the
refCon
parameter the same value you originally passed as therefCon
parameter to theFlattenCollection
,FlattenPartialCollection
, orUnflattenCollection
function. You can use this parameter as a pointer to a structure containing relevant state information you need when reading or writing the flattened data.If the execution of this function results in any fatal error, you should return the error code back to the Collection Manager as the function result. If the function executes successfully, you should return the
noErr
error code as the function result.SEE ALSO
For more information about the flattening and unflattening functions, see "Flattening and Unflattening a Collection" beginning on page 5-88.For examples of this function, see "Flattening and Unflattening a Collection" beginning on page 5-37.