home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / opendc12.zip / od124os2.exe / od12osr1.exe / src / Extensn.cpp < prev    next >
C/C++ Source or Header  |  1997-03-21  |  6KB  |  176 lines

  1. /* @(#)Z 1.5 com/src/core/Extensn.cpp, odcore, od96os2, odos29712d 97/03/21 17:18:06 (96/10/29 09:20:35) */
  2. //====START_GENERATED_PROLOG======================================
  3. //
  4. //
  5. //   COMPONENT_NAME: odcore
  6. //
  7. //   CLASSES: none
  8. //
  9. //   ORIGINS: 82,27
  10. //
  11. //
  12. //   (C) COPYRIGHT International Business Machines Corp. 1995,1996
  13. //   All Rights Reserved
  14. //   Licensed Materials - Property of IBM
  15. //   US Government Users Restricted Rights - Use, duplication or
  16. //   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  17. //       
  18. //   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  19. //   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  20. //   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  21. //   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  22. //   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  23. //   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  24. //   OR PERFORMANCE OF THIS SOFTWARE.
  25. //
  26. //====END_GENERATED_PROLOG========================================
  27. //
  28.  
  29. /*
  30.     File:        Extensn.cpp
  31.  
  32.     Contains:    Implementation of ODExtension class.
  33.  
  34.     Owned by:    Nick Pilch
  35.  
  36.     Copyright:    ⌐ 1993 - 1995 by Apple Computer, Inc., all rights reserved.
  37.  
  38.     Change History (most recent first):
  39.  
  40.         <14>     10/8/95    TJ        Fixes Recomended by Refball
  41.         <13>     8/16/95    NP        1275241: IDL Review. Remove unnecessary
  42.                                     overrides.
  43.         <12>      8/3/95    RR        #1257260: Collapse B classes. Remove
  44.                                     somInit methods. Don't call IsInitialized
  45.                                     or SubclassResponsibility
  46.         <11>     6/22/95    jpa        Call inherited Release method. [1261632]
  47.         <10>     6/20/95    JP        1251250: Made Release call ReleaseExtension
  48.          <9>     4/28/95    eeh        1242417: raise error in CheckValid
  49.          <8>     4/26/95    CG        1211082 BB: 5$ Bugs need to be evaluated
  50.                                     and removed from Core
  51.          <7>     4/14/95    Té        #1239963 BB: InitExtension needs to call
  52.                                     InitRefCntObject NOT InitObject
  53.                                      -- Note: this should allow ShellPlugIns to
  54.                                     work.   Yeah!
  55.          <6>     8/28/94    VL        1181298: Removed Release as ODExtension is
  56.                                     a subclass of RefCntObject now.
  57.          <5>     8/19/94    NP        1181622: Ownership fix.
  58.          <4>     8/15/94    Té        #1181162 Added BaseRemoved, IsValid &
  59.                                     CheckValid
  60.          <3>      7/8/94    NP        Fixed Initialization.
  61.          <2>     6/24/94    CG        Initialization clean up.
  62.          <1>     6/23/94    CG        first checked in
  63.          <0>     6/22/94    SV        SOMverted
  64.          <2>     3/15/94    MB        Changes to support SCpp/ASLM builds,
  65.                                     #1150864.
  66.          <3>     1/14/94    NP        Init changes.
  67.          <2>     4/28/93    NP        File name changes.
  68.          <1>     4/27/93    NP        first checked in
  69.  
  70.     To Do:
  71.     In Progress:
  72.         
  73. */
  74.  
  75. #define ODExtension_Class_Source
  76. #define VARIABLE_MACROS
  77. #include <Extensn.xih>
  78.  
  79.  
  80. #pragma segment ODExtension
  81.  
  82.  
  83. //==============================================================================
  84. // ODExtension
  85. //==============================================================================
  86.  
  87. //------------------------------------------------------------------------------
  88. // ODExtension: Initialize
  89. //------------------------------------------------------------------------------
  90.  
  91.  
  92. SOM_Scope void  SOMLINK ODExtensionInitExtension
  93.         (ODExtension *somSelf, Environment *ev,
  94.         ODObject* base)
  95. {
  96.     ODExtensionData *somThis = ODExtensionGetData(somSelf);
  97.     ODExtensionMethodDebug("ODExtension","InitExtension");
  98.     
  99.     try {
  100.  
  101.     /* Moved from somInit. SOM itself sets fields to zero
  102.     _fBase = kODNULL;
  103.     */
  104.     somSelf->InitRefCntObject(ev);
  105.     
  106.     _fBase = base;
  107.         }    
  108.     catch (ODException _exception) {
  109.             SetErrorCode(kODNoError);
  110.         }
  111. }
  112.  
  113. //------------------------------------------------------------------------------
  114. // ODExtension: GetBase
  115. //------------------------------------------------------------------------------
  116.  
  117. SOM_Scope ODObject*  SOMLINK ODExtensionGetBase
  118.         (ODExtension *somSelf, Environment *ev)
  119. {
  120.     ODExtensionData *somThis = ODExtensionGetData(somSelf);
  121.     ODExtensionMethodDebug("ODExtension","GetBase");
  122.  
  123.     return _fBase;
  124. }
  125.  
  126. #if 0
  127. SOM_Scope void  SOMLINK ODExtensionsomUninit(ODExtension *somSelf)
  128. {
  129.     ODExtensionData *somThis = ODExtensionGetData(somSelf);
  130.     ODExtensionMethodDebug("ODExtension","somUninit");
  131.  
  132.     ODExtension_parent_ODRefCntObject_somUninit(somSelf);
  133. }
  134. #endif /* 0 */
  135.  
  136. SOM_Scope void  SOMLINK ODExtensionRelease
  137.         (ODExtension *somSelf, Environment *ev)
  138. {
  139.     ODExtensionData *somThis = ODExtensionGetData(somSelf);
  140.     ODExtensionMethodDebug("ODExtension","Release");
  141.  
  142.     ODExtension_parent_ODRefCntObject_Release(somSelf,ev);
  143.  
  144.     if (_fBase != kODNULL && somSelf->GetRefCount(ev) == 0)
  145.         _fBase->ReleaseExtension(ev, somSelf);
  146. }
  147.  
  148. SOM_Scope void  SOMLINK ODExtensionBaseRemoved
  149.         (ODExtension *somSelf, Environment *ev)
  150. {
  151.     ODExtensionData *somThis = ODExtensionGetData(somSelf);
  152.     ODExtensionMethodDebug("ODExtension","BaseRemoved");
  153.  
  154.     _fBase = kODNULL;
  155. }
  156.  
  157. SOM_Scope ODBoolean  SOMLINK ODExtensionIsValid
  158.         (ODExtension *somSelf, Environment *ev)
  159. {
  160.     ODExtensionData *somThis = ODExtensionGetData(somSelf);
  161.     ODExtensionMethodDebug("ODExtension","BaseRemoved");
  162.  
  163.     return (_fBase != kODNULL);
  164. }
  165.  
  166. SOM_Scope void  SOMLINK ODExtensionCheckValid
  167.         (ODExtension *somSelf, Environment *ev)
  168. {
  169.     ODExtensionData *somThis = ODExtensionGetData(somSelf);
  170.     ODExtensionMethodDebug("ODExtension","CheckValid");
  171.  
  172.     if (_fBase == kODNULL)
  173.         ODSetSOMException( ev, kODErrInvalidExtension );
  174. }
  175.  
  176.