home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / opendc12.zip / od124os2.exe / od12osp1.exe / src / dynamicp / ioddyext.cpp next >
C/C++ Source or Header  |  1997-04-02  |  4KB  |  97 lines

  1. /* @(#) 1.3 com/src/samples/dynamicp/ioddyext.cpp, oddynamicpart, od96os2, odos29712d 11/1/96 21:00:35 [3/21/97 17:49:25] */
  2. //====START_GENERATED_PROLOG======================================
  3. //
  4. //
  5. //   COMPONENT_NAME: oddynamicpart
  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. // This file implements the ScriptExtension code for a scriptable part which
  31. // inherits from 'SimplePart'.
  32.  
  33. /*
  34.  *  This file was generated by the SOM Compiler and Emitter Framework.
  35.  *  Generated using:
  36.  *      SOM Emitter emitxtm.dll: Development
  37.  */
  38.  
  39. #ifndef SOM_Module_ioddyext_Source
  40. #define SOM_Module_ioddyext_Source
  41. #endif
  42. #define ScriptableSimplePartScrExt_Class_Source
  43.  
  44. #include "ioddyext.xih"
  45. #include "scrcomp.xh"          // to get return value codes
  46.  
  47.  
  48. SOM_Scope ODScriptExtension_ODScrRegRet  SOMLINK DYNExt_Register(ScriptableDynamicPartScrExt *somSelf,
  49.                                                                   Environment *ev,
  50.                                                                   ODScriptExtension* RegScope,
  51.                                                                   string Prefix)
  52. {
  53.     ODScrRegRet RetVal = ODScrRegOK ;
  54.     ODObject* basepart ;
  55.     char*     className ;
  56.     char*     nameAssigned ;
  57.  
  58.     /* ScriptableDynamicPartScrExtData *somThis = ScriptableDynamicPartScrExtGetData(somSelf); */
  59.     ScriptableDynamicPartScrExtMethodDebug("ScriptableDynamicPartScrExt","SSPExt_Register");
  60.  
  61.     basepart = somSelf->GetBase(ev) ;
  62.     if (basepart == NULL) {return ODScrRegErr;}
  63.  
  64.     // The class for each scriptable object needs to be registered with the
  65.     // ScriptComponent.
  66.  
  67.     className = basepart->somGetClassName() ;
  68.     RetVal = RegScope->DoRegisterClass(ev, className) ;
  69.     if (RetVal != ODScrRegOK)
  70.     { return RetVal ; }
  71.  
  72.     // DoRegisterObject can take care of most normal naming issues.  We
  73.     // call it here with the option option that will append a
  74.     // numeric string to the name supplied here if needed to
  75.     // make the name unique in the set of names assigned for this Part.
  76.  
  77.     RetVal = RegScope->DoRegisterObject(ev,
  78.                      basepart,          // the object to be scriptable
  79.                      className,         // the class name of that object
  80.                      "Dynamic",           // the default name to be used
  81.                       Prefix,            // prefix that applies in the scope
  82.                                         //  where registration begins
  83.                       &nameAssigned,     // receives name actually assigned
  84.                       somSelf,           // the scope/extension of the object
  85.                      kODTrue);          // digits to be appended to make the
  86.                                         //  name unique if needed.
  87.  
  88.     if (RetVal == ODScrRegOK)           // if registration was successful, we
  89.     { SOMFree(nameAssigned) ; }         //  need to release the storage
  90.                                         //  that holds the actual name assigned.
  91.                                         //  For this part we don't need to
  92.                                         //  save that information.
  93.  
  94.     return RetVal ;
  95.  
  96. }
  97.