home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v1.zip / IBMCPP / SAMPLES / COMPILER / SAMPLE06 / TREEDATA.HPP < prev    next >
Text File  |  1993-04-03  |  4KB  |  73 lines

  1. //+----------------------------------------------------------------------------+
  2. //| TREEDATA.HPP                                                               |
  3. //|                                                                            |
  4. //| COPYRIGHT:                                                                 |
  5. //| ----------                                                                 |
  6. //|  Copyright (C) International Business Machines Corp., 1992,1993.           |
  7. //|                                                                            |
  8. //| DISCLAIMER OF WARRANTIES:                                                  |
  9. //| -------------------------                                                  |
  10. //|  The following [enclosed] code is sample code created by IBM Corporation.  |
  11. //|  This sample code is not part of any standard IBM product and is provided  |
  12. //|  to you solely for the purpose of assisting you in the development of      |
  13. //|  your applications.  The code is provided "AS IS", without warranty of     |
  14. //|  any kind.  IBM shall not be liable for any damages arising out of your    |
  15. //|  use of the sample code, even if they have been advised of the             |
  16. //|  possibility of such damages.                                              |
  17. //|                                                                            |
  18. //| REVISION LEVEL: 1.0                                                        |
  19. //| ---------------                                                            |
  20. //|                                                                            |
  21. //+----------------------------------------------------------------------------+
  22. //| Class Name  : TREEDATA                                                     |
  23. //| Purpose     : This class encapulates the data part of a TreeNode.          |
  24. //|               This 'encapsulation' is necessary because the 'data' portion |
  25. //|               could really be 'data', but it could also be another         |
  26. //|               TreeNode.                                                    |
  27. //| Usage note  : Methods in this class are accessible from friends and        |
  28. //|               relations only. You cannot instantiate from this class.      |
  29. //| Author      : njC Sales                                                    |
  30. //| Date        : 27 October 1992                                              |
  31. //+----------------------------------------------------------------------------+
  32. #ifndef   TREEDATA_HPP_INCLUDED
  33. #define   TREEDATA_HPP_INCLUDED
  34.  
  35. #include <os2.h>
  36.  
  37. extern "C"
  38. {
  39.    #include  <stddef.h>
  40.    #include  <string.h>
  41.    #include  <stdio.h>
  42. }
  43.  
  44. class TreeData
  45. {
  46. public:
  47.  
  48.    //+-------------------------------------------------------------------------+
  49.    //| Declare constructors/destructor                                         |
  50.    //+-------------------------------------------------------------------------+
  51.    TreeData():  myData(0) {}
  52.    TreeData(void *pString);
  53.    TreeData(TreeData *pTreeData);
  54.    TreeData(const TreeData &tData);
  55.    virtual ~TreeData();
  56.  
  57.    //+-------------------------------------------------------------------------+
  58.    //| Declare assignment/type conversion operators                            |
  59.    //+-------------------------------------------------------------------------+
  60.    TreeData &operator= (const TreeData &tData);
  61.    virtual void   *getData() const    {return myData;}
  62.    virtual void   display();
  63.  
  64.    //+-------------------------------------------------------------------------+
  65.    //| Define update functions                                                 |
  66.    //+-------------------------------------------------------------------------+
  67.    virtual void   setData(void *pString) {myData= pString; }
  68.  
  69. private:             // Can be accessed by children
  70.    void    *myData;
  71. };
  72. #endif
  73.