home *** CD-ROM | disk | FTP | other *** search
- /*==================================================================
- File: MacOS_AppleEventUtils.h
-
- Contains: AppleEvent utility routines.
-
- Written by: Ed Reed
-
- Copyright: © 1999 Connectix Corporation
- ==================================================================*/
-
- #pragma once
-
- #include "MacOS_Namespaces.h"
-
- #ifndef __AEOBJECTS__
- #include <AEObjects.h>
- #endif
-
- #ifndef __ALIASES__
- #include <Aliases.h>
- #endif
-
- #ifndef __APPLEEVENTS__
- #include <AppleEvents.h>
- #endif
-
- #ifndef __FILES__
- #include <Files.h>
- #endif
-
-
- CTX_Begin_Namespace_MacOS
-
-
- /*#########################################################################################
- EXPORTED FUNCTION PROTOTYPES
- #########################################################################################*/
-
- OSErr CheckRequiredParams(const AppleEvent * inEvent);
-
- SInt32 GetAEErrorNumber(const AppleEvent * inEvent);
- OSErr GetAEParameter(const AppleEvent * inEvent, AEKeyword inKeyword, AEDesc * outParam);
- OSErr GetAEBoolean(const AppleEvent * inEvent, AEKeyword inKeyword, Boolean * outBoolean);
-
- OSErr ResolveAEParameter(const AEDesc * inParam, AEDesc * ioResolvedParam, SInt16 inFlags = kAEIDoMinimum);
-
- OSErr GetAppleEventClassAndID(const AppleEvent * inEvent, AEEventClass * outClass, AEEventID * outID);
-
- OSErr Get1AEEventHandler(AEEventClass inClass, AEEventID inID, AEEventHandlerUPP * outProc, UInt32 * outRefCon, Boolean inSysHandler);
- OSErr GetAEEventHandler(AEEventClass inClass, AEEventID inID, AEEventHandlerUPP * outProc, UInt32 * outRefCon);
- OSErr Call1AEEventHandler(AEEventClass inClass, AEEventID inID, const AppleEvent * inEvent, AppleEvent * ioReply, Boolean inSysHandler);
- OSErr CallAEEventHandler(AEEventClass inClass, AEEventID inID, const AppleEvent * inEvent, AppleEvent * ioReply);
-
- OSErr CopyAppleEventParameters(const AppleEvent * inOriginal, AppleEvent * outCopy);
-
- OSErr AECreateHandleDesc(DescType inType, const Handle inData, AEDesc * outDesc);
-
- OSErr CreatePropertyObjectSpecifier(DescType inDesiredClass, const AEDesc * inContainer, DescType inPropertyType, AEDesc * outSpecifier);
- OSErr CreateFSSpecObjectSpecifier(DescType inDesiredClass, const AEDesc * inContainer, const FSSpec * inFSSpec, AEDesc * outSpecifier);
- OSErr CreateNamedObjectSpecifier(DescType inDesiredClass, const AEDesc * inContainer, ConstStr255Param inName, AEDesc * outSpecifier);
- OSErr CreateIndexObjectSpecifier(DescType inDesiredClass, const AEDesc * inContainer, SInt32 inIndex, AEDesc * outSpecifier);
- OSErr CreateUniqueIDObjectSpecifier(DescType inDesiredClass, const AEDesc * inContainer, SInt32 inUniqueID, AEDesc * outSpecifier);
-
- OSErr CreateAliasDescriptorFromFSSpec(const FSSpec * inFSSpec, AEDesc * outDesc);
- inline OSErr
- CreateAliasDescriptorFromAlias(AliasHandle inAlias, AEDesc * outDesc)
- {
- return CTX_MacOS::AECreateHandleDesc(typeAlias, reinterpret_cast<Handle>(inAlias), outDesc);
- }
-
- OSErr CoerceDesc(const AEDesc * inDesc, DescType inDesiredType, AEDesc * outResult);
-
- OSErr CompareDescs(const AEDesc * inSource, const AEDesc * inDest, SInt32 * outResult);
- OSErr AEStartsWith(const AEDesc * inSource, const AEDesc * inDest, Boolean * outResult);
- OSErr AEEndsWith(const AEDesc * inSource, const AEDesc * inDest, Boolean * outResult);
- OSErr AEContains(const AEDesc * inSource, const AEDesc * inDest, Boolean * outResult);
-
- OSErr SetReplyError(AppleEvent * inReply, SInt32 inErrorNumber, SInt16 inErrorStrID, SInt16 inErrorIndex);
- OSErr SetReplyError(AppleEvent * inReply, SInt32 inErrorNumber, ConstStr255Param inErrorStr);
-
- inline Size GetAEDescDataSize(const AEDesc & inDesc)
- {
- #if TARGET_API_MAC_CARBON
- return ::AEGetDescDataSize(&inDesc);
- #else
- return ::GetHandleSize(inDesc.dataHandle);
- #endif
- }
-
- OSErr GetAEDescData(const AEDesc & inDesc, void * outData, UInt32 inSize);
- OSErr GetAEDescData(const AEDesc & inDesc, Handle ioData);
-
- OSErr SetAEDescData(AEDesc & ioDesc, DescType inType, const void * inData, UInt32 inSize);
-
-
- CTX_End_Namespace_MacOS
-
-
- /*==================================================================
- Change History (most recent first):
-
- $Log: MacOS_AppleEventUtils.h,v $
- ==================================================================*/
-