home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / som / somd / cpp / animal / ddog.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-24  |  2.8 KB  |  106 lines

  1. //
  2. //   COMPONENT_NAME: somx
  3. //
  4. //   ORIGINS: 27
  5. //
  6. //
  7. //   10H9767, 10H9769  (C) COPYRIGHT International Business Machines Corp. 1992,1994
  8. //   All Rights Reserved
  9. //   Licensed Materials - Property of IBM
  10. //   US Government Users Restricted Rights - Use, duplication or
  11. //   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  12. //
  13.  
  14. /* %Z% %I% %W% %G% %U% [%H% %T%] */
  15. /*
  16.  *  This file was generated by the SOM Compiler and Emitter Framework.
  17.  *  Generated using: 
  18.  *      SOM Emitter emitxtm: 2.37
  19.  */
  20.  
  21.  
  22.  
  23. #ifndef SOM_Module_ddog_Source
  24. #define SOM_Module_ddog_Source
  25. #endif
  26. #define dDog_Class_Source
  27.  
  28. #include <stdio.h>
  29. #include <string.h>
  30. #include <windows.h>
  31. #include "ddog.xih"
  32. #include "nlsutil.h" /* d18953 */
  33. #include "animal.h" /* d18953 */
  34. /*
  35.  * Noise dog makes.
  36.  */
  37.  
  38. SOM_Scope void  SOMLINK _set_noise(dDog *somSelf,  Environment *ev, 
  39.                                    string noise)
  40. {
  41.     dDogData *somThis = dDogGetData(somSelf);
  42.     dDogMethodDebug("dDog","_set_noise");
  43.     if (somThis->noise) SOMFree(somThis->noise);
  44.     somThis->noise = (string) SOMMalloc(strlen(noise) + 1);
  45.     strcpy(somThis->noise, noise);
  46.  
  47. }
  48.  
  49. /*
  50.  * Trick dog performs.
  51.  */
  52.  
  53. SOM_Scope void  SOMLINK _set_trick(dDog *somSelf,  Environment *ev, 
  54.                                    string trick)
  55. {
  56.     dDogData *somThis = dDogGetData(somSelf);
  57.     dDogMethodDebug("dDog","_set_trick");
  58.     if (somThis->trick) SOMFree(somThis->trick);
  59.     somThis->trick = (string) SOMMalloc(strlen(trick) + 1);
  60.     strcpy(somThis->trick, trick);
  61.  
  62. }
  63. SOM_Scope void SOMLINK somDefaultInit(dDog *somSelf, somInitCtrl* ctrl)
  64. {
  65.     dDogData *somThis; /* set in BeginInitializer */
  66.     Environment *ev;
  67.     somInitCtrl globalCtrl;
  68.     somBooleanVector myMask;
  69.     dDogMethodDebug("dDog","somDefaultInit");
  70.     dDog_BeginInitializer_somDefaultInit;
  71.  
  72.     dDog_Init_dAnimal_somDefaultInit(somSelf,ctrl);
  73.  
  74.     ev = somGetGlobalEnvironment();
  75.     somSelf->_set_noise(ev, NlsMsgGet(UnknownNoiseId));
  76.     somSelf->_set_trick(ev, NlsMsgGet(UnknownTrickId));
  77. }
  78.  
  79. SOM_Scope void SOMLINK somDestruct(dDog *somSelf, octet doFree, somDestructCtrl* ctrl)
  80. {
  81.    dDogData *somThis; /* set in BeginDestructor */
  82.    somDestructCtrl globalCtrl;
  83.    somBooleanVector myMask;
  84.    dDogMethodDebug("dDog","somDestruct");
  85.    dDog_BeginDestructor;
  86.  
  87.     if (somThis->trick) SOMFree (somThis->trick);
  88.     if (somThis->noise) SOMFree (somThis->noise);
  89.     dDog_EndDestructor;
  90. }
  91.  
  92. SOM_Scope string  SOMLINK display(dDog *somSelf,  Environment *ev)
  93. {
  94.     string mybuff, bp;
  95.  
  96.     dDogData *somThis = dDogGetData(somSelf);
  97.     dDogMethodDebug("dDog","display");
  98.  
  99.     mybuff = parent_display(somSelf, ev);
  100.     bp = mybuff;
  101.     bp += strlen(mybuff);
  102.     wsprintf(bp, NlsMsgGet(MyTrickId), somThis->trick);
  103.     return mybuff;
  104. }
  105.  
  106.