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

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