home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / icompany.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  8.9 KB  |  209 lines

  1. #ifndef _ICOMPANY_
  2.   #define _ICOMPANY_
  3. /*******************************************************************************
  4. * FILE NAME: icompany.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *    ICompany - IBM sample company part.                                       *
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   IBM(R) VisualAge(TM) for C++                                               *
  12. *   (C) Copyright International Business Machines Corporation 1991, 1996       *
  13. *   Licensed Material - Program-Property of IBM - All Rights Reserved.         *
  14. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  15. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  16. *                                                                              *
  17. *   This program will not run in DOS mode.                                     *
  18. *                                                                              *
  19. * DISCLAIMER OF WARRANTIES:                                                    *
  20. *   The following [enclosed] code is sample code created by IBM                *
  21. *   Corporation.  This sample code is not part of any standard IBM product     *
  22. *   and is provided to you solely for the purpose of assisting you in the      *
  23. *   development of your applications.  The code is provided "AS IS",           *
  24. *   without warranty of any kind.  IBM shall not be liable for any damages     *
  25. *   arising out of your use of the sample code, even if they have been         *
  26. *   advised of the possibility of such damages.                                *
  27. *******************************************************************************/
  28. #ifndef _IVBDEFS__
  29. #include <ivbdefs.h>
  30. #endif
  31.  
  32. #ifndef _ISTDNTFY_
  33.   #include <istdntfy.hpp>
  34. #endif
  35.  
  36. #ifndef _ISTRING_
  37.   #include <istring.hpp>
  38. #endif
  39.  
  40. #ifdef __WINDOWS__
  41. #ifndef _IPTR_H
  42.   #include <iptr.h>
  43. #endif
  44. #endif
  45.  
  46. #ifndef _IVSEQ_H
  47.   #include <ivseq.h>
  48. #endif
  49.  
  50. /*-------------------------- Pragma Library Support --------------------------*/
  51. #ifndef __NO_DEFAULT_LIBS__
  52.   #ifdef __OS2__
  53.     #ifdef __IMPORTLIB__
  54.        #pragma library("CPPOV03I.LIB")
  55.     #else
  56.        #pragma library("CPPOV03.LIB")
  57.     #endif
  58.   #endif
  59.   #ifdef __WINDOWS__
  60.     #ifdef __IMPORTLIB__
  61.        #pragma library("CPPWV03I.LIB")
  62.     #else
  63.        #pragma library("CPPWV03.LIB")
  64.     #endif
  65.   #endif
  66. #endif
  67.  
  68. class IAddress;
  69. class ICustomer;
  70. class IVSequence <ICustomer*>;
  71.  
  72. class ICompany;
  73.  
  74. typedef IElemPointer<ICompany>
  75.   ICompanyElemPtr;
  76.  
  77. typedef IMngElemPointer<ICompany>
  78.   ICompanyMngPtr;
  79.  
  80.  
  81. /*----------------------------------------------------------------------------*/
  82. /* Align classes on four byte boundary.                                       */
  83. /*----------------------------------------------------------------------------*/
  84. #pragma pack(4)
  85.  
  86. class ICompany : public IStandardNotifier
  87. {
  88. typedef IStandardNotifier
  89.   Inherited;
  90. public:
  91. /*--------------------------- PUBLIC -----------------------------------------*/
  92.  
  93. /*------------------------- Constructors/Destructor ----------------------------
  94. ------------------------------------------------------------------------------*/
  95.   ICompany ();
  96.   ICompany (const IString& aName);
  97.   ICompany (const ICompany& partCopy);
  98. virtual
  99.   ~ICompany ();
  100.  
  101. /*-------------------------------- Operators -----------------------------------
  102. |   operator ==       - Operator == (return true if equal).                    |
  103. |   operator !=       - Operator != (return true if not equal).                |
  104. ------------------------------------------------------------------------------*/
  105.   ICompany& operator= (const ICompany& aICompany);
  106. Boolean
  107.   operator == (const ICompany& aValue) const,
  108.   operator != (const ICompany& aValue) const,
  109.   operator == (const ICompany* aValue) const,
  110.   operator != (const ICompany* aValue) const,
  111.   operator < (const ICompany& aValue) const,
  112.   operator < (const ICompany* aValue) const,
  113.   operator < (ICompany* const& aValue) const,
  114.   operator < (ICompanyElemPtr const& aValue) const,
  115.   operator < (ICompanyMngPtr const& aValue) const;
  116.  
  117. virtual IString
  118.   asString    ( ) const;
  119.  
  120. /*-------------------------------- Attributes ----------------------------------
  121. | List of query and set members functions for this class:                      |
  122. |                                                                              |
  123. |   name              - Query the name (IString) attribute.                    |
  124. |   address           - Query the address (IAddress*) attribute.               |
  125. |   customerList      - Query the customerList (IVSequence <ICustomer*> *) attribute.             |
  126. |   phone             - Query the phone (IString) attribute.                   |
  127. |   setName           - Set the name (IString) attribute.                      |
  128. |   setAddress        - Set the address (IAddress*) attribute.                 |
  129. |   setCustomerList   - Set the customerList (IVSequence <ICustomer*> *) attribute. |
  130. |   addCustomer                - Perform the add customer action.              |
  131. |   removeCustomer             - Perform the remove customer action.           |
  132. |   setPhone          - Set the phone (IString) attribute.                     |
  133. ------------------------------------------------------------------------------*/
  134.  
  135. virtual IString
  136.   name () const;
  137. virtual ICompany
  138.  &setName (const IString& aName);
  139.  
  140. virtual IAddress*
  141.   address () const;
  142. virtual ICompany
  143.  &setAddress (IAddress* aAddress),
  144.  &setAddress (const IAddress& aAddress);
  145.  
  146. virtual IVSequence <ICustomer*> *
  147.   customerList () const;
  148. virtual ICompany
  149.  &setCustomerList (const IVSequence <ICustomer*>& aCustomerList),
  150.  &setCustomerList (IVSequence <ICustomer*>* aCustomerList),
  151.  &addCustomer (ICustomer* customer),
  152.  &addCustomer (const IString& name);
  153.  
  154. virtual IString
  155.   phone () const;
  156. virtual ICompany
  157.  &setPhone (const IString& aPhone);
  158.  
  159. /*-------------------------------- Actions -------------------------------------
  160. | List of operations or services provided by this class:                       |
  161. |                                                                              |
  162. |   setNameToDefault  - Perform the setNameToDefault action.                   |
  163. |   setAddressToDefault - Perform the setAddressToDefault action.              |
  164. |   setPhoneToDefault - Perform the setPhoneToDefault action.                  |
  165. |   setCustomerListToDefault - Perform the setCustomerListToDefault action.    |
  166. ------------------------------------------------------------------------------*/
  167. virtual ICompany
  168.   &setNameToDefault (),
  169.   &setAddressToDefault (),
  170.   &setPhoneToDefault (),
  171.   &setCustomerListToDefault ();
  172.  
  173. /*----------------------- Notification Event Descriptions ----------------------
  174. | List of attribute and event notification identifiers:                        |
  175. |                                                                              |
  176. |   nameId            - Notification ID provided to observers when the         |
  177. |                       name attribute changes.                                |
  178. |   addressId         - Notification ID provided to observers when the         |
  179. |                       address attribute changes.                             |
  180. |   customerListId    - Notification ID provided to observers when the         |
  181. |                       customerList attribute changes.                        |
  182. |   phoneId           - Notification ID provided to observers when the         |
  183. |                       phone attribute changes.                               |
  184. |  customerAddedId     - Notification event for when customer added to customer list. |
  185. ------------------------------------------------------------------------------*/
  186. static INotificationId const
  187.   IVB_IMPORT nameId,
  188.   IVB_IMPORT addressId,
  189.   IVB_IMPORT customerListId,
  190.   IVB_IMPORT phoneId;
  191.  
  192. static INotificationId const
  193.   IVB_IMPORT customerAddedId;
  194.  
  195. private:
  196. /*--------------------------- PRIVATE ----------------------------------------*/
  197.   IString iName;                        //Data member for name attribute
  198.   IAddress* iAddress;                   //Data member for address attribute
  199.   IVSequence <ICustomer*> * iCustomerList; //Data member for customerList attribute
  200.   IString iPhone;                       //Data member for phone attribute
  201. };
  202.  
  203. /*----------------------------------------------------------------------------*/
  204. /* Resume compiler default packing.                                           */
  205. /*----------------------------------------------------------------------------*/
  206. #pragma pack()
  207.  
  208. #endif
  209.