home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / visbuild / vbsample / ivbulong.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-16  |  37.5 KB  |  795 lines

  1. /*******************************************************************************
  2. * FILE NAME: ivbulong.cpp                                                      *
  3. *                                                                              *
  4. * DESCRIPTION:                                                                 *
  5. *   Class implementation of the class(es):                                     *
  6. *    IVBUnsignedLongPart - IBM VB sample Unsigned Long part.                   *
  7. *                                                                              *
  8. * COPYRIGHT:                                                                   *
  9. *   IBM(R) VisualAge(TM) for C++                                               *
  10. *   (C) Copyright International Business Machines Corporation 1991, 1996       *
  11. *   Licensed Material - Program-Property of IBM - All Rights Reserved.         *
  12. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  13. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  14. *                                                                              *
  15. *   This program will not run in DOS mode.                                     *
  16. *                                                                              *
  17. * DISCLAIMER OF WARRANTIES:                                                    *
  18. *   The following [enclosed] code is sample code created by IBM                *
  19. *   Corporation.  This sample code is not part of any standard IBM product     *
  20. *   and is provided to you solely for the purpose of assisting you in the      *
  21. *   development of your applications.  The code is provided "AS IS",           *
  22. *   without warranty of any kind.  IBM shall not be liable for any damages     *
  23. *   arising out of your use of the sample code, even if they have been         *
  24. *   advised of the possibility of such damages.                                *
  25. *******************************************************************************/
  26.  
  27. #ifndef _IVBULONG_
  28.   #include <ivbulong.hpp>
  29. #endif
  30.  
  31. #ifndef _INOTIFEV_
  32.   #include <inotifev.hpp>
  33. #endif
  34.  
  35.  
  36.  
  37. /*------------------------------------------------------------------------------
  38. | IVBUnsignedLongPart::IVBUnsignedLongPart                                     |
  39. |                                                                              |
  40. | Standard constructor.                                                        |
  41. ------------------------------------------------------------------------------*/
  42. #pragma export (IVBUnsignedLongPart::IVBUnsignedLongPart(unsigned long aValue),, 2400)
  43. IVBUnsignedLongPart::IVBUnsignedLongPart(unsigned long aValue) : IVBDataTypePart ()
  44.     ,iValue (aValue)
  45.     ,iDefaultValue (0)
  46.     ,iLowLimit (0)
  47.     ,iHighLimit (ULONG_MAX)
  48. {
  49.   enableNotification ();
  50. }
  51.  
  52. /*------------------------------------------------------------------------------
  53. | IVBUnsignedLongPart::IVBUnsignedLongPart                                     |
  54. |                                                                              |
  55. | Standard copy constructor.                                                   |
  56. ------------------------------------------------------------------------------*/
  57. #pragma export (IVBUnsignedLongPart::IVBUnsignedLongPart(const IVBUnsignedLongPart&),, 2401)
  58. IVBUnsignedLongPart::IVBUnsignedLongPart (const IVBUnsignedLongPart& partCopy)
  59.   : IVBDataTypePart (partCopy)
  60.     ,iValue (partCopy.value ())
  61.     ,iDefaultValue (partCopy.defaultValue ())
  62.     ,iLowLimit (partCopy.lowLimit ())
  63.     ,iHighLimit (partCopy.highLimit ())
  64. {
  65.   enableNotification ();
  66. }
  67.  
  68. /*------------------------------------------------------------------------------
  69. | IVBUnsignedLongPart::IVBUnsignedLongPart                                     |
  70. |                                                                              |
  71. | Standard operator=                                                           |
  72. ------------------------------------------------------------------------------*/
  73. #pragma export (IVBUnsignedLongPart::operator= (const IVBUnsignedLongPart&),, 2402)
  74. IVBUnsignedLongPart& IVBUnsignedLongPart::operator= (const IVBUnsignedLongPart& aIVBUnsignedLongPart)
  75. {
  76.   if (this == &aIVBUnsignedLongPart) {
  77.     return *this;
  78.   } /* endif */
  79.   Inherited::operator=(aIVBUnsignedLongPart);
  80.   setValue(aIVBUnsignedLongPart.value());
  81.   setDefaultValue(aIVBUnsignedLongPart.defaultValue());
  82.   setLowLimit(aIVBUnsignedLongPart.lowLimit());
  83.   setHighLimit(aIVBUnsignedLongPart.highLimit());
  84.   return *this;
  85. }
  86.  
  87. /*------------------------------------------------------------------------------
  88. | IVBUnsignedLongPart::~IVBUnsignedLongPart                                    |
  89. |                                                                              |
  90. | IVBUnsignedLongPart destructor.                                              |
  91. ------------------------------------------------------------------------------*/
  92. #pragma export (IVBUnsignedLongPart::~IVBUnsignedLongPart(),, 2403)
  93. IVBUnsignedLongPart::~IVBUnsignedLongPart()
  94. {
  95. }
  96.  
  97. /*------------------------------------------------------------------------------
  98. | IVBUnsignedLongPart::asString                                                |
  99. |                                                                              |
  100. | Perform asString.                                                            |
  101. ------------------------------------------------------------------------------*/
  102. #pragma export (IVBUnsignedLongPart::asString() const,, 2404)
  103. IString IVBUnsignedLongPart::asString () const
  104. {
  105.   return valueAsText();
  106. }
  107.  
  108. /*------------------------------------------------------------------------------
  109. | IVBUnsignedLongPart::value                                                   |
  110. |                                                                              |
  111. | Return the value attribute.                                                  |
  112. ------------------------------------------------------------------------------*/
  113. #pragma export (IVBUnsignedLongPart::value() const,, 2405)
  114. unsigned long IVBUnsignedLongPart::value () const
  115. {
  116.   return iValue;
  117. }
  118.  
  119. /*------------------------------------------------------------------------------
  120. | IVBUnsignedLongPart::setValue                                                |
  121. |                                                                              |
  122. | Set the value attribute.                                                     |
  123. ------------------------------------------------------------------------------*/
  124. #pragma export (IVBUnsignedLongPart::setValue(const unsigned long),, 2406)
  125. IVBUnsignedLongPart& IVBUnsignedLongPart::setValue (unsigned long aValue)
  126. {
  127.   if (iValue != aValue) {
  128.     unsigned long oldValue = iValue;
  129.     iValue = aValue;
  130.     notifyObservers(INotificationEvent(valueId, *this,
  131.                     true, (void*)iValue));
  132.     if (iValue == 0) {
  133.       notifyObservers(INotificationEvent(valueZeroId, *this,
  134.                       true, (void*)iValue));
  135.     }
  136.     else {
  137.       if (oldValue == 0) {
  138.         notifyObservers(INotificationEvent(valueNotZeroId, *this,
  139.                         true, (void*)iValue));
  140.       } ; /* endif */
  141.     } ; /* endif */
  142.     if (iDefaultValue == iValue) {
  143.       notifyObservers(INotificationEvent(valueEqualDefaultId, *this,
  144.                       true, (void*)iValue));
  145.     }
  146.     else {
  147.       if (iDefaultValue == oldValue) {
  148.         notifyObservers(INotificationEvent(valueNotEqualDefaultId, *this,
  149.                         true, (void*)iValue));
  150.       } /* endif */
  151.     } /* endif */
  152.     if (iValue == iLowLimit) {
  153.       notifyObservers(INotificationEvent(valueEqualLowLimitId, *this,
  154.                       true, (void*)iValue));
  155.     } ; /* endif */
  156.     if (iLowLimit != 0) {
  157.       if (iValue < iLowLimit) {
  158.         if (!(oldValue < iLowLimit)) {
  159.           notifyObservers(INotificationEvent(valueBelowLowLimitId, *this,
  160.                           true, (void*)iValue));
  161.         } ; /* endif */
  162.       } ; /* endif */
  163.     } ; /* endif */
  164.     if (iValue == iHighLimit) {
  165.       notifyObservers(INotificationEvent(valueEqualHighLimitId, *this,
  166.                       true, (void*)iValue));
  167.     } ; /* endif */
  168.     if (iHighLimit != ULONG_MAX) {
  169.       if (iValue > iHighLimit) {
  170.         if (!(oldValue > iHighLimit)) {
  171.           notifyObservers(INotificationEvent(valueAboveHighLimitId, *this,
  172.                           true, (void*)iValue));
  173.         } ; /* endif */
  174.       } ; /* endif */
  175.     } ; /* endif */
  176.     if ((iValue >= iLowLimit) && (iValue <= iHighLimit)) {
  177.       if (!((oldValue >= iLowLimit) && (oldValue <= iHighLimit))) {
  178.         notifyObservers(INotificationEvent(valueWithinLimitsId, *this,
  179.                         true, (void*)iValue));
  180.       } ; /* endif */
  181.     }
  182.     else {
  183.       if (((oldValue >= iLowLimit) && (oldValue <= iHighLimit))) {
  184.         notifyObservers(INotificationEvent(valueOutsideLimitsId, *this,
  185.                         true, (void*)iValue));
  186.       } ; /* endif */
  187.     } ; /* endif */
  188.   } ; /* endif */
  189.   return *this;
  190. }
  191.  
  192. /*------------------------------------------------------------------------------
  193. | IVBUnsignedLongPart::setValue                                                |
  194. |                                                                              |
  195. | Set the value attribute.                                                     |
  196. ------------------------------------------------------------------------------*/
  197. #pragma export (IVBUnsignedLongPart::setValue(),, 2407)
  198. IVBUnsignedLongPart& IVBUnsignedLongPart::setValue ()
  199. {
  200.   return setValue(defaultValue());
  201. }
  202.  
  203. /*------------------------------------------------------------------------------
  204. | IVBUnsignedLongPart::valueAsText                                             |
  205. |                                                                              |
  206. | Return the valueAsText attribute.                                            |
  207. ------------------------------------------------------------------------------*/
  208. #pragma export (IVBUnsignedLongPart::valueAsText() const,, 2408)
  209. IString IVBUnsignedLongPart::valueAsText () const
  210. {
  211.   return IString (value());
  212. }
  213.  
  214. /*------------------------------------------------------------------------------
  215. | IVBUnsignedLongPart::setValueAsText                                          |
  216. |                                                                              |
  217. | Set the valueAsText attribute.                                               |
  218. ------------------------------------------------------------------------------*/
  219. #pragma export (IVBUnsignedLongPart::setValueAsText(const IString&),, 2409)
  220. IVBUnsignedLongPart& IVBUnsignedLongPart::setValueAsText (const IString& aValueAsText)
  221. {
  222. #ifdef IC_PM
  223.   IString tempValueString(aValueAsText);
  224.   setValue (aValueAsText.asInt());
  225.   tempValueString = tempValueString.strip();
  226.  
  227.   IString firstCharOfString(tempValueString.subString(1,1));  //Gets 1st char of string
  228.   Boolean testFirstChar=firstCharOfString.indexOfAnyOf("+");  //Checks 2C if 1st char is +
  229.  
  230.   if (testFirstChar) {
  231.      tempValueString=tempValueString.subString(2);            //Uses rest of string after sign
  232.   } /* endif */
  233.  
  234.   tempValueString = tempValueString.strip();
  235.  
  236.   Boolean iValid = tempValueString.isDigits();
  237.  
  238.   IString eventData(aValueAsText);
  239.   if (iValid) {
  240.     notifyObservers(INotificationEvent(inputStringIsValidId, *this,
  241.                       true, (void*)&eventData));
  242.   } else {
  243.     notifyObservers(INotificationEvent(inputStringNotValidId, *this,
  244.                       true, (void*)&eventData));
  245.   } /* endif */
  246. #endif
  247. #ifdef IC_WIN
  248.   setValue (aValueAsText.asUnsigned());
  249.   Boolean iValid = aValueAsText.indexOfAnyBut("+0123456789 ");
  250.   if (iValid) {
  251.     IString eventData(aValueAsText);
  252.     notifyObservers(INotificationEvent(inputStringNotValidId, *this,
  253.                       true, (void*)&eventData));
  254.   } else {
  255.     IString eventData(aValueAsText);
  256.     notifyObservers(INotificationEvent(inputStringIsValidId, *this,
  257.                       true, (void*)&eventData));
  258.   } /* endif */
  259. #endif
  260.   return *this;
  261. }
  262.  
  263. /*------------------------------------------------------------------------------
  264. | IVBUnsignedLongPart::setValueAsText                                          |
  265. |                                                                              |
  266. | Set the valueAsText attribute.                                               |
  267. ------------------------------------------------------------------------------*/
  268. #pragma export (IVBUnsignedLongPart::setValueAsText(const IString*),, 2410)
  269. IVBUnsignedLongPart& IVBUnsignedLongPart::setValueAsText (const IString* aValueAsText)
  270. {
  271.   return setValueAsText (*aValueAsText);
  272. }
  273.  
  274. /*------------------------------------------------------------------------------
  275. | IVBUnsignedLongPart::valueAs1Based                                           |
  276. |                                                                              |
  277. | Return the valueAs1Based attribute.                                          |
  278. ------------------------------------------------------------------------------*/
  279. #pragma export (IVBUnsignedLongPart::valueAs1Based() const,, 2411)
  280. unsigned long IVBUnsignedLongPart::valueAs1Based () const
  281. {
  282.   return (value() + 1) ;
  283. }
  284.  
  285. /*------------------------------------------------------------------------------
  286. | IVBUnsignedLongPart::setValueAs1Based                                        |
  287. |                                                                              |
  288. | Set the valueAs1Based attribute.                                             |
  289. ------------------------------------------------------------------------------*/
  290. #pragma export (IVBUnsignedLongPart::setValueAs1Based(unsigned long),, 2412)
  291. IVBUnsignedLongPart& IVBUnsignedLongPart::setValueAs1Based (unsigned long aValueAs1Based)
  292. {
  293.   return setValue (aValueAs1Based - 1);
  294. }
  295.  
  296. /*------------------------------------------------------------------------------
  297. | IVBUnsignedLongPart::defaultValue                                            |
  298. |                                                                              |
  299. | Return the defaultValue attribute.                                           |
  300. ------------------------------------------------------------------------------*/
  301. #pragma export (IVBUnsignedLongPart::defaultValue() const,, 2413)
  302. unsigned long IVBUnsignedLongPart::defaultValue () const
  303. {
  304.   return iDefaultValue;
  305. }
  306.  
  307. /*------------------------------------------------------------------------------
  308. | IVBUnsignedLongPart::setDefaultValue                                         |
  309. |                                                                              |
  310. | Set the defaultValue attribute.                                              |
  311. ------------------------------------------------------------------------------*/
  312. #pragma export (IVBUnsignedLongPart::setDefaultValue(const unsigned long),, 2414)
  313. IVBUnsignedLongPart& IVBUnsignedLongPart::setDefaultValue (unsigned long aDefaultValue)
  314. {
  315.   if (iDefaultValue != aDefaultValue) {
  316.     unsigned long oldValue = iDefaultValue;
  317.     iDefaultValue = aDefaultValue;
  318.     notifyObservers(INotificationEvent(defaultValueId, *this,
  319.                       true, (void*)iDefaultValue));
  320.     if (iDefaultValue == iValue) {
  321.       notifyObservers(INotificationEvent(valueEqualDefaultId, *this,
  322.                       true, (void*)iValue));
  323.     }
  324.     else {
  325.       if (oldValue == iValue) {
  326.         notifyObservers(INotificationEvent(valueNotEqualDefaultId, *this,
  327.                         true, (void*)iValue));
  328.       } /* endif */
  329.     } /* endif */
  330.   } /* endif */
  331.   return *this;
  332. }
  333.  
  334. /*------------------------------------------------------------------------------
  335. | IVBUnsignedLongPart::isValueEqualDefault                                     |
  336. |                                                                              |
  337. | Return the valueEqualDefault attribute.                                      |
  338. ------------------------------------------------------------------------------*/
  339. #pragma export (IVBUnsignedLongPart::isValueEqualDefault() const,, 2415)
  340. Boolean IVBUnsignedLongPart::isValueEqualDefault () const
  341. {
  342.   return (value() == defaultValue ()) ;
  343. }
  344.  
  345. /*------------------------------------------------------------------------------
  346. | IVBUnsignedLongPart::isValueNotEqualDefault                                  |
  347. |                                                                              |
  348. | Return the valueNotEqualDefault attribute.                                   |
  349. ------------------------------------------------------------------------------*/
  350. #pragma export (IVBUnsignedLongPart::isValueNotEqualDefault() const,, 2416)
  351. Boolean IVBUnsignedLongPart::isValueNotEqualDefault () const
  352. {
  353.   return (value() != defaultValue ()) ;
  354. }
  355.  
  356. /*------------------------------------------------------------------------------
  357. | IVBUnsignedLongPart::lowLimit                                                |
  358. |                                                                              |
  359. | Return the lowLimit attribute.                                               |
  360. ------------------------------------------------------------------------------*/
  361. #pragma export (IVBUnsignedLongPart::lowLimit() const,, 2417)
  362. unsigned long IVBUnsignedLongPart::lowLimit () const
  363. {
  364.   return iLowLimit;
  365. }
  366.  
  367. /*------------------------------------------------------------------------------
  368. | IVBUnsignedLongPart::setLowLimit                                             |
  369. |                                                                              |
  370. | Set the lowLimit attribute.                                                  |
  371. ------------------------------------------------------------------------------*/
  372. #pragma export (IVBUnsignedLongPart::setLowLimit(const unsigned long),, 2418)
  373. IVBUnsignedLongPart& IVBUnsignedLongPart::setLowLimit (unsigned long aLowLimit)
  374. {
  375.   if (iLowLimit != aLowLimit) {
  376.     unsigned long oldValue = iLowLimit;
  377.     iLowLimit = aLowLimit;
  378.     notifyObservers(INotificationEvent(lowLimitId, *this,
  379.                       true, (void*)iLowLimit));
  380.     if (iValue == lowLimit()) {
  381.       notifyObservers(INotificationEvent(valueEqualLowLimitId, *this,
  382.                       true, (void*)iValue));
  383.     } ; /* endif */
  384.     if (lowLimit() != 0) {
  385.       if (iValue < iLowLimit) {
  386.         if (!(iValue < oldValue)) {
  387.           notifyObservers(INotificationEvent(valueBelowLowLimitId, *this,
  388.                           true, (void*)iValue));
  389.         } ; /* endif */
  390.       } ; /* endif */
  391.     } ; /* endif */
  392.     if ((iValue >= lowLimit()) && (iValue <= highLimit())) {
  393.       if (!((iValue >= oldValue) && (iValue <= highLimit()))) {
  394.         notifyObservers(INotificationEvent(valueWithinLimitsId, *this,
  395.                         true, (void*)iLowLimit));
  396.       } ; /* endif */
  397.     }
  398.     else {
  399.       if ((iValue >= oldValue) && (iValue <= highLimit())) {
  400.         notifyObservers(INotificationEvent(valueOutsideLimitsId, *this,
  401.                         true, (void*)iLowLimit));
  402.       } ; /* endif */
  403.     } ; /* endif */
  404.   } /* endif */
  405.   return *this;
  406. }
  407.  
  408. /*------------------------------------------------------------------------------
  409. | IVBUnsignedLongPart::highLimit                                               |
  410. |                                                                              |
  411. | Return the highLimit attribute.                                              |
  412. ------------------------------------------------------------------------------*/
  413. #pragma export (IVBUnsignedLongPart::highLimit() const,, 2419)
  414. unsigned long IVBUnsignedLongPart::highLimit () const
  415. {
  416.   return iHighLimit;
  417. }
  418.  
  419. /*------------------------------------------------------------------------------
  420. | IVBUnsignedLongPart::setHighLimit                                            |
  421. |                                                                              |
  422. | Set the highLimit attribute.                                                 |
  423. ------------------------------------------------------------------------------*/
  424. #pragma export (IVBUnsignedLongPart::setHighLimit(const unsigned long),, 2420)
  425. IVBUnsignedLongPart& IVBUnsignedLongPart::setHighLimit (unsigned long aHighLimit)
  426. {
  427.   if (iHighLimit != aHighLimit) {
  428.     unsigned long oldValue = iHighLimit;
  429.     iHighLimit = aHighLimit;
  430.     notifyObservers(INotificationEvent(highLimitId, *this,
  431.                       true, (void*)iHighLimit));
  432.     if (iValue == highLimit()) {
  433.       notifyObservers(INotificationEvent(valueEqualHighLimitId, *this,
  434.                       true, (void*)iValue));
  435.     } ; /* endif */
  436.     if (highLimit() != ULONG_MAX) {
  437.       if (iValue > iHighLimit) {
  438.         if (!(iValue > oldValue)) {
  439.           notifyObservers(INotificationEvent(valueAboveHighLimitId, *this,
  440.                           true, (void*)iValue));
  441.         } ; /* endif */
  442.       } ; /* endif */
  443.     } ; /* endif */
  444.     if ((iValue >= lowLimit()) && (iValue <= highLimit())) {
  445.       if (!((iValue >= lowLimit()) && (iValue <= oldValue))) {
  446.         notifyObservers(INotificationEvent(valueWithinLimitsId, *this,
  447.                         true, (void*)iHighLimit));
  448.       } ; /* endif */
  449.     }
  450.     else {
  451.       if ((iValue >= lowLimit()) && (iValue <= oldValue)) {
  452.         notifyObservers(INotificationEvent(valueOutsideLimitsId, *this,
  453.                         true, (void*)iHighLimit));
  454.       } ; /* endif */
  455.     } ; /* endif */
  456.   } /* endif */
  457.   return *this;
  458. }
  459.  
  460. /*------------------------------------------------------------------------------
  461. | IVBUnsignedLongPart::isValueEqualLowLimit                                    |
  462. |                                                                              |
  463. | Return the valueEqualLowLimit attribute.                                     |
  464. ------------------------------------------------------------------------------*/
  465. #pragma export (IVBUnsignedLongPart::isValueEqualLowLimit() const,, 2421)
  466. Boolean IVBUnsignedLongPart::isValueEqualLowLimit () const
  467. {
  468.   return (value() == lowLimit ()) ;
  469. }
  470.  
  471. /*------------------------------------------------------------------------------
  472. | IVBUnsignedLongPart::isValueEqualHighLimit                                   |
  473. |                                                                              |
  474. | Return the valueEqualHighLimit attribute.                                    |
  475. ------------------------------------------------------------------------------*/
  476. #pragma export (IVBUnsignedLongPart::isValueEqualHighLimit() const,, 2422)
  477. Boolean IVBUnsignedLongPart::isValueEqualHighLimit () const
  478. {
  479.   return (value() == highLimit ()) ;
  480. }
  481.  
  482. /*------------------------------------------------------------------------------
  483. | IVBUnsignedLongPart::isValueBelowLowLimit                                    |
  484. |                                                                              |
  485. | Return the valueBelowLowLimit attribute.                                     |
  486. ------------------------------------------------------------------------------*/
  487. #pragma export (IVBUnsignedLongPart::isValueBelowLowLimit() const,, 2423)
  488. Boolean IVBUnsignedLongPart::isValueBelowLowLimit () const
  489. {
  490.   return (value() < lowLimit ()) ;
  491. }
  492.  
  493. /*------------------------------------------------------------------------------
  494. | IVBUnsignedLongPart::isValueAboveHighLimit                                   |
  495. |                                                                              |
  496. | Return the valueAboveHighLimit attribute.                                    |
  497. ------------------------------------------------------------------------------*/
  498. #pragma export (IVBUnsignedLongPart::isValueAboveHighLimit() const,, 2424)
  499. Boolean IVBUnsignedLongPart::isValueAboveHighLimit () const
  500. {
  501.   return (value() > highLimit ()) ;
  502. }
  503.  
  504. /*------------------------------------------------------------------------------
  505. | IVBUnsignedLongPart::isValueOutsideLimits                                    |
  506. |                                                                              |
  507. | Return the valueOutsideLimits attribute.                                     |
  508. ------------------------------------------------------------------------------*/
  509. #pragma export (IVBUnsignedLongPart::isValueOutsideLimits() const,, 2425)
  510. Boolean IVBUnsignedLongPart::isValueOutsideLimits () const
  511. {
  512.   return ((value() < lowLimit()) || (value() > highLimit())) ;
  513. }
  514.  
  515. /*------------------------------------------------------------------------------
  516. | IVBUnsignedLongPart::isValueWithinLimits                                     |
  517. |                                                                              |
  518. | Return the valueWithinLimits attribute.                                      |
  519. ------------------------------------------------------------------------------*/
  520. #pragma export (IVBUnsignedLongPart::isValueWithinLimits() const,, 2426)
  521. Boolean IVBUnsignedLongPart::isValueWithinLimits () const
  522. {
  523.   return !isValueOutsideLimits ();
  524. }
  525.  
  526. /*------------------------------------------------------------------------------
  527. | IVBUnsignedLongPart::isValueNotZero                                          |
  528. |                                                                              |
  529. | Return the valueNotZero attribute.                                           |
  530. ------------------------------------------------------------------------------*/
  531. #pragma export (IVBUnsignedLongPart::isValueNotZero() const,, 2427)
  532. Boolean IVBUnsignedLongPart::isValueNotZero () const
  533. {
  534.   return (value() != 0) ;
  535. }
  536.  
  537. /*------------------------------------------------------------------------------
  538. | IVBUnsignedLongPart::isValueZero                                             |
  539. |                                                                              |
  540. | Return the valueZero attribute.                                              |
  541. ------------------------------------------------------------------------------*/
  542. #pragma export (IVBUnsignedLongPart::isValueZero() const,, 2428)
  543. Boolean IVBUnsignedLongPart::isValueZero () const
  544. {
  545.   return (value() == 0) ;
  546. }
  547.  
  548. /*------------------------------------------------------------------------------
  549. | IVBUnsignedLongPart::assignValueToZero                                       |
  550. |                                                                              |
  551. | Assign the value attribute to 0.                                             |
  552. ------------------------------------------------------------------------------*/
  553. #pragma export (IVBUnsignedLongPart::assignValueToZero(),, 2429)
  554. IVBUnsignedLongPart& IVBUnsignedLongPart::assignValueToZero ()
  555. {
  556.   return setValue (0) ;
  557. }
  558.  
  559. /*------------------------------------------------------------------------------
  560. | IVBUnsignedLongPart::assignValueToOne                                        |
  561. |                                                                              |
  562. | Assign the value attribute to 1.                                             |
  563. ------------------------------------------------------------------------------*/
  564. #pragma export (IVBUnsignedLongPart::assignValueToOne(),, 2430)
  565. IVBUnsignedLongPart& IVBUnsignedLongPart::assignValueToOne ()
  566. {
  567.   return setValue (1) ;
  568. }
  569.  
  570. /*------------------------------------------------------------------------------
  571. | IVBUnsignedLongPart::assignValueToLowLimit                                   |
  572. |                                                                              |
  573. | Assign the value attribute to low limit attribute.                           |
  574. ------------------------------------------------------------------------------*/
  575. #pragma export (IVBUnsignedLongPart::assignValueToLowLimit(),, 2431)
  576. IVBUnsignedLongPart& IVBUnsignedLongPart::assignValueToLowLimit ()
  577. {
  578.   return setValue (lowLimit()) ;
  579. }
  580.  
  581. /*------------------------------------------------------------------------------
  582. | IVBUnsignedLongPart::assignValueToHighLimit                                  |
  583. |                                                                              |
  584. | Assign the value attribute to high limit attribute.                          |
  585. ------------------------------------------------------------------------------*/
  586. #pragma export (IVBUnsignedLongPart::assignValueToHighLimit(),, 2432)
  587. IVBUnsignedLongPart& IVBUnsignedLongPart::assignValueToHighLimit ()
  588. {
  589.   return setValue (highLimit()) ;
  590. }
  591.  
  592. /*------------------------------------------------------------------------------
  593. | IVBUnsignedLongPart::assignValueToDefault                                    |
  594. |                                                                              |
  595. | Assign the value attribute to default.                                       |
  596. ------------------------------------------------------------------------------*/
  597. #pragma export (IVBUnsignedLongPart::assignValueToDefault(),, 2433)
  598. IVBUnsignedLongPart& IVBUnsignedLongPart::assignValueToDefault ()
  599. {
  600.   return setValue (defaultValue ()) ;
  601. }
  602.  
  603. /*------------------------------------------------------------------------------
  604. | IVBUnsignedLongPart::assignValueToRandom                                     |
  605. |                                                                              |
  606. | Assign the value attribute to a pseudo-random number.                        |
  607. ------------------------------------------------------------------------------*/
  608. #pragma export (IVBUnsignedLongPart::assignValueToRandom(),, 2434)
  609. IVBUnsignedLongPart& IVBUnsignedLongPart::assignValueToRandom ()
  610. {
  611.   return setValue (rand ()) ;
  612. }
  613.  
  614. /*------------------------------------------------------------------------------
  615. | IVBUnsignedLongPart::copyValueToDefault                                      |
  616. |                                                                              |
  617. | Copy the value attribute to default.                                         |
  618. ------------------------------------------------------------------------------*/
  619. #pragma export (IVBUnsignedLongPart::copyValueToDefault(),, 2435)
  620. IVBUnsignedLongPart& IVBUnsignedLongPart::copyValueToDefault ()
  621. {
  622.   return setDefaultValue (value()) ;
  623. }
  624.  
  625. /*------------------------------------------------------------------------------
  626. | IVBUnsignedLongPart::squareValue                                             |
  627. |                                                                              |
  628. | Square the value attribute.                                                  |
  629. ------------------------------------------------------------------------------*/
  630. #pragma export (IVBUnsignedLongPart::squareValue(),, 2436)
  631. IVBUnsignedLongPart& IVBUnsignedLongPart::squareValue()
  632. {
  633.   return setValue (value() * value()) ;
  634. }
  635.  
  636. /*------------------------------------------------------------------------------
  637. | IVBUnsignedLongPart::addValue                                                |
  638. |                                                                              |
  639. | Perform the add operator to the value attribute.                             |
  640. ------------------------------------------------------------------------------*/
  641. #pragma export (IVBUnsignedLongPart::addValue (unsigned long),, 2437)
  642. IVBUnsignedLongPart& IVBUnsignedLongPart::addValue (unsigned long addValue)
  643. {
  644.   return setValue (value() + addValue) ;
  645. }
  646.  
  647. /*------------------------------------------------------------------------------
  648. | IVBUnsignedLongPart::subtractValue                                           |
  649. |                                                                              |
  650. | Perform the subtract operator to the value attribute.                        |
  651. ------------------------------------------------------------------------------*/
  652. #pragma export (IVBUnsignedLongPart::subtractValue (unsigned long),, 2438)
  653. IVBUnsignedLongPart& IVBUnsignedLongPart::subtractValue (unsigned long subtractValue)
  654. {
  655.   return setValue (value() - subtractValue) ;
  656. }
  657.  
  658. /*------------------------------------------------------------------------------
  659. | IVBUnsignedLongPart::multiplyValue                                           |
  660. |                                                                              |
  661. | Perform the multiply operator to the value attribute.                        |
  662. ------------------------------------------------------------------------------*/
  663. #pragma export (IVBUnsignedLongPart::multiplyValue (unsigned long),, 2439)
  664. IVBUnsignedLongPart& IVBUnsignedLongPart::multiplyValue (unsigned long multiplyValue)
  665. {
  666.   return setValue (value() * multiplyValue) ;
  667. }
  668.  
  669. /*------------------------------------------------------------------------------
  670. | IVBUnsignedLongPart::divideValue                                            |
  671. |                                                                             |
  672. | Perform the divide operator to the value attribute.                         |
  673. ------------------------------------------------------------------------------*/
  674. #pragma export (IVBUnsignedLongPart::divideValue (unsigned long),, 2440)
  675. IVBUnsignedLongPart& IVBUnsignedLongPart::divideValue (unsigned long divideValue)
  676. {
  677.   if (divideValue)
  678.     return setValue (value() / divideValue) ;
  679.   return *this;
  680. }
  681.  
  682. /*------------------------------------------------------------------------------
  683. | IVBUnsignedLongPart::andValue                                                |
  684. |                                                                              |
  685. | Perform the and operator to the value attribute.                             |
  686. ------------------------------------------------------------------------------*/
  687. #pragma export (IVBUnsignedLongPart::andValue (unsigned long),, 2441)
  688. IVBUnsignedLongPart& IVBUnsignedLongPart::andValue (unsigned long andValue)
  689. {
  690.   return setValue (value() & andValue) ;
  691. }
  692.  
  693. /*------------------------------------------------------------------------------
  694. | IVBUnsignedLongPart::orValue                                                 |
  695. |                                                                              |
  696. | Perform the or operator to the value attribute.                              |
  697. ------------------------------------------------------------------------------*/
  698. #pragma export (IVBUnsignedLongPart::orValue (unsigned long),, 2442)
  699. IVBUnsignedLongPart& IVBUnsignedLongPart::orValue (unsigned long orValue)
  700. {
  701.   return setValue (value() | orValue) ;
  702. }
  703.  
  704. /*------------------------------------------------------------------------------
  705. | IVBUnsignedLongPart::operator == (const IVBUnsignedLongPart & aValue)        |
  706. |                                                                              |
  707. ------------------------------------------------------------------------------*/
  708. #pragma export (IVBUnsignedLongPart::operator == (const IVBUnsignedLongPart&) const,, 2443)
  709. Boolean IVBUnsignedLongPart::
  710.   operator == (const IVBUnsignedLongPart& aValue) const
  711. {
  712.   if (value() != aValue.value()) {
  713.     return false;
  714.   } /* endif */
  715.   if (defaultValue() != aValue.defaultValue()) {
  716.     return false;
  717.   } /* endif */
  718.   if (lowLimit() != aValue.lowLimit()) {
  719.     return false;
  720.   } /* endif */
  721.   if (highLimit() != aValue.highLimit()) {
  722.     return false;
  723.   } /* endif */
  724.   return true;
  725. }
  726.  
  727. /*------------------------------------------------------------------------------
  728. | IVBUnsignedLongPart::operator != (const IVBUnsignedLongPart & aValue)        |
  729. |                                                                              |
  730. ------------------------------------------------------------------------------*/
  731. #pragma export (IVBUnsignedLongPart::operator != (const IVBUnsignedLongPart&) const,, 2444)
  732. Boolean IVBUnsignedLongPart::
  733.   operator != (const IVBUnsignedLongPart& aValue) const
  734. {
  735.   if (value() != aValue.value()) {
  736.     return true;
  737.   } /* endif */
  738.   if (defaultValue() != aValue.defaultValue()) {
  739.     return true;
  740.   } /* endif */
  741.   if (lowLimit() != aValue.lowLimit()) {
  742.     return true;
  743.   } /* endif */
  744.   if (highLimit() != aValue.highLimit()) {
  745.     return true;
  746.   } /* endif */
  747.   return false;
  748. }
  749.  
  750. /*------------------------------------------------------------------------------
  751. | IVBUnsignedLongPart::operator == (const IVBUnsignedLongPart * aValue)        |
  752. |                                                                              |
  753. ------------------------------------------------------------------------------*/
  754. #pragma export (IVBUnsignedLongPart::operator == (const IVBUnsignedLongPart*) const,, 2445)
  755. Boolean IVBUnsignedLongPart::
  756.   operator == (const IVBUnsignedLongPart* aValue) const
  757. {
  758.   if (value() != aValue->value()) {
  759.     return false;
  760.   } /* endif */
  761.   if (defaultValue() != aValue->defaultValue()) {
  762.     return false;
  763.   } /* endif */
  764.   if (lowLimit() != aValue->lowLimit()) {
  765.     return false;
  766.   } /* endif */
  767.   if (highLimit() != aValue->highLimit()) {
  768.     return false;
  769.   } /* endif */
  770.   return true;
  771. }
  772.  
  773. /*------------------------------------------------------------------------------
  774. | IVBUnsignedLongPart::operator != (const IVBUnsignedLongPart * aValue)        |
  775. |                                                                              |
  776. ------------------------------------------------------------------------------*/
  777. #pragma export (IVBUnsignedLongPart::operator != (const IVBUnsignedLongPart*) const,, 2446)
  778. Boolean IVBUnsignedLongPart::
  779.   operator != (const IVBUnsignedLongPart* aValue) const
  780. {
  781.   if (value() != aValue->value()) {
  782.     return true;
  783.   } /* endif */
  784.   if (defaultValue() != aValue->defaultValue()) {
  785.     return true;
  786.   } /* endif */
  787.   if (lowLimit() != aValue->lowLimit()) {
  788.     return true;
  789.   } /* endif */
  790.   if (highLimit() != aValue->highLimit()) {
  791.     return true;
  792.   } /* endif */
  793.   return false;
  794. }
  795.