home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / OTHERUTI / TCPP30-1.ZIP / CLASSINC.ZIP / STACK.H < prev    next >
C/C++ Source or Header  |  1992-02-18  |  3KB  |  102 lines

  1. /*------------------------------------------------------------------------*/
  2. /*                                                                        */
  3. /*  STACK.H                                                               */
  4. /*                                                                        */
  5. /*  Copyright Borland International 1991                                  */
  6. /*  All Rights Reserved                                                   */
  7. /*                                                                        */
  8. /*------------------------------------------------------------------------*/
  9.  
  10. #if !defined( __STACK_H )
  11. #define __STACK_H
  12.  
  13. #if defined( TEMPLATES )
  14.  
  15.     #if !defined( __STACKS_H )
  16.     #include <Stacks.h>
  17.     #endif  // __STACKS_H
  18.  
  19.     #define Stack   BI_TCStackAsList
  20.     #define PStack  PBI_TCStackAsList
  21.     #define RStack  RBI_TCStackAsList
  22.     #define RPStack RPBI_TCStackAsList
  23.     #define PCStack PCBI_TCStackAsList
  24.     #define RCStack RCBI_TCStackAsList
  25.  
  26.     _CLASSDEF( BI_TCStackAsList )
  27.  
  28.     #define StackIterator   BI_TCStackAsListIterator
  29.     #define PStackIterator  PBI_TCStackAsListIterator
  30.     #define RStackIterator  RBI_TCStackAsListIterator
  31.     #define RPStackIterator RPBI_TCStackAsListIterator
  32.     #define PCStackIterator PCBI_TCStackAsListIterator
  33.     #define RCStackIterator RCBI_TCStackAsListIterator
  34.  
  35.     _CLASSDEF( BI_TCStackAsListIterator )
  36.  
  37. #else   // TEMPLATES
  38.  
  39.     #if !defined( __CLSTYPES_H )
  40.     #include <ClsTypes.h>
  41.     #endif  // __CLSTYPES_H
  42.  
  43.     #if !defined( __CONTAIN_H )
  44.     #include <Contain.h>
  45.     #endif  // __CONTAIN_H
  46.  
  47.     #if !defined( __LIST_H )
  48.     #include <List.h>
  49.     #endif  // __LIST_H
  50.  
  51.     _CLASSDEF(Stack)
  52.  
  53.     class _CLASSTYPE Stack : public Container
  54.     {
  55.  
  56.     public:
  57.  
  58.         void push( Object _FAR & );
  59.         Object _FAR & pop();
  60.         Object _FAR & top() const
  61.             {
  62.             return theStack.peekHead();
  63.             }
  64.  
  65.         virtual int isEmpty() const
  66.             {
  67.             return theStack.isEmpty();
  68.             }
  69.  
  70.         virtual countType getItemsInContainer() const
  71.             {
  72.             return theStack.getItemsInContainer();
  73.             }
  74.  
  75.         virtual void flush( DeleteType dt = DefDelete )
  76.             {
  77.             theStack.flush( dt );
  78.             }
  79.  
  80.         virtual ContainerIterator _FAR & initIterator() const;
  81.  
  82.         virtual classType isA() const
  83.             {
  84.             return stackClass;
  85.             }
  86.  
  87.         virtual char _FAR *nameOf() const
  88.             {
  89.             return "Stack";
  90.             }
  91.  
  92.     private:
  93.  
  94.         List theStack;
  95.  
  96.     };
  97.  
  98. #endif  // TEMPLATES
  99.  
  100. #endif  // __STACK_H
  101.  
  102.