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

  1. /*--------------------------------------------------------------*/
  2. /* filename -           trescoll.cpp                            */
  3. /*                                                              */
  4. /* function(s)                                                  */
  5. /*                      TResourceCollection member functions    */
  6. /*--------------------------------------------------------------*/
  7.  
  8. /*--------------------------------------------------------------*/
  9. /*                                                              */
  10. /*     Turbo Vision -  Version 1.0                              */
  11. /*                                                              */
  12. /*                                                              */
  13. /*     Copyright (c) 1991 by Borland International              */
  14. /*     All Rights Reserved.                                     */
  15. /*                                                              */
  16. /*--------------------------------------------------------------*/
  17.  
  18. #define Uses_TResourceCollection
  19. #define Uses_TResourceItem
  20. #include <tv.h>
  21.  
  22. TResourceCollection::TResourceCollection( short aLimit, short aDelta) :
  23.     TStringCollection( aLimit, aDelta)
  24. {
  25. }
  26.  
  27. void TResourceCollection::freeItem( void* item )
  28. {
  29.     delete ((TResourceItem*)item)->key; 
  30.     delete (TResourceItem*)item;
  31. }
  32.  
  33. void* TResourceCollection::keyOf( void* item ) 
  34. {
  35.     return ((TResourceItem *)item)->key;
  36.         
  37. TStreamable *TResourceCollection::build()
  38. {
  39.     return new TResourceCollection( streamableInit );
  40. }
  41.  
  42. void TResourceCollection::writeItem( void *obj, opstream& os )
  43. {
  44.    
  45.    os << ((TResourceItem *)obj)->pos;
  46.    os << ((TResourceItem *)obj)->size;
  47.    os.writeString(((TResourceItem *)obj)->key);
  48.  
  49. }
  50.  
  51. void *TResourceCollection::readItem( ipstream& is )
  52. {
  53.     TResourceItem *obj;
  54.  
  55.     obj = new TResourceItem;
  56.     is >> obj->pos;
  57.     is >> obj->size;
  58.     obj->key = is.readString();
  59.     return (void *)obj;
  60. }
  61.  
  62.       
  63.  
  64.