Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Environment and Utilities /
Chapter 5 - Collection Manager / Collection Manager Reference
Application-Defined Functions /


MyFlattenProc

You provide the MyFlattenProc 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 or UnflattenCollection function that the Collection Manager passes on to your callback function.
DESCRIPTION
You create this function to pass to the FlattenCollection, FlattenPartialCollection, and UnflattenCollection 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 the size 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 the data parameter.

In either case, the Collection Manager passes in the refCon parameter the same value you originally passed as the refCon parameter to the FlattenCollection, FlattenPartialCollection, or UnflattenCollection 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.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996