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

  1. #ifndef _IPERSON_
  2. #define _IPERSON_
  3. /******************************************************************************
  4. * .FILE:        iperson.hpp                                                   *
  5. *                                                                             *
  6. * .DESCRIPTION: Header file for the class IPerson                             *
  7. *                                                                             *
  8. * .CLASSES:     IPerson                                                       *
  9. *                                                                             *
  10. * .COPYRIGHT:                                                                 *
  11. *    Licensed Material - Program-Property of IBM                              *
  12. *    (C) Copyright IBM Corp. 1992, 1996 - All Rights Reserved                 *
  13. *                                                                             *
  14. * .DISCLAIMER:                                                                *
  15. *   The following [enclosed] code is sample code created by IBM               *
  16. *   Corporation.  This sample code is not part of any standard IBM product    *
  17. *   and is provided to you solely for the purpose of assisting you in the     *
  18. *   development of your applications.  The code is provided 'AS IS',          *
  19. *   without warranty of any kind.  IBM shall not be liable for any damages    *
  20. *   arising out of your use of the sample code, even if they have been        *
  21. *   advised of the possibility of such damages.                               *
  22. *                                                                             *
  23. * .NOTE: WE RECOMMEND USING A FIXED SPACE FONT TO LOOK AT THE SOURCE          *
  24. *                                                                             *
  25. ******************************************************************************/
  26. #include "ivbsamps.h"
  27. #include <istdntfy.hpp>
  28. #include <istring.hpp>
  29. #include <ivseq.h>
  30. #include <iadd.hpp>
  31. #include "ialias.hpp"
  32.  
  33. /*----------------------------------------------------------------------------*/
  34. /* Align classes on four byte boundary.                                       */
  35. /*----------------------------------------------------------------------------*/
  36. #pragma pack(4)
  37.  
  38. //**************************************************************************
  39. // Class:   IPerson
  40. //
  41. // Purpose:
  42. //
  43. //**************************************************************************
  44. class IVBSAMP_IMPORT IPerson : public IStandardNotifier {
  45.  
  46. /*--------------------------- PUBLIC -----------------------------------------*/
  47. public:
  48.  
  49. /*------------------------- Constructors/Destructor ----------------------------
  50. ------------------------------------------------------------------------------*/
  51.   IPerson ();
  52.   IPerson (const IPerson & partCopy);
  53. virtual
  54.   ~IPerson ();
  55.  
  56. /*---------------------  ENUMERATED TYPES  ------------------------
  57.  *-----------------------------------------------------------------*/
  58. enum IEyeColor  {blue_eyes,                 //0
  59.                  brown_eyes,                //1
  60.                  green_eyes,                //2
  61.                  hazel_eyes};               //3
  62. enum IGender    {female,                    //0
  63.                  male};                     //1
  64. enum IHairColor {no_hair,                   //0
  65.                  black_hair,                //1
  66.                  blonde_hair,               //2
  67.                  brown_hair,                //3
  68.                  grey_hair,                 //4
  69.                  red_hair};                 //5
  70.  
  71. /*-------------------------------- Operators -----------------------------------
  72. ------------------------------------------------------------------------------*/
  73.   IPerson & operator= (const IPerson & aPerson);
  74.  
  75.   Boolean
  76.     operator == (const IPerson & value) const,
  77.     operator != (const IPerson & value) const,
  78.     operator == (const IPerson * value) const,
  79.     operator != (const IPerson * value) const;
  80.  
  81.   virtual IString asString () const;
  82.   virtual IString asDebugInfo () const;
  83.  
  84.  
  85. /*-------------------------------- Attributes ----------------------------------
  86.  | The following are attributes for this class:
  87.  |    address                    - address of the person
  88.  |    aliasList                  - list of aliases/nicknames the person is known by
  89.  |    birthDate                  - the date the person was born
  90.  |    eyeColor                   - the color of the person's eyes (as an enum value)
  91.  |    eyeColorAsString           - the color of the person's eyes (as an IString)
  92.  |    firstName                  - the person's first name
  93.  |    gender                     - the gender/sex of the person
  94.  |    hairColor                  - the color of the person's hair (as an enum value)
  95.  |    hairColorAsString          - the color of the person's hair (as an IString)
  96.  |    height                     - the person's height (in inches)
  97.  |    heightAsString             - the person's height (in inches) (as an IString)
  98.  |    info                       - a description of the person
  99.  |    isMale                     - the gender/sex of the person (as a Boolean)
  100.  |    lastName                   - the person's last name
  101.  |    weight                     - the person's weight (in pounds)
  102.  |    weightAsString             - the person's weight (in pounds) (as an IString)
  103.  -----------------------------------------------------------------------------*/
  104.   virtual IAddress * address() const;
  105.   virtual IPerson & setAddress(IAddress * aAddress);
  106.  
  107.   virtual IVSequence<IAlias *> * aliasList() const;
  108.   virtual IPerson & setAliasList(IVSequence<IAlias *> * aAliasList);
  109.  
  110.   virtual IString birthDate() const;
  111.   virtual IPerson & setBirthDate(const IString & aBirthDate);
  112.  
  113.   virtual IString eyeColorAsString() const;
  114.   virtual IPerson & setEyeColorAsString(const IString & aEyeColor);
  115.  
  116.   virtual unsigned short eyeColor() const;
  117.   virtual IPerson & setEyeColor(const unsigned short aEyeColor);
  118.  
  119.   virtual IString firstName() const;
  120.   virtual IPerson & setFirstName(const IString & aFirstName);
  121.  
  122.   virtual unsigned short gender() const;
  123.   virtual IPerson & setGender(const unsigned short aGender);
  124.  
  125.   virtual IString hairColorAsString() const;
  126.   virtual IPerson & setHairColorAsString(const IString & aHairColor);
  127.  
  128.   virtual unsigned short hairColor() const;
  129.   virtual IPerson & setHairColor(const unsigned short aHairColor);
  130.  
  131.   virtual IString heightAsString() const;
  132.   virtual IPerson & setHeightAsString(const IString & aHeight);
  133.  
  134.   virtual unsigned short height() const;
  135.   virtual IPerson & setHeight(const unsigned short aHeight);
  136.  
  137.   virtual IString info() const;
  138.   virtual IPerson & setInfo(const IString & aInfo);
  139.  
  140.   virtual Boolean isMale() const;
  141.   virtual IPerson & enableIsMale(Boolean aMale = true);
  142.  
  143.   virtual IString lastName() const;
  144.   virtual IPerson & setLastName(const IString & aLastName);
  145.  
  146.   virtual IString weightAsString() const;
  147.   virtual IPerson & setWeightAsString(const IString & aWeight);
  148.  
  149.   virtual unsigned short weight() const;
  150.   virtual IPerson & setWeight(const unsigned short aWeight);
  151.  
  152.  
  153. /*----------------------- Notification Event Ids -------------------------------
  154. ------------------------------------------------------------------------------*/
  155.   static INotificationId addressId;
  156.   static INotificationId aliasListId;
  157.   static INotificationId birthDateId;
  158.   static INotificationId eyeColorId;
  159.   static INotificationId firstNameId;
  160.   static INotificationId genderId;
  161.   static INotificationId hairColorId;
  162.   static INotificationId heightId;
  163.   static INotificationId infoId;
  164.   static INotificationId lastNameId;
  165.   static INotificationId weightId;
  166.  
  167.  
  168. /*--------------------------- PRIVATE ----------------------------------------*/
  169. private:
  170.   unsigned short iEyeColor;
  171.   unsigned short iGender;
  172.   unsigned short iHairColor;
  173.   unsigned short iHeight;
  174.   unsigned short iWeight;
  175.   IString iBirthDate;
  176.   IString iFirstName;
  177.   IString iLastName;
  178.   IString iInfo;
  179.   IVSequence<IAlias *> *iAliasList;
  180.   IAddress *iAddress;
  181.  
  182. };   //IPerson
  183.  
  184. /*----------------------------------------------------------------------------*/
  185. /* Resume compiler default packing.                                           */
  186. /*----------------------------------------------------------------------------*/
  187. #pragma pack()
  188.  
  189. #endif
  190.