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 / OpenDoc Development / Debugging Support / OpenDoc™ Source Code / Messaging / ODDesc.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-28  |  5.2 KB  |  207 lines  |  [TEXT/MPS ]

  1.  
  2. /*
  3.  *  This file was generated by the SOM Compiler.
  4.  *  Generated using:
  5.  *     SOM incremental update: 2.33
  6.  */
  7.  
  8.  
  9. /*
  10.     File:        ODDesc.cpp
  11.  
  12.     Contains:    Implementation of ODDesc class
  13.  
  14.     Owned by:    Nick Pilch
  15.  
  16.     Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  17.  
  18.     Change History (most recent first):
  19.  
  20.          <9>     8/25/95    NP        1269331: Empty ODDescs have type typeNull,
  21.                                     not 'dead'.
  22.          <8>     8/16/95    NP        1275241: IDL Review. Remove unnecessary
  23.                                     overrides.
  24.          <7>      8/3/95    RR        #1257260: Collapse B classes. Remove
  25.                                     somInit methods. Don't call IsInitialized
  26.                                     or SubclassResponsibility
  27.          <6>     6/22/95    NP        Put ODDebug around memory trashing code.
  28.          <5>     6/20/95    NP        1261016: Added debug code.
  29.          <4>     5/21/95    NP        1248898: GetUserToken, ODDescToAEDesc, etc.
  30.                                     recipe change.
  31.          <3>      3/2/95    eeh        1214783: add assert to ODDescSetAEDesc
  32.          <2>      2/3/95    eeh        1217393: re-add AEDisposeDesc to
  33.                                     ODDescsomUninit
  34.          <1>     1/26/95    NP        first checked in
  35.  
  36.     To Do:
  37. */
  38.  
  39. #define ODDesc_Class_Source
  40. #define VARIABLE_MACROS
  41. #include <ODDesc.xih>
  42.  
  43. #ifndef __APPLEEVENTS__
  44. #include <AppleEvents.h>
  45. #endif
  46.  
  47. #ifndef _BARRAY_
  48. #include "BArray.h"
  49. #endif
  50.  
  51. //------------------------------------------------------------------------------
  52. // ODDescInitODDesc
  53. //------------------------------------------------------------------------------
  54.  
  55. SOM_Scope void  SOMLINK ODDescInitODDesc(ODDesc *somSelf, Environment *ev)
  56. {
  57.     ODDescData *somThis = ODDescGetData(somSelf);
  58.     ODDescMethodDebug("ODDesc","ODDescInitODDesc");
  59.  
  60.     // LAZILY ALLOCATE STRUCT. PREVENTS UNNECESSARY MEMORY ALLOCATIONS
  61.     //    SET DATA DEFAULTS TO VALUES THAT WILL CAUSE ACCESS FAULTS OR WILL LOOK
  62.     //    SUSPICIOUS IN A DEBUGGER.
  63.  
  64. //    _fDescType = 'dead';
  65.     _fDescType = typeNull;
  66.     _fData._maximum = 0xFFFFFFFF;
  67.     _fData._length = 0xFFFFFFFF;
  68.     _fData._buffer = (octet*)0x50FF8001;
  69.     _fAllocated = kODFalse;
  70.  
  71.     SOM_TRY
  72.     
  73.         somSelf->InitObject(ev);
  74.         
  75.     SOM_CATCH_ALL
  76.     SOM_ENDTRY
  77.  
  78. }
  79.  
  80. //------------------------------------------------------------------------------
  81. // ODDescsomUninit
  82. //------------------------------------------------------------------------------
  83.  
  84. SOM_Scope void  SOMLINK ODDescsomUninit(ODDesc *somSelf)
  85. {
  86.     ODDescData *somThis = ODDescGetData(somSelf);
  87.     ODDescMethodDebug("ODDesc","ODDescsomUninit");
  88.  
  89. #if ODDebug
  90.     _fDescType = 'dead';
  91. #endif
  92.  
  93.     if (_fAllocated)
  94.     {
  95. #if ODDebug
  96.         _fAllocated = 459867;
  97.         octet*    dataPtr = _fData._buffer;
  98.         ODULong i;
  99.         for (i = 0; i < _fData._length; i++)
  100.         {
  101.             *dataPtr = 0xef;
  102.             ++dataPtr;
  103.         }
  104. #endif
  105.         DisposeByteArrayStruct(_fData);
  106. #if ODDebug
  107.         _fData._maximum = 0xFFFFFFFF;
  108.         _fData._length = 0xFFFFFFFF;
  109.         _fData._buffer = (octet*)0x50FF8001;
  110. #endif
  111.     }
  112. }
  113.  
  114. //------------------------------------------------------------------------------
  115. // ODDescSetDescType
  116. //------------------------------------------------------------------------------
  117.  
  118. SOM_Scope void  SOMLINK ODDescSetDescType(ODDesc *somSelf, Environment *ev,
  119.         ODDescType descType)
  120. {
  121.     ODDescData *somThis = ODDescGetData(somSelf);
  122.     ODDescMethodDebug("ODDesc","ODDescSetDescType");
  123.  
  124.     _fDescType = descType;
  125. }
  126.  
  127. //------------------------------------------------------------------------------
  128. // ODDescSetRawData
  129. //------------------------------------------------------------------------------
  130.  
  131. SOM_Scope void  SOMLINK ODDescSetRawData(ODDesc *somSelf, Environment *ev,
  132.         ODByteArray* data)
  133. {
  134.     ODDescData *somThis = ODDescGetData(somSelf);
  135.     ODDescMethodDebug("ODDesc","ODDescSetRawData");
  136.  
  137.     SOM_TRY
  138.         if (_fAllocated)
  139.             DisposeByteArrayStruct(_fData);
  140.         _fData = CopyByteArrayStruct(data);
  141.         _fAllocated = kODTrue;
  142.     SOM_CATCH_ALL
  143.     SOM_ENDTRY
  144. }
  145.  
  146. //------------------------------------------------------------------------------
  147. // ODDescGetDescType
  148. //------------------------------------------------------------------------------
  149.  
  150. SOM_Scope ODDescType  SOMLINK ODDescGetDescType(ODDesc *somSelf, Environment *ev)
  151. {
  152.     ODDescData *somThis = ODDescGetData(somSelf);
  153.     ODDescMethodDebug("ODDesc","ODDescGetDescType");
  154.  
  155.     return _fDescType;
  156. }
  157.  
  158. //------------------------------------------------------------------------------
  159. // ODDescGetRawData
  160. //------------------------------------------------------------------------------
  161.  
  162. SOM_Scope ODByteArray  SOMLINK ODDescGetRawData(ODDesc *somSelf, Environment *ev)
  163. {
  164.     ODDescData *somThis = ODDescGetData(somSelf);
  165.     ODDescMethodDebug("ODDesc","ODDescGetRawData");
  166.  
  167.     ODByteArray    result;
  168.     
  169.     SOM_TRY
  170.         if (!_fAllocated)
  171.             result = CreateEmptyByteArrayStruct(0);
  172.         else
  173.             result = CopyByteArrayStruct(&_fData);
  174.     SOM_CATCH_ALL
  175.     SOM_ENDTRY
  176.     
  177.     return result;
  178. }
  179.  
  180. #if 0
  181. SOM_Scope AEDesc*  SOMLINK ODDescGetAEDesc(ODDesc *somSelf, Environment *ev)
  182. {
  183.     ODDescData *somThis = ODDescGetData(somSelf);
  184.     ODDescMethodDebug("ODDesc","ODDescGetAEDesc");
  185.  
  186.     return _fDesc;
  187. }
  188.  
  189. SOM_Scope void  SOMLINK ODDescSetAEDesc(ODDesc *somSelf, Environment *ev,
  190.         AEDesc* desc)
  191. {
  192.     ODDescData *somThis = ODDescGetData(somSelf);
  193.     ODDescMethodDebug("ODDesc","ODDescSetAEDesc");
  194.  
  195.     WASSERT( !_fHadToAllocate );
  196.     _fDesc = desc;
  197. }
  198.  
  199. SOM_Scope void  SOMLINK ODDescSetHadToAllocate(ODDesc *somSelf, Environment *ev)
  200. {
  201.     ODDescData *somThis = ODDescGetData(somSelf);
  202.     ODDescMethodDebug("ODDesc","ODDescSetAEDesc");
  203.  
  204.     _fHadToAllocate = kODTrue;
  205. }
  206. #endif /* 0 */
  207.