home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2001 / MacHack 2001.toast / pc / The Hacks / APLocation / Sources / MacOS_AppleEventUtils.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-06-23  |  4.1 KB  |  104 lines

  1. /*==================================================================
  2.     File:        MacOS_AppleEventUtils.h
  3.  
  4.     Contains:    AppleEvent utility routines.
  5.  
  6.     Written by:    Ed Reed
  7.  
  8.     Copyright:    © 1999 Connectix Corporation
  9. ==================================================================*/
  10.  
  11. #pragma once
  12.  
  13. #include "MacOS_Namespaces.h"
  14.  
  15. #ifndef __AEOBJECTS__
  16. #include <AEObjects.h>
  17. #endif
  18.  
  19. #ifndef __ALIASES__
  20. #include <Aliases.h>
  21. #endif
  22.  
  23. #ifndef __APPLEEVENTS__
  24. #include <AppleEvents.h>
  25. #endif
  26.  
  27. #ifndef __FILES__
  28. #include <Files.h>
  29. #endif
  30.  
  31.  
  32. CTX_Begin_Namespace_MacOS
  33.  
  34.  
  35. /*#########################################################################################
  36.     EXPORTED FUNCTION PROTOTYPES
  37. #########################################################################################*/
  38.  
  39. OSErr CheckRequiredParams(const AppleEvent * inEvent);
  40.  
  41. SInt32 GetAEErrorNumber(const AppleEvent * inEvent);
  42. OSErr GetAEParameter(const AppleEvent * inEvent, AEKeyword inKeyword, AEDesc * outParam);
  43. OSErr GetAEBoolean(const AppleEvent * inEvent, AEKeyword inKeyword, Boolean * outBoolean);
  44.  
  45. OSErr ResolveAEParameter(const AEDesc * inParam, AEDesc * ioResolvedParam, SInt16 inFlags = kAEIDoMinimum);
  46.  
  47. OSErr GetAppleEventClassAndID(const AppleEvent * inEvent, AEEventClass * outClass, AEEventID * outID);
  48.  
  49. OSErr Get1AEEventHandler(AEEventClass inClass, AEEventID inID, AEEventHandlerUPP * outProc, UInt32 * outRefCon, Boolean inSysHandler);
  50. OSErr GetAEEventHandler(AEEventClass inClass, AEEventID inID, AEEventHandlerUPP * outProc, UInt32 * outRefCon);
  51. OSErr Call1AEEventHandler(AEEventClass inClass, AEEventID inID, const AppleEvent * inEvent, AppleEvent * ioReply, Boolean inSysHandler);
  52. OSErr CallAEEventHandler(AEEventClass inClass, AEEventID inID, const AppleEvent * inEvent, AppleEvent * ioReply);
  53.  
  54. OSErr CopyAppleEventParameters(const AppleEvent * inOriginal, AppleEvent * outCopy);
  55.  
  56. OSErr AECreateHandleDesc(DescType inType, const Handle inData, AEDesc * outDesc);
  57.  
  58. OSErr CreatePropertyObjectSpecifier(DescType inDesiredClass, const AEDesc * inContainer, DescType inPropertyType, AEDesc * outSpecifier);
  59. OSErr CreateFSSpecObjectSpecifier(DescType inDesiredClass, const AEDesc * inContainer, const FSSpec * inFSSpec, AEDesc * outSpecifier);
  60. OSErr CreateNamedObjectSpecifier(DescType inDesiredClass, const AEDesc * inContainer, ConstStr255Param inName, AEDesc * outSpecifier);
  61. OSErr CreateIndexObjectSpecifier(DescType inDesiredClass, const AEDesc * inContainer, SInt32 inIndex, AEDesc * outSpecifier);
  62. OSErr CreateUniqueIDObjectSpecifier(DescType inDesiredClass, const AEDesc * inContainer, SInt32 inUniqueID, AEDesc * outSpecifier);
  63.  
  64. OSErr CreateAliasDescriptorFromFSSpec(const FSSpec * inFSSpec, AEDesc * outDesc);
  65. inline OSErr
  66. CreateAliasDescriptorFromAlias(AliasHandle inAlias, AEDesc * outDesc)
  67. {
  68.     return CTX_MacOS::AECreateHandleDesc(typeAlias, reinterpret_cast<Handle>(inAlias), outDesc);
  69. }
  70.  
  71. OSErr CoerceDesc(const AEDesc * inDesc, DescType inDesiredType, AEDesc * outResult);
  72.  
  73. OSErr CompareDescs(const AEDesc * inSource, const AEDesc * inDest, SInt32 * outResult);
  74. OSErr AEStartsWith(const AEDesc * inSource, const AEDesc * inDest, Boolean * outResult);
  75. OSErr AEEndsWith(const AEDesc * inSource, const AEDesc * inDest, Boolean * outResult);
  76. OSErr AEContains(const AEDesc * inSource, const AEDesc * inDest, Boolean * outResult);
  77.  
  78. OSErr SetReplyError(AppleEvent * inReply, SInt32 inErrorNumber, SInt16 inErrorStrID, SInt16 inErrorIndex);
  79. OSErr SetReplyError(AppleEvent * inReply, SInt32 inErrorNumber, ConstStr255Param inErrorStr);
  80.  
  81. inline Size GetAEDescDataSize(const AEDesc & inDesc)
  82. {
  83. #if TARGET_API_MAC_CARBON
  84.     return ::AEGetDescDataSize(&inDesc);
  85. #else
  86.     return ::GetHandleSize(inDesc.dataHandle);
  87. #endif
  88. }
  89.  
  90. OSErr GetAEDescData(const AEDesc & inDesc, void * outData, UInt32 inSize);
  91. OSErr GetAEDescData(const AEDesc & inDesc, Handle ioData);
  92.  
  93. OSErr SetAEDescData(AEDesc & ioDesc, DescType inType, const void * inData, UInt32 inSize);
  94.  
  95.  
  96. CTX_End_Namespace_MacOS
  97.  
  98.  
  99. /*==================================================================
  100.     Change History (most recent first):
  101.  
  102.     $Log: MacOS_AppleEventUtils.h,v $
  103. ==================================================================*/
  104.