home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 035 / kwclass.zip / KDOBENT.HPP < prev    next >
C/C++ Source or Header  |  1994-04-18  |  1KB  |  66 lines

  1. #ifndef _KDOBENT_
  2. #define _KDOBENT_
  3.  
  4. #ifndef _KDATA_
  5.    #include <kdata.hpp>
  6. #endif
  7.  
  8. #ifndef _IRESLOCK_
  9.    #include <ireslock.hpp>
  10. #endif
  11.  
  12. #ifndef _KDOBMGR_
  13.    #include <kdobmgr.hpp>
  14. #endif
  15.  
  16.  
  17. struct KDobEntry 
  18. {
  19.    KDobEntry(KDataFactory const &fct) 
  20.      : factory(&fct)
  21.      , data(factory->makeDataObject()) 
  22.    {
  23.    }
  24.   
  25.    KDobEntry(KDobEntry const ©) 
  26.      : factory(copy.factory)
  27.      , data(factory->cloneDataObject(copy.data)) 
  28.    {
  29.    }
  30.  
  31.    ~KDobEntry()
  32.    {
  33.       delete data;
  34.    }
  35.  
  36.    KDobEntry &operator =(KDobEntry const ©) 
  37.    { 
  38.       factory = copy.factory;
  39.       delete data;
  40.       data = factory->cloneDataObject(copy.data);
  41.       return *this; 
  42.    }
  43.  
  44.    Boolean operator <(KDobEntry const &other)
  45.    { 
  46.       return factory->name() < other.factory->name(); 
  47.    }   
  48.  
  49.    Boolean operator ==(KDobEntry const &other) 
  50.    { 
  51.       return factory->name() == other.factory->name(); 
  52.    }
  53.  
  54.    KDataFactory const *factory;
  55.    KData              *data;
  56.    IPrivateResource   lock;
  57.  
  58. };
  59.  
  60. typedef KDobEntry *KDobEntryPtr;
  61.  
  62. IString const &key(KDobEntryPtr const &entry);
  63.  
  64. #endif
  65.  
  66.