home *** CD-ROM | disk | FTP | other *** search
- /*==================================================================
- File: MacOS_UAppleEventTraits.h
-
- Contains: Apple Event descriptor trait declarations for use
- with the Apple Event utility classes.
-
- Written by: Ed Reed
-
- Copyright: © 1999 Connectix Corporation
- ==================================================================*/
-
- #pragma once
-
- #ifndef __AEDATAMODEL__
- #include <AEDataModel.h>
- #endif
-
- #ifndef __AEOBJECTS__
- #include <AEObjects.h>
- #endif
-
- #ifndef __AEREGISTRY__
- #include <AERegistry.h>
- #endif
-
- #ifndef __ERRORS__
- #include <Errors.h>
- #endif
-
- #ifndef __EPPC__
- #include <EPPC.h>
- #endif
-
- #ifndef __PROCESSES__
- #include <Processes.h>
- #endif
-
- /*******************************************************************
- TYPE/CLASS DEFINTIONS
- *******************************************************************/
-
- /*------------------------------------------------------------------
- AEDescriptorTraits
- ------------------------------------------------------------------*/
-
- // Generic template
- template <typename _Type>
- class AEDescriptorTraits
- {
- public:
- static Size GetMaxSize(void) { return sizeof(_Type); }
- };
-
- // Specializations for common AE descriptor types
- #define DeclareAEDescriptorTrait_(_Type, _Code) \
- template <> \
- class AEDescriptorTraits<_Type> \
- { \
- public: \
- enum { kDescriptorType = _Code }; \
- static Size GetSize(const _Type & /* inValue */) { return sizeof(_Type); } \
- static Size GetMaxSize(void) { return sizeof(_Type); } \
- }
-
- DeclareAEDescriptorTrait_(Boolean, typeBoolean);
- DeclareAEDescriptorTrait_(SInt16, typeSInt16);
- DeclareAEDescriptorTrait_(SInt32, typeSInt32);
- DeclareAEDescriptorTrait_(FourCharCode, typeEnumeration);
- DeclareAEDescriptorTrait_(SInt64, typeSInt64);
- DeclareAEDescriptorTrait_(Float32, typeIEEE32BitFloatingPoint);
- DeclareAEDescriptorTrait_(Float64, typeIEEE64BitFloatingPoint);
- DeclareAEDescriptorTrait_(ProcessSerialNumber, typeProcessSerialNumber);
- DeclareAEDescriptorTrait_(FSSpec, typeFSS);
- DeclareAEDescriptorTrait_(Point, typeQDPoint);
- DeclareAEDescriptorTrait_(Rect, typeQDRectangle);
-
- #if !TARGET_API_MAC_CARBON // not supported in Carbon
- DeclareAEDescriptorTrait_(TargetID, typeTargetID);
- #endif
-
- // Disallow automatic template instantiation for the following types
- #define DeclareBogusAEDescriptorTrait_(_Type) \
- template <> \
- class AEDescriptorTraits<_Type> \
- { \
- }
-
- /*==================================================================
- Change History (most recent first):
-
- $Log: MacOS_UAppleEventTraits.h,v $
- Revision 1.3 2001/03/05 23:41:51 mfoley
- Conditionally removed the TargetID trait - it's not supported for Carbon.
-
- Revision 1.2 1999/04/23 22:08:32 reed
- Added TargetID descriptor trait
-
- Revision 1.1 1999/04/12 20:16:03 reed
- First Checked In.
-
- ==================================================================*/
-