![]() |
OSLCompareProcPtr |
||||
Header: | AEObjects.h | Carbon status: | Supported | |
Defines a pointer to an object comparison callback function. Your object comparison function compares one Apple event object to another or to the data for a descriptor record.
typedef OSErr(* OSLCompareProcPtr) ( DescType oper, const AEDesc *obj1, const AEDesc *obj2, Boolean *result );
You would declare your function like this if you were to name it MyOSLCompareCallback:
OSErr MyOSLCompareCallback ( DescType oper, const AEDesc *obj1, const AEDesc *obj2, Boolean *result );
A comparison operator that specifies the type of comparison to perform. The available comparison operators are described in
A pointer to a token describing the first Apple event object to compare. (Token is defined in AEDisposeToken.)
A pointer to a token or some other descriptor record that specifies either an Apple event object or a value to compare to the Apple event object specified by the obj1 parameter.
A pointer to a Boolean value where your object comparison function stores a value indicating the result of the comparison operation. You store TRUE if the values of the obj1 and obj2 parameters have the relationship specified by the comparisonOperator parameter; otherwise, you store FALSE.
A result code. Your object comparison function should return noErr if it successfully compared the objects and errAEEventNotHandled if it cant compare the objects. When the Apple Event Manager gets an error result of errAEEventNotHandled, it attempts to use other methods of comparing the specified objects, such as calling an equivalent system object comparison function.
The Apple Event Manager calls your object comparison function when, in the course of resolving an object specifier record, the manager needs to compare an Apple event object with another object or with a value in a descriptor record.
If you want the Apple Event Manager to help your application resolve object specifier records of key form formTest (and if your application doesnt specify kAEIDoWhose as described in
It is up to your application to interpret the comparison operators it receives. The meaning of comparison operators differs according to the Apple event objects being compared, and not all comparison operators apply to all object classes. The available comparison operators are described in
To provide a pointer to your object comparison callback function, you create a universal procedure pointer (UPP) of type OSLCompareUPP, using the function NewOSLCompareUPP. You can do so with code like the following:
OSLCompareObjectsUPP MyCompareObjectsUPP;
MyCompareObjectsUPP = NewOSLCompareObjectsUPP(&MyCompareObjectsCallback);
You can then pass the UPP MyCompareObjectsUPP as a parameter to the AESetObjectCallbacks function or the AEInstallSpecialHandler function.
If you wish to call your object comparison callback function directly, you can use the InvokeOSLCompareUPP function.
After you are finished with your object comparison callback function, you can dispose of the UPP with the DisposeOSLCompareUPP function. However, if you will use the same object comparison function in subsequent calls to the function AESetObjectCallbacks or the function AEInstallSpecialHandler, you can reuse the same UPP, rather than dispose of it and later create a new UPP.
Use of the system object accessor dispatch table is not recommended for Carbon applicationssee Installing Object Accessors (to be supplied later) for more information.
© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)