home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / VISBUILD / RAPSHEET / CPPOV23 / IPERSON.HPP < prev    next >
Text File  |  1995-05-15  |  8KB  |  193 lines

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