home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / visbuild / rapsheet / cppwv23 / ialias.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-08  |  5.1 KB  |  128 lines

  1. /******************************************************************************
  2. * .FILE:        ialias.cpp                                                    *
  3. *                                                                             *
  4. * .DESCRIPTION: Implementation for the class, IAlias                          *
  5. *                                                                             *
  6. * .CLASSES:     IAlias                                                        *
  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. #include "IAlias.hpp"
  25. #include <inotifev.hpp>
  26. #include <itrace.hpp>
  27.  
  28. /****************************************************************************
  29.  * Constructors
  30.  ****************************************************************************/
  31. IAlias :: IAlias() :
  32.     dAlias("")
  33. {
  34. }
  35.  
  36. /****************************************************************************
  37.  * Destructor
  38.  ****************************************************************************/
  39. IAlias :: ~IAlias()
  40. {
  41.   IFUNCTRACE_DEVELOP();
  42.   ITRACE_DEVELOP("About to destruct alias: " + dAlias);
  43. }
  44.  
  45.  
  46. /****************************************************************************
  47.  * Events
  48.  ****************************************************************************/
  49. INotificationId IAlias :: aliasId = "IAlias::alias";
  50.  
  51.  
  52. /****************************************************************************
  53.  * Attribute Access Member Functions
  54.  ****************************************************************************/
  55. /*------------------------------------------------------------------
  56.  * alias
  57.  *-----------------------------------------------------------------*/
  58. IString IAlias :: alias() const
  59. {
  60.   return dAlias;
  61. }
  62.  
  63. IAlias &  IAlias ::
  64.   setAlias(const IString & iAlias)
  65. {
  66.   if (dAlias != iAlias)
  67.   {
  68.      dAlias = iAlias;
  69.      notifyObservers(INotificationEvent(aliasId, *this, true,
  70.                                         IEventData((char *)iAlias)));
  71.   }
  72.   else
  73.      notifyObservers(INotificationEvent(aliasId, *this, false));
  74.   return *this;
  75. }
  76.  
  77.  
  78. /****************************************************************************
  79.  * Action Member Functions
  80.  ****************************************************************************/
  81. /*------------------------------------------------------------------
  82.  * asString()
  83.  *-----------------------------------------------------------------*/
  84. IString  IAlias :: asString() const
  85. {
  86.   return alias();
  87. }
  88.  
  89.  
  90. /****************************************************************************
  91.  * Operators
  92.  ****************************************************************************/
  93. /*------------------------------------------------------------------
  94.  * Operator == (const IAlias & value)
  95.  *-----------------------------------------------------------------*/
  96. Boolean IAlias::operator ==(const IAlias & value) const
  97. {
  98.   if (alias() != value.alias()) return false;
  99.   return true;
  100. }
  101.  
  102. /*------------------------------------------------------------------
  103.  * Operator == (const IAlias * value)
  104.  *-----------------------------------------------------------------*/
  105. Boolean IAlias::operator == (const IAlias * value) const
  106. {
  107.   if (alias() != value->alias()) return false;
  108.   return true;
  109. }
  110.  
  111. /*------------------------------------------------------------------
  112.  * Operator != (const IAlias & value)
  113.  *-----------------------------------------------------------------*/
  114. Boolean IAlias::operator != (const IAlias & value) const
  115. {
  116.   if (alias() != value.alias()) return true;
  117.   return false;
  118. }
  119.  
  120. /*------------------------------------------------------------------
  121.  * Operator != (const IAlias * value)
  122.  *-----------------------------------------------------------------*/
  123. Boolean IAlias::operator != (const IAlias * value) const
  124. {
  125.   if (alias() != value->alias()) return true;
  126.   return false;
  127. }
  128.