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

  1. #ifndef _IVBLONG_
  2.   #define _IVBLONG_
  3. /*******************************************************************************
  4. * FILE NAME: ivblong.hpp                                                       *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *    IVBLongPart - IBM VB sample Long 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 IVBLongPart : public IVBDataTypePart
  67. {
  68. typedef IVBDataTypePart
  69.   Inherited;
  70. public:
  71. /*--------------------------- PUBLIC -----------------------------------------*/
  72.  
  73. /*------------------------- Constructors/Destructor ----------------------------
  74. ------------------------------------------------------------------------------*/
  75.   IVBLongPart (long value = 0);
  76.   IVBLongPart (const IVBLongPart& partCopy);
  77. virtual
  78.   ~IVBLongPart ();
  79.  
  80. /*-------------------------------- Operators -----------------------------------
  81. |   operator ==       - Operator == (return true if equal).                    |
  82. |   operator !=       - Operator != (return true if not equal).                |
  83. ------------------------------------------------------------------------------*/
  84.   IVBLongPart& operator= (const IVBLongPart& aIVBLongPart);
  85. Boolean
  86.   operator == (const IVBLongPart& aValue) const,
  87.   operator != (const IVBLongPart& aValue) const,
  88.   operator == (const IVBLongPart* aValue) const,
  89.   operator != (const IVBLongPart* 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 (long) attribute.                      |
  98. |   valueAsText       - Query the valueAsText (IString) attribute.             |
  99. |   valueAs1Based     - Query the valueAs1Based (long) attribute.              |
  100. |   defaultValue      - Query the defaultValue (long) attribute.               |
  101. |   isValueEqualDefault - Query the valueEqualDefault (Boolean) attribute.     |
  102. |   isValueNotEqualDefault - Query the valueNotEqualDefault (Boolean) attribute. |
  103. |   lowLimit          - Query the lowLimit (long) attribute.                   |
  104. |   highLimit         - Query the highLimit (long) 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. |   isValuePositive   - Query the valuePositive (Boolean) attribute.           |
  114. |   isValueNegative   - Query the valueNegative (Boolean) attribute.           |
  115. |   setValue          - Set the value (long) attribute.                        |
  116. |   setValueAsText    - Set the valueAsText (IString) attribute.               |
  117. |   setValueAs1Based  - Set the valueAs1Based (long) attribute.                |
  118. |   setDefaultValue   - Set the defaultValue (long) attribute.                 |
  119. |   setLowLimit       - Set the lowLimit (long) attribute.                     |
  120. |   setHighLimit      - Set the highLimit (long) attribute.                    |
  121. ------------------------------------------------------------------------------*/
  122.  
  123. virtual long
  124.   value () const;
  125. virtual IVBLongPart
  126.  &setValue (long aValue),
  127.  &setValue ();
  128.  
  129. virtual IString
  130.   valueAsText () const;
  131. virtual IVBLongPart
  132.  &setValueAsText (const IString& valueAsText),
  133.  &setValueAsText (const IString* valueAsText);
  134.  
  135. virtual long
  136.   valueAs1Based () const;
  137. virtual IVBLongPart
  138.  &setValueAs1Based (long valueAs1Based);
  139.  
  140. virtual long
  141.   defaultValue () const;
  142. virtual IVBLongPart
  143.  &setDefaultValue (long defaultValue = 0);
  144.  
  145. virtual Boolean
  146.   isValueEqualDefault () const;
  147.  
  148. virtual Boolean
  149.   isValueNotEqualDefault () const;
  150.  
  151. virtual long
  152.   lowLimit () const;
  153. virtual IVBLongPart
  154.  &setLowLimit (long aLowLimit = LONG_MIN);
  155.  
  156. virtual long
  157.   highLimit () const;
  158. virtual IVBLongPart
  159.  &setHighLimit (long highLimit = LONG_MAX);
  160.  
  161. virtual Boolean
  162.   isValueEqualLowLimit () const;
  163.  
  164. virtual Boolean
  165.   isValueEqualHighLimit () const;
  166.  
  167. virtual Boolean
  168.   isValueBelowLowLimit () const;
  169.  
  170. virtual Boolean
  171.   isValueAboveHighLimit () const;
  172.  
  173. virtual Boolean
  174.   isValueOutsideLimits () const;
  175.  
  176. virtual Boolean
  177.   isValueWithinLimits () const;
  178.  
  179. virtual Boolean
  180.   isValueNotZero () const;
  181.  
  182. virtual Boolean
  183.   isValueZero () const;
  184.  
  185. virtual Boolean
  186.   isValuePositive () const;
  187.  
  188. virtual Boolean
  189.   isValueNegative () const;
  190.  
  191. /*-------------------------------- Actions -------------------------------------
  192. | List of operations or services provided by this class:                       |
  193. |                                                                              |
  194. |   assignValueToZero               - Assign value attribute to 0 (false). |
  195. |   assignValueToOne                - Assign value attribute to 1 (true).      |
  196. |   assignValueToLowLimit           - Assign value attribute to low limit. |
  197. |   assignValueToHighLimit          - Assign value attribute to high limit |
  198. |   assignValueToDefault            - Assign the value attribute to false. |
  199. |   assignValueToRandom             - Assign value to pseudo-random number |
  200. |   copyValueToDefault              - Copy value to default value.             |
  201. |   squareValue                     - Square the value attribute.              |
  202. |   andValue                        - Perform and operator on value.           |
  203. |   orValue                         - Perform or operator on value.            |
  204. |   addValue                        - Perform add operator on value.           |
  205. |   subractValue                    - Perform subract operator on value.       |
  206. |   divideValue                     - Perform divide operator on value.        |
  207. |   multiplyValue                   - Perform multiply operator on value.      |
  208. ------------------------------------------------------------------------------*/
  209.  
  210. virtual IVBLongPart
  211.  &assignValueToZero (),
  212.  &assignValueToOne (),
  213.  &assignValueToLowLimit (),
  214.  &assignValueToHighLimit (),
  215.  &assignValueToDefault (),
  216.  &assignValueToRandom (),
  217.  ©ValueToDefault (),
  218.  &squareValue (),
  219.  &andValue (long andValue = 1),
  220.  &orValue (long orValue = 1),
  221.  &addValue (long addValue = 1),
  222.  &subtractValue (long subtractValue = 1),
  223.  &multiplyValue (long multiplyValue = 2),
  224.  ÷Value (long divideValue = 2);
  225.  
  226. /*----------------------- Notification Event Descriptions ----------------------
  227. | List of attribute and event notification identifiers:                        |
  228. |                                                                              |
  229. ------------------------------------------------------------------------------*/
  230.  
  231.  
  232. private:
  233. /*--------------------------- PRIVATE ----------------------------------------*/
  234.   long iValue;                          //Data member for value attribute
  235.   long iDefaultValue;                   //Data member for defaultValue attribute
  236.   long iLowLimit;                       //Data member for lowLimit attribute
  237.   long iHighLimit;                      //Data member for highLimit attribute
  238. };
  239.  
  240. /*----------------------------------------------------------------------------*/
  241. /* Resume compiler default packing.                                           */
  242. /*----------------------------------------------------------------------------*/
  243. #pragma pack()
  244.  
  245. #endif
  246.