home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 3 / CDPDIII.bin / pd / programming / utils / precognition / include / pobject.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-24  |  2.1 KB  |  97 lines

  1. #ifndef POBJECT_H
  2. #define POBJECT_H
  3.  
  4. /* ==========================================================================
  5. **
  6. **                               PObject.h
  7. **
  8. **      Defines the basic struct from which all Precognition objects
  9. **      are defined.
  10. **
  11. **   ©1991 WILLISoft
  12. **
  13. ** ==========================================================================
  14. */
  15. #include <exec/types.h>
  16.  
  17. typedef void Class;
  18.  
  19.  
  20. typedef struct PObject
  21.    {
  22.       Class *isa;        /* Points to the objects 'Class' structure. */
  23.       char  *PObjectName; /* Used by interface builder. */
  24.    } PObject;
  25.  
  26. /* All 'objects' are derrived from this structrure, i.e. they have
  27. ** an 'isa' pointer as their first member.  The 'isa' pointer points
  28. ** to the 'Class' structure for the object.
  29. **
  30. ** NOTE: PObjects do NOT need to have an PObjectName associated with
  31. ** them.  This field is used by the Application builder to attach
  32. ** a variable name.
  33. */
  34.  
  35.  
  36. /*
  37. ** All object methods must provide at least the following operations:
  38. */
  39.  
  40.  
  41. void  CleanUp( 
  42. #ifdef ANSI_HEADERS
  43.                      PObject *self 
  44. #endif
  45.             );
  46.  
  47. /* Deallocates all but the base storage for an object.  e.g. given
  48. ** a structure like:
  49. **
  50. **    struct Abc
  51. **       {
  52. **          Class *isa;
  53. **          char *FirstName, *LastName;
  54. **       };
  55. **
  56. ** which once initialized, has FirstName & LastName pointing to
  57. ** 2 40 char buffers, 'CleanUp( Abc )' would deallocate the strings
  58. ** 'FirstName' & 'LastName', but not Abc itself.
  59. **
  60. ** ==========================================================
  61. **       YOU SHOULD CALL CleanUp FOR EVERY OBJECT
  62. ** ==========================================================
  63. */
  64.  
  65. void PObject_Init( 
  66. #ifdef ANSI_HEADERS
  67.                      PObject *self 
  68. #endif
  69.                   );
  70.  
  71.  
  72. const char *ClassName( 
  73. #ifdef ANSI_HEADERS
  74.                         const PObject *self 
  75. #endif
  76.                      );
  77.    /*
  78.    ** Returns the name of the class to which the object belonds.
  79.    ** (Useful for debugging.)
  80.    */
  81.  
  82.  
  83. #ifdef BUILDER
  84.  
  85. /* 
  86. ** These are used by Interface Builder program only. 
  87. */
  88.  
  89. char *ObjectName( PObject *self );
  90.  
  91. void SetObjectName( PObject *self, char *name );
  92.  
  93.  
  94. #endif
  95.  
  96. #endif
  97.