home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 2.ddi / TVDEMOS.ZIP / DATACOLL.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  2.0 KB  |  90 lines

  1. /*-------------------------------------------------------*/
  2. /*                                                       */
  3. /*   Turbo Vision 1.0                                    */
  4. /*   Turbo Vision Forms Demo                             */
  5. /*   Copyright (c) 1991 by Borland International         */
  6. /*                                                       */
  7. /*   Datacoll.h: Header file for Datacoll.cpp            */
  8. /*               (Support header file for TVFORMS Demo)  */
  9. /*-------------------------------------------------------*/
  10.  
  11. #if !defined( __DATACOLL_H )
  12. #define __DATACOLL_H
  13.  
  14. #define Uses_TStringCollection
  15. #define Uses_TStreamable
  16. #include <tv.h>
  17.  
  18. enum KeyTypes {stringKey, longIntKey};
  19.  
  20. class TDataCollection : public TStringCollection
  21. {
  22.  
  23. public:
  24.  
  25.     TDataCollection( int, int, int , KeyTypes );
  26.     virtual int compare( void *, void * );
  27.     virtual void error( int code );
  28.     virtual void freeItem( void * );
  29.     virtual void setLimit( int );
  30.  
  31. protected:
  32.  
  33.     TDataCollection( StreamableInit) : TStringCollection( streamableInit ) {};
  34.     virtual void write( opstream& );
  35.     virtual void *read( ipstream& );
  36.  
  37. private:
  38.  
  39.     virtual const char *streamableName() const
  40.         { return name; }
  41.     virtual void *readItem( ipstream& );
  42.     virtual void writeItem( void *, opstream& );
  43.  
  44. public:
  45.  
  46.     static const char * const name;
  47.     unsigned int itemSize;
  48.     KeyTypes  keyType;
  49.     int status;
  50.     static TStreamable *build();
  51.  
  52. };
  53.  
  54. inline ipstream& operator >> ( ipstream& is, TDataCollection& cl )
  55.     { return is >> (TStreamable&)cl; }
  56. inline ipstream& operator >> ( ipstream& is, TDataCollection*& cl )
  57.     { return is >> (void *&)cl; }
  58. inline opstream& operator << ( opstream& os, TDataCollection& cl )
  59.     { return os << (TStreamable&)cl; }
  60. inline opstream& operator << ( opstream& os, TDataCollection* cl )
  61.     { return os << (TStreamable *)cl; }
  62.  
  63. #endif  // __DATACOLL_H
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.     
  90.