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

  1. #ifndef _IVBUSHRT_
  2.   #define _IVBUSHRT_
  3. /*******************************************************************************
  4. * FILE NAME: ivbushrt.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class:                                                  *
  8. *    IVBUnsignedShortPart - IBM VB sample Unsigned Short 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.  
  29. #ifndef _IVBDTYPE_
  30.   #include <ivbdtype.hpp>
  31. #endif
  32.  
  33. #ifndef __limits_h
  34.   #include <limits.h>
  35. #endif
  36.  
  37. #ifndef _ISTRING_
  38.   #include <istring.hpp>
  39. #endif
  40.  
  41.  
  42. /*-------------------------- Pragma Library Support --------------------------*/
  43. #ifndef __NO_DEFAULT_LIBS__
  44.   #ifdef __OS2__
  45.     #ifdef __IMPORTLIB__
  46.        #pragma library("CPPOV03I.LIB")
  47.     #else
  48.        #pragma library("CPPOV03.LIB")
  49.     #endif
  50.   #endif
  51.   #ifdef __WINDOWS__
  52.     #ifdef __IMPORTLIB__
  53.        #pragma library("CPPWV03I.LIB")
  54.     #else
  55.        #pragma library("CPPWV03.LIB")
  56.     #endif
  57.   #endif
  58. #endif
  59.  
  60.  
  61. /*----------------------------------------------------------------------------*/
  62. /* Align classes on four byte boundary.                                       */
  63. /*----------------------------------------------------------------------------*/
  64. #pragma pack(4)
  65.  
  66. class IVBUnsignedShortPart : public IVBDataTypePart
  67. {
  68. typedef IVBDataTypePart
  69.   Inherited;
  70. public:
  71. /*--------------------------- PUBLIC -----------------------------------------*/
  72.  
  73. /*------------------------- Constructors -------------------------------------*/
  74.   IVBUnsignedShortPart ( unsigned short value = 0 );
  75.   IVBUnsignedShortPart ( const IVBUnsignedShortPart& partCopy );
  76. virtual
  77.  ~IVBUnsignedShortPart ( );
  78.  
  79. /*-------------------------------- Operators -----------------------------------
  80. |   operator ==       - Operator == (return true if equal).                    |
  81. |   operator !=       - Operator != (return true if not equal).                |
  82. ------------------------------------------------------------------------------*/
  83. IVBUnsignedShortPart
  84.  &operator=   ( const IVBUnsignedShortPart& aIVBUnsignedShortPart );
  85. Boolean
  86.   operator == ( const IVBUnsignedShortPart& aValue ) const,
  87.   operator != ( const IVBUnsignedShortPart& aValue ) const,
  88.   operator == ( const IVBUnsignedShortPart* aValue ) const,
  89.   operator != ( const IVBUnsignedShortPart* aValue ) const;
  90.  
  91. virtual IString
  92.   asString    ( ) const;
  93.  
  94. /*-------------------------------- Attributes ----------------------------------
  95. | List of query and set members functions for this class:                      |
  96. |                                                                              |
  97. |   value             - Query the value (unsigned short) attribute.             |
  98. |   valueAsText       - Query the valueAsText (IString) attribute.             |
  99. |   valueAs1Based     - Query the valueAs1Based (unsigned short) attribute.             |
  100. |   defaultValue      - Query the defaultValue (unsigned short) attribute.             |
  101. |   isValueEqualDefault - Query the valueEqualDefault (Boolean) attribute.     |
  102. |   isValueNotEqualDefault - Query the valueNotEqualDefault (Boolean) attribute. |
  103. |   lowLimit          - Query the lowLimit (unsigned short) attribute.             |
  104. |   highLimit         - Query the highLimit (unsigned short) attribute.             |
  105. |   isValueEqualLowLimit - Query the valueEqualLowLimit (Boolean) attribute.   |
  106. |   isValueEqualHighLimit - Query the valueEqualHighLimit (Boolean) attribute. |
  107. |   isValueBelowLowLimit - Query the valueBelowLowLimit (Boolean) attribute.   |
  108. |   isValueAboveHighLimit - Query the valueAboveHighLimit (Boolean) attribute. |
  109. |   isValueOutsideLimits - Query the valueOutsideLimits (Boolean) attribute.   |
  110. |   isValueWithinLimits - Query the valueWithinLimits (Boolean) attribute.     |
  111. |   isValueNotZero    - Query the valueNotZero (Boolean) attribute.            |
  112. |   isValueZero       - Query the valueZero (Boolean) attribute.               |
  113. |   setValue          - Set the value (unsigned short) attribute.               |
  114. |   setValueAsText    - Set the valueAsText (IString) attribute.               |
  115. |   setValueAs1Based  - Set the valueAs1Based (unsigned short) attribute.      |
  116. |   setDefaultValue   - Set the defaultValue (unsigned short) attribute.       |
  117. |   setLowLimit       - Set the lowLimit (unsigned short) attribute.               |
  118. |   setHighLimit      - Set the highLimit (unsigned short) attribute.          |
  119. ------------------------------------------------------------------------------*/
  120.  
  121. virtual unsigned short
  122.   value                  ( ) const;
  123. virtual IVBUnsignedShortPart
  124.  &setValue               ( unsigned short aValue ),
  125.  &setValue               ( );
  126.  
  127. virtual IString
  128.   valueAsText            ( ) const;
  129. virtual IVBUnsignedShortPart
  130.  &setValueAsText         ( const IString& valueAsText ),
  131.  &setValueAsText         ( const IString* valueAsText );
  132.  
  133. virtual unsigned short
  134.   valueAs1Based          ( ) const;
  135. virtual IVBUnsignedShortPart
  136.  &setValueAs1Based       ( unsigned short valueAs1Based );
  137.  
  138. virtual unsigned short
  139.   defaultValue           ( ) const;
  140. virtual IVBUnsignedShortPart
  141.  &setDefaultValue        ( unsigned short defaultValue = 0 );
  142.  
  143. virtual Boolean
  144.   isValueEqualDefault    ( ) const;
  145.  
  146. virtual Boolean
  147.   isValueNotEqualDefault ( ) const;
  148.  
  149. virtual unsigned short
  150.   lowLimit               ( ) const;
  151. virtual IVBUnsignedShortPart
  152.  &setLowLimit            ( unsigned short aLowLimit = 0 );
  153.  
  154. virtual unsigned short
  155.   highLimit              ( ) const;
  156. virtual IVBUnsignedShortPart
  157.  &setHighLimit           ( unsigned short highLimit = USHRT_MAX );
  158.  
  159. virtual Boolean
  160.   isValueEqualLowLimit   ( ) const;
  161.  
  162. virtual Boolean
  163.   isValueEqualHighLimit  ( ) const;
  164.  
  165. virtual Boolean
  166.   isValueBelowLowLimit   ( ) const;
  167.  
  168. virtual Boolean
  169.   isValueAboveHighLimit  ( ) const;
  170.  
  171. virtual Boolean
  172.   isValueOutsideLimits   ( ) const;
  173.  
  174. virtual Boolean
  175.   isValueWithinLimits    ( ) const;
  176.  
  177. virtual Boolean
  178.   isValueNotZero         ( ) const;
  179.  
  180. virtual Boolean
  181.   isValueZero            ( ) const;
  182.  
  183. /*-------------------------------- Actions -------------------------------------
  184. | List of operations or services provided by this class:                       |
  185. |                                                                              |
  186. |   assignValueToZero               - Assign value attribute to 0 (false). |
  187. |   assignValueToOne                - Assign value attribute to 1 (true).      |
  188. |   assignValueToLowLimit           - Assign value attribute to low limit. |
  189. |   assignValueToHighLimit          - Assign value attribute to high limit |
  190. |   assignValueToDefault            - Assign the value attribute to false. |
  191. |   assignValueToRandom             - Assign value to pseudo-random number |
  192. |   copyValueToDefault              - Copy value to default value.             |
  193. |   squareValue                     - Square the value attribute.              |
  194. |   andValue                        - Perform and operator on value.           |
  195. |   orValue                         - Perform or operator on value.            |
  196. |   addValue                        - Perform add operator on value.           |
  197. |   subractValue                    - Perform subract operator on value.       |
  198. |   divideValue                     - Perform divide operator on value.        |
  199. |   multiplyValue                   - Perform multiply operator on value.      |
  200. ------------------------------------------------------------------------------*/
  201.  
  202. virtual IVBUnsignedShortPart
  203.  &assignValueToZero      ( ),
  204.  &assignValueToOne       ( ),
  205.  &assignValueToLowLimit  ( ),
  206.  &assignValueToHighLimit ( ),
  207.  &assignValueToDefault   ( ),
  208.  &assignValueToRandom    ( ),
  209.  ©ValueToDefault     ( ),
  210.  &squareValue            ( ),
  211.  &andValue               ( unsigned short andValue      = 1 ),
  212.  &orValue                ( unsigned short orValue       = 1 ),
  213.  &addValue               ( unsigned short addValue      = 1 ),
  214.  &subtractValue          ( unsigned short subtractValue = 1 ),
  215.  &multiplyValue          ( unsigned short multiplyValue = 2 ),
  216.  ÷Value            ( unsigned short divideValue   = 2 );
  217.  
  218. /*----------------------- Notification Event Descriptions ----------------------
  219. | List of attribute and event notification identifiers:                        |
  220. |                                                                              |
  221. ------------------------------------------------------------------------------*/
  222.  
  223.  
  224. private:
  225. /*--------------------------- PRIVATE ----------------------------------------*/
  226.   unsigned short iValue;                //Data member for value attribute
  227.   unsigned short iDefaultValue;         //Data member for defaultValue attribute
  228.   unsigned short iLowLimit;             //Data member for lowLimit attribute
  229.   unsigned short iHighLimit;            //Data member for highLimit attribute
  230. };
  231.  
  232. /*----------------------------------------------------------------------------*/
  233. /* Resume compiler default packing.                                           */
  234. /*----------------------------------------------------------------------------*/
  235. #pragma pack()
  236.  
  237. #endif
  238.