home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0040 - 0049 / ibm0040-0049 / ibm0040.tar / ibm0040 / BCPPOWL1.ZIP / CLINC.ZIP / DLSTELEM.H < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-28  |  2.0 KB  |  96 lines

  1. // Borland C++ - (C) Copyright 1991 by Borland International
  2.  
  3. // Contents ----------------------------------------------------------------
  4. //
  5. //      DoubleListElement
  6. //
  7. // Description
  8. //
  9. //      Defines the class DoubleListElement.  Objects of this class may
  10. //      be part of lists which can be traversed in forward and reverse
  11. //      order.
  12. //
  13. // End ---------------------------------------------------------------------
  14.  
  15. // Interface Dependencies ---------------------------------------------------
  16.  
  17. #ifndef _DLSTELEM_H
  18. #define _DLSTELEM_H
  19.  
  20. #ifndef _IOSTREAM_H
  21. #include <iostream.h>
  22. #define _IOSTREAM_H
  23. #endif
  24.  
  25. #ifndef __CLSTYPES_H
  26. #include <clstypes.h>
  27. #endif
  28.  
  29. #ifndef __OBJECT_H
  30. #include <object.h>
  31. #endif
  32.  
  33. // End Interface Dependencies ------------------------------------------------
  34.  
  35. _CLASSDEF(DoubleListElement)
  36.  
  37. // Class //
  38.  
  39. class _CLASSTYPE DoubleListElement
  40. {
  41. public:
  42.     DoubleListElement( PObject o ) { data = o; next = previous = 0; }
  43.     ~DoubleListElement() { delete data; }
  44.  
  45. private:
  46.     PDoubleListElement next;
  47.     PDoubleListElement previous;
  48.     PObject data;
  49.     friend class _CLASSTYPE DoubleList;
  50.     friend class _CLASSTYPE DoubleListIterator;
  51. };
  52.  
  53. // Description -------------------------------------------------------------
  54. //
  55. //         Defines the abstract class DoubleListElement.
  56. //
  57. // Constructor
  58. //
  59. //         DoubleListElement
  60. //
  61. //         Constructor based on ListElement constructor which makes a
  62. //         list element from an object reference.
  63. //
  64. // Destructor
  65. //
  66. //      ~DoubleListElement
  67. //
  68. //      We delete the data.
  69. //
  70. //
  71. // Private Members
  72. //
  73. //      next
  74. //
  75. //      The next double list element.
  76. //
  77. //      previous
  78. //
  79. //      The previous double list element.
  80. //
  81. //      data
  82. //
  83. //      Pointer to the double list element's data.
  84. //
  85. // Friends
  86. //
  87. //         class DoubleList
  88. //
  89. //         class DoubleListIterator
  90. //
  91. // End ---------------------------------------------------------------------
  92.  
  93.  
  94. #endif // ifndef _DLSTELEM_H //
  95.  
  96.