home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Found / ODUtils / BArray.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-17  |  2.0 KB  |  80 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        BArray.h
  3.  
  4.     Contains:    ByteArray collection
  5.  
  6.     Owned by:    Vincent Lo
  7.  
  8.     Copyright:    © 1994 - 1996 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <3>     5/24/96    jpa        1.1MRD: pragma internal eliminates NOPs.
  13.          <2>     3/15/96    CC        1331422: Added ODAEGetByteArray function.
  14.  
  15.     To Do:
  16. */
  17.  
  18. #ifndef _BARRAY_
  19. #define _BARRAY_
  20.  
  21. #ifndef _ODTYPES_
  22. #include <ODTypes.h>
  23. #endif
  24.  
  25. #ifndef __APPLEEVENTS__
  26. #include <AppleEvents.h>
  27. #endif
  28.  
  29. /* DisposeByteArrayStruct is a macro instead of a function so it can take a different
  30.    parameter type than DisposeByteArray(), and still set the disposed pointer field
  31.    of the structure to null.
  32.    DisposeByteArray() must never be called on a ByteArray structure; DisposeByteArray()
  33.    disposes the structure which is usually a distaster.
  34. */
  35.  
  36. #define    DisposeByteArrayStruct(byteArray)        \
  37.     do{                                            \
  38.         if (byteArray._buffer != kODNULL) {        \
  39.             ODDisposePtr(byteArray._buffer);    \
  40.             byteArray._buffer = kODNULL;        \
  41.         }                                        \
  42.         byteArray._length = 0;                    \
  43.         byteArray._maximum = 0;                    \
  44.     }while(0)
  45.  
  46.  
  47. #ifdef _OD_IMPL_SHARE_UTILS_
  48. #pragma import on
  49. #elif defined(PRAGMA_INTERNAL_SUPPORTED)
  50. #pragma internal on
  51. #endif
  52.  
  53. extern "C" {
  54.     ODByteArray*    CreateByteArray(void* buffer, ODULong size);
  55.     ODByteArray        CreateByteArrayStruct(void* buffer, ODULong size);
  56.  
  57.     ODByteArray*    CreateEmptyByteArray(ODULong maximum);
  58.     ODByteArray        CreateEmptyByteArrayStruct(ODULong maximum);
  59.  
  60.     void UseByteArray(ODByteArray* ba, void* buffer, ODULong size);
  61.  
  62.     ODByteArray*    CopyByteArray(ODByteArray* fromBA);
  63.     ODByteArray        CopyByteArrayStruct(ODByteArray* fromBA);
  64.  
  65.     void            DisposeByteArray(ODByteArray* array);
  66.  
  67.     ODBoolean        AreByteArraysEqual(ODByteArray* ba1, ODByteArray* ba2);
  68.  
  69.     ODByteArray*    ODAEGetByteArray(const AppleEvent *theAppleEvent,
  70.                                         AEKeyword theAEKeyword,
  71.                                         DescType desiredType);
  72. }
  73.  
  74. #ifdef _OD_IMPL_SHARE_UTILS_
  75. #pragma import off
  76. #elif defined(PRAGMA_INTERNAL_SUPPORTED)
  77. #pragma internal reset
  78. #endif
  79.  
  80. #endif     // _BARRAY_