home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc Source Code / Binding / ODBindng.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-22  |  3.9 KB  |  160 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        ODBindng.cpp
  3.  
  4.     Contains:    SOM Implementation for Binding class.
  5.  
  6.     Owned by:    Caia Grisar
  7.  
  8.     Copyright:    © 1993 - 1995 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.         <13>     10/8/95    TJ        Fixes Recomended by Refball
  13.         <12>      8/3/95    RR        #1257260: Collapse B classes. Remove
  14.                                     somInit methods. Don't call IsInitialized
  15.                                     or SubclassResponsibility
  16.         <11>     7/24/95    CG        1270320: Memory leak fixes.
  17.         <10>     5/18/95    CG        #1241621 BB: Need to implement Purge for
  18.                                     Binding subsystem objects.
  19.          <9>     5/17/95    VL        1170098: Added private-by-convention
  20.                                     ConstructNoPart.
  21.          <8>      5/1/95    CG        #1241628    BB: SOM_TRY blocks needed in
  22.                                     Binding SOM methods. #1243669    XMP in
  23.                                     ODBindng.cpp ifdef
  24.          <7>     4/26/95    CG        last check in comment should have been :
  25.                                     1241628    SOM_TRY blocks needed in Binding
  26.                                     SOM methods.
  27.          <6>     4/26/95    CG        1211082 BB: 5$ Bugs need to be evaluated
  28.                                     and removed from Core
  29.          <5>    12/13/94    CG        #1206024: Added function prefix to .idl
  30.                                     file.
  31.          <4>     8/24/94    CG        #1181622: Updated file ownership.
  32.          <3>     8/17/94    CG        #1181519: The Binding helper object was not
  33.                                     getting initialized  in InitBinding.
  34.          <2>      7/1/94    CG        Check for somSelf->IsInitialized in
  35.                                     InitBinding.
  36.          <1>     6/20/94    CG        first checked in
  37.     To Do:
  38. */
  39.  
  40.  
  41. #define ODBinding_Class_Source
  42. #define VARIABLE_MACROS
  43. #include <ODBindng.xih>
  44.  
  45. #ifndef _BINDNGH_
  46. #include "BindngH.h"
  47. #endif
  48.  
  49. #ifndef SOM_ODSession_xh
  50. #include "ODSessn.xh"
  51. #endif
  52.  
  53. #ifndef SOM_Module_Apple_defined
  54. #include <NoPart.xh>
  55. #endif
  56.  
  57. SOM_Scope void  SOMLINK ODBindingInitBinding(ODBinding *somSelf, Environment *ev,
  58.         ODSession* session)
  59. {
  60.     ODBindingData *somThis = ODBindingGetData(somSelf);
  61.     ODBindingMethodDebug("ODBinding","InitBinding");
  62.  
  63.     SOM_TRY
  64.     
  65.     somSelf->InitObject(ev);
  66.         
  67.     _fSession = session;
  68.     _fBinding = new Binding();
  69.     _fBinding->InitBinding(_fSession);
  70.     
  71.     SOM_CATCH_ALL
  72.     SOM_ENDTRY
  73. }
  74.  
  75. SOM_Scope ODPart*  SOMLINK ODBindingConstructNoPart(ODBinding *somSelf, Environment *ev)
  76. {
  77.     ODBindingData *somThis = ODBindingGetData(somSelf);
  78.     ODBindingMethodDebug("ODBinding","ConstructNoPart");
  79.  
  80.     ODPart*    noPart;
  81.     
  82.     SOM_TRY
  83.     
  84.     noPart = new Apple_NoPart;
  85.     
  86.     SOM_CATCH_ALL
  87.         noPart = kODNULL;
  88.     SOM_ENDTRY
  89.     return noPart;
  90. }
  91.  
  92. SOM_Scope ODEditor  SOMLINK ODBindingChooseEditorForPart(ODBinding *somSelf, Environment *ev,
  93.         ODStorageUnit* thePartSU,
  94.         ODType newKind)
  95. {
  96.     ODBindingData *somThis = ODBindingGetData(somSelf);
  97.     ODBindingMethodDebug("ODBinding","ChooseEditorForPart");
  98.  
  99.      ODEditor returnVal = kODNULL;
  100.  
  101.     SOM_TRY
  102.  
  103.     returnVal = _fBinding->ChooseEditorForPart(thePartSU, newKind);
  104.  
  105.     SOM_CATCH_ALL
  106.     SOM_ENDTRY
  107.  
  108.     return (returnVal);
  109. }
  110.  
  111. SOM_Scope ODContainerSuite  SOMLINK ODBindingGetContainerSuite(ODBinding *somSelf, Environment *ev,
  112.         ODContainerType containerType)
  113. {
  114.     ODBindingData *somThis = ODBindingGetData(somSelf);
  115.     ODBindingMethodDebug("ODBinding","GetContainerSuite");
  116.  
  117.     ODContainerSuite returnVal = kODNULL;
  118.  
  119.     SOM_TRY
  120.  
  121.     returnVal = _fBinding->GetContainerSuite( containerType );
  122.  
  123.     SOM_CATCH_ALL
  124.     SOM_ENDTRY
  125.  
  126.     return (returnVal);
  127. }
  128.  
  129. SOM_Scope void  SOMLINK ODBindingsomUninit(ODBinding *somSelf)
  130. {
  131.     ODBindingData *somThis = ODBindingGetData(somSelf);
  132.     ODBindingMethodDebug("ODBinding","ODBindingsomUninit");
  133.  
  134.     ODDeleteObject( _fBinding );
  135.     
  136.     ODBinding_parent_ODObject_somUninit(somSelf);
  137. }
  138.  
  139. SOM_Scope ODSize  SOMLINK ODBindingPurge(ODBinding *somSelf, Environment *ev,
  140.         ODSize size)
  141. {
  142.     ODBindingData *somThis = ODBindingGetData(somSelf);
  143.     ODBindingMethodDebug("ODBinding","ODBindingPurge");
  144.  
  145.     ODSize returnVal = 0; ODVolatile( returnVal );
  146.  
  147.     SOM_TRY
  148.  
  149.         returnVal = _fBinding->Purge(size);
  150.  
  151.     SOM_CATCH_ALL
  152.         WARN("Error %ld trying to purge in ODBindingPurge",ErrorCode());
  153.         SetErrorCode(kODNoError);        // dh - Eat the exception; Purge should not 
  154.                                         // propagate it because clients function
  155.                                         // fine whether memory was purged or not.
  156.     SOM_ENDTRY
  157.  
  158.     return(returnVal);
  159. }
  160.