home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / IOC / LANCELOT / LENTRY.HPP < prev    next >
C/C++ Source or Header  |  1995-04-01  |  3KB  |  85 lines

  1. /*******************************************************************************
  2. * FILE NAME: lentry.hpp                                                        *
  3. *                                                                              *
  4. * DESCRIPTION:                                                                 *
  5. *                                                                              *
  6. * Class                                                                        *
  7. *   Entry                                                                      *
  8. *                                                                              *
  9. * COPYRIGHT:                                                                   *
  10. *   Licensed Materials - Property of IBM                                       *
  11. *   (C) Copyright IBM Corporation 1992, 1995                                   *
  12. *   All Rights Reserved                                                        *
  13. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  14. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  15. *                                                                              *
  16. * CHANGE HISTORY:                                                              *
  17. *******************************************************************************/
  18. #ifndef _LENTRY_
  19. #define _LENTRY_
  20.  
  21. #include <iostream.h>
  22.                                 // Definition of Boolean:
  23. #include <istring.hpp>
  24. #include <iglobals.h>
  25.  
  26. #include "lancelot.h"
  27.  
  28.  
  29. //----------------------------------------------------------------------------
  30. // class Entry
  31. //----------------------------------------------------------------------------
  32. class Entry : public IBase {
  33.  
  34. public: // ---------------------- PUBLIC -------------------------------------
  35.  
  36.   Entry (char *atxt)  { init(atxt); };
  37.   ~Entry () { };
  38.  
  39.      // another Entry copy
  40. inline  Entry (Entry const& aTS)  { init(aTS.txt); };
  41.  
  42. inline  Entry& operator= (Entry const& aTS)  {
  43.         if (& aTS != this)  {
  44.            // deInit();
  45.            init(aTS.txt);
  46.         }
  47.         return *this;
  48.         };
  49.  
  50.  
  51. inline Boolean operator== (Entry const& aTS) const  {
  52.                             return txt==aTS.txt;
  53.                            };
  54.  
  55. inline Boolean operator== (char* acp) const  {
  56.         return txt==acp;
  57.        };
  58.  
  59. inline Boolean operator!= (Entry const& aTS) const  {
  60.         return strcmp(txt, aTS.txt) != 0;
  61.      };
  62.  
  63. inline IString text() const {return txt;};
  64.  
  65. friend ostream& operator<< (ostream& os, Entry const& aTS) {
  66.         return os << aTS.txt;
  67.      };
  68.  
  69. protected: // ---------------------- PROTECTED ----------------------------------
  70.  
  71. inline Entry& init (char* const& atxt)  {
  72.        txt = atxt;
  73.        return *this;
  74.     };
  75.  
  76.  
  77. private: // ---------------------- PRIVATE ----------------------------------
  78.  
  79. IString
  80.   txt;
  81.  
  82.  
  83. };
  84. #endif
  85.