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 / Core / Extensn.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-28  |  4.4 KB  |  153 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        Extensn.cpp
  3.  
  4.     Contains:    Implementation of ODExtension class.
  5.  
  6.     Owned by:    Nick Pilch
  7.  
  8.     Copyright:    © 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <2>     1/16/96    VL        1170098: Make the class (subclass) dynamic
  13.                                     so that the library can be unloaded.
  14.         <14>     10/8/95    TJ        Fixes Recomended by Refball
  15.         <13>     8/16/95    NP        1275241: IDL Review. Remove unnecessary
  16.                                     overrides.
  17.         <12>      8/3/95    RR        #1257260: Collapse B classes. Remove
  18.                                     somInit methods. Don't call IsInitialized
  19.                                     or SubclassResponsibility
  20.         <11>     6/22/95    jpa        Call inherited Release method. [1261632]
  21.         <10>     6/20/95    JP        1251250: Made Release call ReleaseExtension
  22.          <9>     4/28/95    eeh        1242417: raise error in CheckValid
  23.          <8>     4/26/95    CG        1211082 BB: 5$ Bugs need to be evaluated
  24.                                     and removed from Core
  25.          <7>     4/14/95    TÇ        #1239963 BB: InitExtension needs to call
  26.                                     InitRefCntObject NOT InitObject
  27.                                      -- Note: this should allow ShellPlugIns to
  28.                                     work.   Yeah!
  29.          <6>     8/28/94    VL        1181298: Removed Release as ODExtension is
  30.                                     a subclass of RefCntObject now.
  31.          <5>     8/19/94    NP        1181622: Ownership fix.
  32.          <4>     8/15/94    TÇ        #1181162 Added BaseRemoved, IsValid &
  33.                                     CheckValid
  34.          <3>      7/8/94    NP        Fixed Initialization.
  35.          <2>     6/24/94    CG        Initialization clean up.
  36.          <1>     6/23/94    CG        first checked in
  37.          <0>     6/22/94    SV        SOMverted
  38.          <2>     3/15/94    MB        Changes to support SCpp/ASLM builds,
  39.                                     #1150864.
  40.          <3>     1/14/94    NP        Init changes.
  41.          <2>     4/28/93    NP        File name changes.
  42.          <1>     4/27/93    NP        first checked in
  43.  
  44.     To Do:
  45.     In Progress:
  46.         
  47. */
  48.  
  49. #define ODExtension_Class_Source
  50. #define VARIABLE_MACROS
  51. #include <Extensn.xih>
  52.  
  53. #ifndef SOM_SOMClass_xh
  54. #include <somcls.xh>
  55. #endif
  56.  
  57. #ifndef SOM_SOMObject_xh
  58. #include <somobj.xh>
  59. #endif
  60.  
  61. #pragma segment ODExtension
  62.  
  63.  
  64. //==============================================================================
  65. // ODExtension
  66. //==============================================================================
  67.  
  68. //------------------------------------------------------------------------------
  69. // ODExtension: Initialize
  70. //------------------------------------------------------------------------------
  71.  
  72.  
  73. SOM_Scope void  SOMLINK ODExtensionInitExtension(ODExtension *somSelf, Environment *ev,
  74.         ODObject* base)
  75. {
  76.     ODExtensionData *somThis = ODExtensionGetData(somSelf);
  77.     ODExtensionMethodDebug("ODExtension","InitExtension");
  78.     
  79.     SOM_TRY
  80.  
  81.     /* Moved from somInit. SOM itself sets fields to zero
  82.     _fBase = kODNULL;
  83.     */
  84.     somSelf->InitRefCntObject(ev);
  85.     
  86.     _fBase = base;
  87.     
  88.     SOMClass* cls = somSelf->somGetClass();
  89.     cls->somMakeDynamicClassReference();
  90.     somReleaseClassReference ( cls );
  91.     
  92.     
  93.     SOM_CATCH_ALL
  94.     SOM_ENDTRY
  95. }
  96.  
  97. //------------------------------------------------------------------------------
  98. // ODExtension: GetBase
  99. //------------------------------------------------------------------------------
  100.  
  101. SOM_Scope ODObject*  SOMLINK ODExtensionGetBase(ODExtension *somSelf, Environment *ev)
  102. {
  103.     ODExtensionData *somThis = ODExtensionGetData(somSelf);
  104.     ODExtensionMethodDebug("ODExtension","GetBase");
  105.  
  106.     return _fBase;
  107. }
  108. #if 0
  109. SOM_Scope void  SOMLINK ODExtensionsomUninit(ODExtension *somSelf)
  110. {
  111.     ODExtensionData *somThis = ODExtensionGetData(somSelf);
  112.     ODExtensionMethodDebug("ODExtension","somUninit");
  113.  
  114.     ODExtension_parent_ODRefCntObject_somUninit(somSelf);
  115. }
  116. #endif /* 0 */
  117. SOM_Scope void  SOMLINK ODExtensionRelease(ODExtension *somSelf, Environment *ev)
  118. {
  119.     ODExtensionData *somThis = ODExtensionGetData(somSelf);
  120.     ODExtensionMethodDebug("ODExtension","Release");
  121.  
  122.     ODExtension_parent_ODRefCntObject_Release(somSelf,ev);
  123.  
  124.     if (_fBase != kODNULL && somSelf->GetRefCount(ev) == 0)
  125.         _fBase->ReleaseExtension(ev, somSelf);
  126. }
  127.  
  128. SOM_Scope void  SOMLINK ODExtensionBaseRemoved(ODExtension *somSelf, Environment *ev)
  129. {
  130.     ODExtensionData *somThis = ODExtensionGetData(somSelf);
  131.     ODExtensionMethodDebug("ODExtension","BaseRemoved");
  132.  
  133.     _fBase = kODNULL;
  134. }
  135.  
  136. SOM_Scope ODBoolean  SOMLINK ODExtensionIsValid(ODExtension *somSelf, Environment *ev)
  137. {
  138.     ODExtensionData *somThis = ODExtensionGetData(somSelf);
  139.     ODExtensionMethodDebug("ODExtension","BaseRemoved");
  140.  
  141.     return (_fBase != kODNULL);
  142. }
  143.  
  144. SOM_Scope void  SOMLINK ODExtensionCheckValid(ODExtension *somSelf, Environment *ev)
  145. {
  146.     ODExtensionData *somThis = ODExtensionGetData(somSelf);
  147.     ODExtensionMethodDebug("ODExtension","CheckValid");
  148.  
  149.     if (_fBase == kODNULL)
  150.         ODSetSOMException( ev, kODErrInvalidExtension );
  151. }
  152.  
  153.