home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / ioc / lancelot / lentry.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  3.4 KB  |  91 lines

  1. /******************************************************************************
  2. * .FILE:         lentry.hpp                                                   *
  3. *                                                                             *
  4. * .DESCRIPTION:  Lancelot Sample Program:              Class Definition       *
  5. *                                                                             *
  6. * .CLASSES:      Entry                                                        *
  7. *                                                                             *
  8. * .COPYRIGHT:                                                                 *
  9. *    Licensed Material - Program-Property of IBM                              *
  10. *    (C) Copyright IBM Corp. 1992, 1996 - All Rights Reserved                 *
  11. *                                                                             *
  12. * .DISCLAIMER:                                                                *
  13. *   The following [enclosed] code is sample code created by IBM               *
  14. *   Corporation.  This sample code is not part of any standard IBM product    *
  15. *   and is provided to you solely for the purpose of assisting you in the     *
  16. *   development of your applications.  The code is provided 'AS IS',          *
  17. *   without warranty of any kind.  IBM shall not be liable for any damages    *
  18. *   arising out of your use of the sample code, even if they have been        *
  19. *   advised of the possibility of such damages.                               *
  20. *                                                                             *
  21. * .NOTE: WE RECOMMEND USING A FIXED SPACE FONT TO LOOK AT THE SOURCE          *
  22. *                                                                             *
  23. ******************************************************************************/
  24. #ifndef _LENTRY_
  25. #define _LENTRY_
  26.  
  27. #include <iostream.h>
  28.                                 // Definition of Boolean:
  29. #include <istring.hpp>
  30. #include <iglobals.h>
  31.  
  32. #include "lancelot.h"
  33.  
  34.  
  35. //----------------------------------------------------------------------------
  36. // class Entry
  37. //----------------------------------------------------------------------------
  38. class Entry : public IBase {
  39.  
  40. public: // ---------------------- PUBLIC -------------------------------------
  41.  
  42.   Entry (char *atxt)  { init(atxt); };
  43.   ~Entry () { };
  44.  
  45.      // another Entry copy
  46. inline  Entry (Entry const& aTS)  { init(aTS.txt); };
  47.  
  48. inline  Entry& operator= (Entry const& aTS)  {
  49.         if (& aTS != this)  {
  50.            // deInit();
  51.            init(aTS.txt);
  52.         }
  53.         return *this;
  54.         };
  55.  
  56.  
  57. inline Boolean operator== (Entry const& aTS) const  {
  58.                             return txt==aTS.txt;
  59.                            };
  60.  
  61. inline Boolean operator== (char* acp) const  {
  62.         return txt==acp;
  63.        };
  64.  
  65. inline Boolean operator!= (Entry const& aTS) const  {
  66.         return strcmp(txt, aTS.txt) != 0;
  67.      };
  68.  
  69. inline IString text() const {return txt;};
  70.  
  71. friend ostream& operator<< (ostream& os, Entry const& aTS) {
  72.         return os << aTS.txt;
  73.      };
  74.  
  75. protected: // ---------------------- PROTECTED ----------------------------------
  76.  
  77. inline Entry& init (char* const& atxt)  {
  78.        txt = atxt;
  79.        return *this;
  80.     };
  81.  
  82.  
  83. private: // ---------------------- PRIVATE ----------------------------------
  84.  
  85. IString
  86.   txt;
  87.  
  88.  
  89. };
  90. #endif
  91.