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

  1. /*******************************************************************************
  2. * FILE NAME: ivblong.cpp                                                       *
  3. *                                                                              *
  4. * DESCRIPTION:                                                                 *
  5. *   Class implementation of the class(es):                                     *
  6. *    IVBLongPart - IBM VB sample 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 _IVBLONG_
  28.   #include <ivblong.hpp>
  29. #endif
  30.  
  31. #ifndef _INOTIFEV_
  32.   #include <inotifev.hpp>
  33. #endif
  34.  
  35.  
  36.  
  37. /*------------------------------------------------------------------------------
  38. | IVBLongPart::IVBLongPart                                                     |
  39. |                                                                              |
  40. | Standard constructor.                                                        |
  41. ------------------------------------------------------------------------------*/
  42. #pragma export (IVBLongPart::IVBLongPart(long aValue),, 2300)
  43. IVBLongPart::IVBLongPart(long aValue) : IVBDataTypePart ()
  44.     ,iValue (aValue)
  45.     ,iDefaultValue (0)
  46.     ,iLowLimit (LONG_MIN)
  47.     ,iHighLimit (LONG_MAX)
  48. {
  49.   enableNotification ();
  50. }
  51.  
  52. /*------------------------------------------------------------------------------
  53. | IVBLongPart::IVBLongPart                                                     |
  54. |                                                                              |
  55. | Standard copy constructor.                                                   |
  56. ------------------------------------------------------------------------------*/
  57. #pragma export (IVBLongPart::IVBLongPart(const IVBLongPart&),, 2301)
  58. IVBLongPart::IVBLongPart (const IVBLongPart& 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. | IVBLongPart::IVBLongPart                                                     |
  70. |                                                                              |
  71. | Standard operator=                                                           |
  72. ------------------------------------------------------------------------------*/
  73. #pragma export (IVBLongPart::operator= (const IVBLongPart&),, 2302)
  74. IVBLongPart& IVBLongPart::operator= (const IVBLongPart& aIVBLongPart)
  75. {
  76.   if (this == &aIVBLongPart) {
  77.     return *this;
  78.   } /* endif */
  79.   Inherited::operator=(aIVBLongPart);
  80.   setValue(aIVBLongPart.value());
  81.   setDefaultValue(aIVBLongPart.defaultValue());
  82.   setLowLimit(aIVBLongPart.lowLimit());
  83.   setHighLimit(aIVBLongPart.highLimit());
  84.   return *this;
  85. }
  86.  
  87. /*------------------------------------------------------------------------------
  88. | IVBLongPart::~IVBLongPart                                                    |
  89. |                                                                              |
  90. | IVBLongPart destructor.                                                      |
  91. ------------------------------------------------------------------------------*/
  92. #pragma export (IVBLongPart::~IVBLongPart(),, 2303)
  93. IVBLongPart::~IVBLongPart()
  94. {
  95. }
  96.  
  97. /*------------------------------------------------------------------------------
  98. | IVBLongPart::asString                                                        |
  99. |                                                                              |
  100. | Perform asString.                                                            |
  101. ------------------------------------------------------------------------------*/
  102. #pragma export (IVBLongPart::asString() const,, 2304)
  103. IString IVBLongPart::asString () const
  104. {
  105.   return valueAsText();
  106. }
  107.  
  108. /*------------------------------------------------------------------------------
  109. | IVBLongPart::value                                                           |
  110. |                                                                              |
  111. | Return the value attribute.                                                  |
  112. ------------------------------------------------------------------------------*/
  113. #pragma export (IVBLongPart::value() const,, 2305)
  114. long IVBLongPart::value () const
  115. {
  116.   return iValue;
  117. }
  118.  
  119. /*------------------------------------------------------------------------------
  120. | IVBLongPart::setValue                                                        |
  121. |                                                                              |
  122. | Set the value attribute.                                                     |
  123. ------------------------------------------------------------------------------*/
  124. #pragma export (IVBLongPart::setValue(const long),, 2306)
  125. IVBLongPart& IVBLongPart::setValue (long aValue)
  126. {
  127.   if (iValue != aValue) {
  128.     long oldValue = iValue;
  129.     iValue = aValue;
  130.     notifyObservers(INotificationEvent(valueId, *this,
  131.                     true, (void*)iValue));
  132.     if (iValue < 0) {
  133.       if (!(oldValue < 0)) {
  134.         notifyObservers(INotificationEvent(valueNegativeId, *this,
  135.                         true, (void*)iValue));
  136.       } ; /* endif */
  137.     } ;
  138.     if (iValue > 0) {
  139.       if (!(oldValue > 0)) {
  140.         notifyObservers(INotificationEvent(valuePositiveId, *this,
  141.                         true, (void*)iValue));
  142.       } ; /* endif */
  143.     } ; /* endif */
  144.     if (iValue == 0) {
  145.       notifyObservers(INotificationEvent(valueZeroId, *this,
  146.                       true, (void*)iValue));
  147.     }
  148.     else {
  149.       if (oldValue == 0) {
  150.         notifyObservers(INotificationEvent(valueNotZeroId, *this,
  151.                         true, (void*)iValue));
  152.       } ; /* endif */
  153.     } ; /* endif */
  154.     if (iDefaultValue == iValue) {
  155.       notifyObservers(INotificationEvent(valueEqualDefaultId, *this,
  156.                       true, (void*)iValue));
  157.     }
  158.     else {
  159.       if (iDefaultValue == oldValue) {
  160.         notifyObservers(INotificationEvent(valueNotEqualDefaultId, *this,
  161.                         true, (void*)iValue));
  162.       } /* endif */
  163.     } /* endif */
  164.     if (iValue == iLowLimit) {
  165.       notifyObservers(INotificationEvent(valueEqualLowLimitId, *this,
  166.                       true, (void*)iValue));
  167.     } ; /* endif */
  168.     if (iLowLimit != LONG_MIN) {
  169.       if (iValue < iLowLimit) {
  170.         if (!(oldValue < iLowLimit)) {
  171.           notifyObservers(INotificationEvent(valueBelowLowLimitId, *this,
  172.                           true, (void*)iValue));
  173.         } ; /* endif */
  174.       } ; /* endif */
  175.     } ; /* endif */
  176.     if (iValue == iHighLimit) {
  177.       notifyObservers(INotificationEvent(valueEqualHighLimitId, *this,
  178.                       true, (void*)iValue));
  179.     } ; /* endif */
  180.     if (iHighLimit != LONG_MAX) {
  181.       if (iValue > iHighLimit) {
  182.         if (!(oldValue > iHighLimit)) {
  183.           notifyObservers(INotificationEvent(valueAboveHighLimitId, *this,
  184.                           true, (void*)iValue));
  185.         } ; /* endif */
  186.       } ; /* endif */
  187.     } ; /* endif */
  188.     if ((iValue >= iLowLimit) && (iValue <= iHighLimit)) {
  189.       if (!((oldValue >= iLowLimit) && (oldValue <= iHighLimit))) {
  190.         notifyObservers(INotificationEvent(valueWithinLimitsId, *this,
  191.                         true, (void*)iValue));
  192.       } ; /* endif */
  193.     }
  194.     else {
  195.       if (((oldValue >= iLowLimit) && (oldValue <= iHighLimit))) {
  196.         notifyObservers(INotificationEvent(valueOutsideLimitsId, *this,
  197.                         true, (void*)iValue));
  198.       } ; /* endif */
  199.     } ; /* endif */
  200.   } ; /* endif */
  201.   return *this;
  202. }
  203.  
  204. /*------------------------------------------------------------------------------
  205. | IVBLongPart::setValue                                                        |
  206. |                                                                              |
  207. | Set the value attribute.                                                     |
  208. ------------------------------------------------------------------------------*/
  209. #pragma export (IVBLongPart::setValue(),, 2307)
  210. IVBLongPart& IVBLongPart::setValue ()
  211. {
  212.   return setValue(defaultValue());
  213. }
  214.  
  215. /*------------------------------------------------------------------------------
  216. | IVBLongPart::valueAsText                                                     |
  217. |                                                                              |
  218. | Return the valueAsText attribute.                                            |
  219. ------------------------------------------------------------------------------*/
  220. #pragma export (IVBLongPart::valueAsText() const,, 2308)
  221. IString IVBLongPart::valueAsText () const
  222. {
  223.   return IString (value());
  224. }
  225.  
  226. /*------------------------------------------------------------------------------
  227. | IVBLongPart::setValueAsText                                                  |
  228. |                                                                              |
  229. | Set the valueAsText attribute.                                               |
  230. ------------------------------------------------------------------------------*/
  231. #pragma export (IVBLongPart::setValueAsText(const IString&),, 2309)
  232. IVBLongPart& IVBLongPart::setValueAsText (const IString& aValueAsText)
  233. {
  234. #ifdef IC_PM
  235.   IString tempValueString(aValueAsText);
  236.   setValue (aValueAsText.asInt());
  237.   tempValueString = tempValueString.strip();
  238.  
  239.   IString firstCharOfString(tempValueString.subString(1,1));  //Gets 1st char of string
  240.   Boolean testFirstChar=firstCharOfString.indexOfAnyOf("+-"); //Checks 2C if 1st char is + or -
  241.  
  242.   if (testFirstChar) {
  243.      tempValueString=tempValueString.subString(2);            //Uses rest of string after sign
  244.   } /* endif */
  245.  
  246. /*********************************************************************
  247.   The use of the Following Statement allows you to have a string like
  248.  
  249.     "+    23"          be seen as an integer, which would be the same as
  250.                 "+23"  which is of course an integer
  251. **********************************************************************/
  252.   tempValueString = tempValueString.strip();
  253.  
  254.   Boolean iValid = tempValueString.indexOfAnyBut("0123456789");
  255.  
  256.   IString eventData(aValueAsText);
  257.   if (!(iValid)) {
  258.     notifyObservers(INotificationEvent(inputStringIsValidId, *this,
  259.                       true, (void*)&eventData));
  260.   } else {
  261.     notifyObservers(INotificationEvent(inputStringNotValidId, *this,
  262.                       true, (void*)&eventData));
  263.   } /* endif */
  264. #endif
  265. #ifdef IC_WIN
  266.   setValue (aValueAsText.asInt());
  267.   Boolean iValid = aValueAsText.indexOfAnyBut("+-0123456789 ");
  268.   if (iValid) {
  269.     IString eventData(aValueAsText);
  270.     notifyObservers(INotificationEvent(inputStringNotValidId, *this,
  271.                       true, (void*)&eventData));
  272.   } else {
  273.     IString eventData(aValueAsText);
  274.     notifyObservers(INotificationEvent(inputStringIsValidId, *this,
  275.                       true, (void*)&eventData));
  276.   } /* endif */
  277. #endif
  278.   return *this;
  279. }
  280.  
  281. /*------------------------------------------------------------------------------
  282. | IVBLongPart::setValueAsText                                                  |
  283. |                                                                              |
  284. | Set the valueAsText attribute.                                               |
  285. ------------------------------------------------------------------------------*/
  286. #pragma export (IVBLongPart::setValueAsText(const IString*),, 2310)
  287. IVBLongPart& IVBLongPart::setValueAsText (const IString* aValueAsText)
  288. {
  289.   return setValueAsText (*aValueAsText);
  290. }
  291.  
  292. /*------------------------------------------------------------------------------
  293. | IVBLongPart::valueAs1Based                                                   |
  294. |                                                                              |
  295. | Return the valueAs1Based attribute.                                          |
  296. ------------------------------------------------------------------------------*/
  297. #pragma export (IVBLongPart::valueAs1Based() const,, 2311)
  298. long IVBLongPart::valueAs1Based () const
  299. {
  300.   return (value() + 1) ;
  301. }
  302.  
  303. /*------------------------------------------------------------------------------
  304. | IVBLongPart::setValueAs1Based                                                |
  305. |                                                                              |
  306. | Set the valueAs1Based attribute.                                             |
  307. ------------------------------------------------------------------------------*/
  308. #pragma export (IVBLongPart::setValueAs1Based(long),, 2312)
  309. IVBLongPart& IVBLongPart::setValueAs1Based (long aValueAs1Based)
  310. {
  311.   return setValue (aValueAs1Based - 1);
  312. }
  313.  
  314. /*------------------------------------------------------------------------------
  315. | IVBLongPart::defaultValue                                                    |
  316. |                                                                              |
  317. | Return the defaultValue attribute.                                           |
  318. ------------------------------------------------------------------------------*/
  319. #pragma export (IVBLongPart::defaultValue() const,, 2313)
  320. long IVBLongPart::defaultValue () const
  321. {
  322.   return iDefaultValue;
  323. }
  324.  
  325. /*------------------------------------------------------------------------------
  326. | IVBLongPart::setDefaultValue                                                 |
  327. |                                                                              |
  328. | Set the defaultValue attribute.                                              |
  329. ------------------------------------------------------------------------------*/
  330. #pragma export (IVBLongPart::setDefaultValue(const long),, 2314)
  331. IVBLongPart& IVBLongPart::setDefaultValue (long aDefaultValue)
  332. {
  333.   if (iDefaultValue != aDefaultValue) {
  334.     long oldValue = iDefaultValue;
  335.     iDefaultValue = aDefaultValue;
  336.     notifyObservers(INotificationEvent(defaultValueId, *this,
  337.                       true, (void*)iDefaultValue));
  338.     if (iDefaultValue == iValue) {
  339.       notifyObservers(INotificationEvent(valueEqualDefaultId, *this,
  340.                       true, (void*)iValue));
  341.     }
  342.     else {
  343.       if (oldValue == iValue) {
  344.         notifyObservers(INotificationEvent(valueNotEqualDefaultId, *this,
  345.                         true, (void*)iValue));
  346.       } /* endif */
  347.     } /* endif */
  348.   } /* endif */
  349.   return *this;
  350. }
  351.  
  352. /*------------------------------------------------------------------------------
  353. | IVBLongPart::isValueEqualDefault                                             |
  354. |                                                                              |
  355. | Return the valueEqualDefault attribute.                                      |
  356. ------------------------------------------------------------------------------*/
  357. #pragma export (IVBLongPart::isValueEqualDefault() const,, 2315)
  358. Boolean IVBLongPart::isValueEqualDefault () const
  359. {
  360.   return (value() == defaultValue ()) ;
  361. }
  362.  
  363. /*------------------------------------------------------------------------------
  364. | IVBLongPart::isValueNotEqualDefault                                          |
  365. |                                                                              |
  366. | Return the valueNotEqualDefault attribute.                                   |
  367. ------------------------------------------------------------------------------*/
  368. #pragma export (IVBLongPart::isValueNotEqualDefault() const,, 2316)
  369. Boolean IVBLongPart::isValueNotEqualDefault () const
  370. {
  371.   return (value() != defaultValue ()) ;
  372. }
  373.  
  374. /*------------------------------------------------------------------------------
  375. | IVBLongPart::lowLimit                                                        |
  376. |                                                                              |
  377. | Return the lowLimit attribute.                                               |
  378. ------------------------------------------------------------------------------*/
  379. #pragma export (IVBLongPart::lowLimit() const,, 2317)
  380. long IVBLongPart::lowLimit () const
  381. {
  382.   return iLowLimit;
  383. }
  384.  
  385. /*------------------------------------------------------------------------------
  386. | IVBLongPart::setLowLimit                                                     |
  387. |                                                                              |
  388. | Set the lowLimit attribute.                                                  |
  389. ------------------------------------------------------------------------------*/
  390. #pragma export (IVBLongPart::setLowLimit(const long),, 2318)
  391. IVBLongPart& IVBLongPart::setLowLimit (long aLowLimit)
  392. {
  393.   if (iLowLimit != aLowLimit) {
  394.     long oldValue = iLowLimit;
  395.     iLowLimit = aLowLimit;
  396.     notifyObservers(INotificationEvent(lowLimitId, *this,
  397.                       true, (void*)iLowLimit));
  398.     if (iValue == lowLimit()) {
  399.       notifyObservers(INotificationEvent(valueEqualLowLimitId, *this,
  400.                       true, (void*)iValue));
  401.     } ; /* endif */
  402.     if (lowLimit() != LONG_MIN) {
  403.       if (iValue < iLowLimit) {
  404.         if (!(iValue < oldValue)) {
  405.           notifyObservers(INotificationEvent(valueBelowLowLimitId, *this,
  406.                           true, (void*)iValue));
  407.         } ; /* endif */
  408.       } ; /* endif */
  409.     } ; /* endif */
  410.     if ((iValue >= lowLimit()) && (iValue <= highLimit())) {
  411.       if (!((iValue >= oldValue) && (iValue <= highLimit()))) {
  412.         notifyObservers(INotificationEvent(valueWithinLimitsId, *this,
  413.                         true, (void*)iLowLimit));
  414.       } ; /* endif */
  415.     }
  416.     else {
  417.       if ((iValue >= oldValue) && (iValue <= highLimit())) {
  418.         notifyObservers(INotificationEvent(valueOutsideLimitsId, *this,
  419.                         true, (void*)iLowLimit));
  420.       } ; /* endif */
  421.     } ; /* endif */
  422.   } /* endif */
  423.   return *this;
  424. }
  425.  
  426. /*------------------------------------------------------------------------------
  427. | IVBLongPart::highLimit                                                       |
  428. |                                                                              |
  429. | Return the highLimit attribute.                                              |
  430. ------------------------------------------------------------------------------*/
  431. #pragma export (IVBLongPart::highLimit() const,, 2319)
  432. long IVBLongPart::highLimit () const
  433. {
  434.   return iHighLimit;
  435. }
  436.  
  437. /*------------------------------------------------------------------------------
  438. | IVBLongPart::setHighLimit                                                    |
  439. |                                                                              |
  440. | Set the highLimit attribute.                                                 |
  441. ------------------------------------------------------------------------------*/
  442. #pragma export (IVBLongPart::setHighLimit(const long),, 2320)
  443. IVBLongPart& IVBLongPart::setHighLimit (long aHighLimit)
  444. {
  445.   if (iHighLimit != aHighLimit) {
  446.     long oldValue = iHighLimit;
  447.     iHighLimit = aHighLimit;
  448.     notifyObservers(INotificationEvent(highLimitId, *this,
  449.                       true, (void*)iHighLimit));
  450.     if (iValue == highLimit()) {
  451.       notifyObservers(INotificationEvent(valueEqualHighLimitId, *this,
  452.                       true, (void*)iValue));
  453.     } ; /* endif */
  454.     if (highLimit() != LONG_MAX) {
  455.       if (iValue > iHighLimit) {
  456.         if (!(iValue > oldValue)) {
  457.           notifyObservers(INotificationEvent(valueAboveHighLimitId, *this,
  458.                           true, (void*)iValue));
  459.         } ; /* endif */
  460.       } ; /* endif */
  461.     } ; /* endif */
  462.     if ((iValue >= lowLimit()) && (iValue <= highLimit())) {
  463.       if (!((iValue >= lowLimit()) && (iValue <= oldValue))) {
  464.         notifyObservers(INotificationEvent(valueWithinLimitsId, *this,
  465.                         true, (void*)iHighLimit));
  466.       } ; /* endif */
  467.     }
  468.     else {
  469.       if ((iValue >= lowLimit()) && (iValue <= oldValue)) {
  470.         notifyObservers(INotificationEvent(valueOutsideLimitsId, *this,
  471.                         true, (void*)iHighLimit));
  472.       } ; /* endif */
  473.     } ; /* endif */
  474.   } /* endif */
  475.   return *this;
  476. }
  477.  
  478. /*------------------------------------------------------------------------------
  479. | IVBLongPart::isValueEqualLowLimit                                            |
  480. |                                                                              |
  481. | Return the valueEqualLowLimit attribute.                                     |
  482. ------------------------------------------------------------------------------*/
  483. #pragma export (IVBLongPart::isValueEqualLowLimit() const,, 2321)
  484. Boolean IVBLongPart::isValueEqualLowLimit () const
  485. {
  486.   return (value() == lowLimit ()) ;
  487. }
  488.  
  489. /*------------------------------------------------------------------------------
  490. | IVBLongPart::isValueEqualHighLimit                                           |
  491. |                                                                              |
  492. | Return the valueEqualHighLimit attribute.                                    |
  493. ------------------------------------------------------------------------------*/
  494. #pragma export (IVBLongPart::isValueEqualHighLimit() const,, 2322)
  495. Boolean IVBLongPart::isValueEqualHighLimit () const
  496. {
  497.   return (value() == highLimit ()) ;
  498. }
  499.  
  500. /*------------------------------------------------------------------------------
  501. | IVBLongPart::isValueBelowLowLimit                                            |
  502. |                                                                              |
  503. | Return the valueBelowLowLimit attribute.                                     |
  504. ------------------------------------------------------------------------------*/
  505. #pragma export (IVBLongPart::isValueBelowLowLimit() const,, 2323)
  506. Boolean IVBLongPart::isValueBelowLowLimit () const
  507. {
  508.   return (value() < lowLimit ()) ;
  509. }
  510.  
  511. /*------------------------------------------------------------------------------
  512. | IVBLongPart::isValueAboveHighLimit                                           |
  513. |                                                                              |
  514. | Return the valueAboveHighLimit attribute.                                    |
  515. ------------------------------------------------------------------------------*/
  516. #pragma export (IVBLongPart::isValueAboveHighLimit() const,, 2324)
  517. Boolean IVBLongPart::isValueAboveHighLimit () const
  518. {
  519.   return (value() > highLimit ()) ;
  520. }
  521.  
  522. /*------------------------------------------------------------------------------
  523. | IVBLongPart::isValueOutsideLimits                                            |
  524. |                                                                              |
  525. | Return the valueOutsideLimits attribute.                                     |
  526. ------------------------------------------------------------------------------*/
  527. #pragma export (IVBLongPart::isValueOutsideLimits() const,, 2325)
  528. Boolean IVBLongPart::isValueOutsideLimits () const
  529. {
  530.   return ((value() < lowLimit()) || (value() > highLimit())) ;
  531. }
  532.  
  533. /*------------------------------------------------------------------------------
  534. | IVBLongPart::isValueWithinLimits                                             |
  535. |                                                                              |
  536. | Return the valueWithinLimits attribute.                                      |
  537. ------------------------------------------------------------------------------*/
  538. #pragma export (IVBLongPart::isValueWithinLimits() const,, 2326)
  539. Boolean IVBLongPart::isValueWithinLimits () const
  540. {
  541.   return !isValueOutsideLimits ();
  542. }
  543.  
  544. /*------------------------------------------------------------------------------
  545. | IVBLongPart::isValueNotZero                                                  |
  546. |                                                                              |
  547. | Return the valueNotZero attribute.                                           |
  548. ------------------------------------------------------------------------------*/
  549. #pragma export (IVBLongPart::isValueNotZero() const,, 2327)
  550. Boolean IVBLongPart::isValueNotZero () const
  551. {
  552.   return (value() != 0) ;
  553. }
  554.  
  555. /*------------------------------------------------------------------------------
  556. | IVBLongPart::isValueZero                                                     |
  557. |                                                                              |
  558. | Return the valueZero attribute.                                              |
  559. ------------------------------------------------------------------------------*/
  560. #pragma export (IVBLongPart::isValueZero() const,, 2328)
  561. Boolean IVBLongPart::isValueZero () const
  562. {
  563.   return (value() == 0) ;
  564. }
  565.  
  566. /*------------------------------------------------------------------------------
  567. | IVBLongPart::isValuePositive                                                 |
  568. |                                                                              |
  569. | Return the valuePositive attribute.                                          |
  570. ------------------------------------------------------------------------------*/
  571. #pragma export (IVBLongPart::isValuePositive() const,, 2329)
  572. Boolean IVBLongPart::isValuePositive () const
  573. {
  574.   return (value() > 0) ;
  575. }
  576.  
  577. /*------------------------------------------------------------------------------
  578. | IVBLongPart::isValueNegative                                                 |
  579. |                                                                              |
  580. | Return the valueNegative attribute.                                          |
  581. ------------------------------------------------------------------------------*/
  582. #pragma export (IVBLongPart::isValueNegative() const,, 2330)
  583. Boolean IVBLongPart::isValueNegative () const
  584. {
  585.   return (value() < 0) ;
  586. }
  587.  
  588. /*------------------------------------------------------------------------------
  589. | IVBLongPart::assignValueToZero                                               |
  590. |                                                                              |
  591. | Assign the value attribute to 0.                                             |
  592. ------------------------------------------------------------------------------*/
  593. #pragma export (IVBLongPart::assignValueToZero(),, 2331)
  594. IVBLongPart& IVBLongPart::assignValueToZero ()
  595. {
  596.   return setValue (0) ;
  597. }
  598.  
  599. /*------------------------------------------------------------------------------
  600. | IVBLongPart::assignValueToOne                                                |
  601. |                                                                              |
  602. | Assign the value attribute to 1.                                             |
  603. ------------------------------------------------------------------------------*/
  604. #pragma export (IVBLongPart::assignValueToOne(),, 2332)
  605. IVBLongPart& IVBLongPart::assignValueToOne ()
  606. {
  607.   return setValue (1) ;
  608. }
  609.  
  610. /*------------------------------------------------------------------------------
  611. | IVBLongPart::assignValueToLowLimit                                           |
  612. |                                                                              |
  613. | Assign the value attribute to low limit attribute.                           |
  614. ------------------------------------------------------------------------------*/
  615. #pragma export (IVBLongPart::assignValueToLowLimit(),, 2333)
  616. IVBLongPart& IVBLongPart::assignValueToLowLimit ()
  617. {
  618.   return setValue (lowLimit()) ;
  619. }
  620.  
  621. /*------------------------------------------------------------------------------
  622. | IVBLongPart::assignValueToHighLimit                                          |
  623. |                                                                              |
  624. | Assign the value attribute to high limit attribute.                          |
  625. ------------------------------------------------------------------------------*/
  626. #pragma export (IVBLongPart::assignValueToHighLimit(),, 2334)
  627. IVBLongPart& IVBLongPart::assignValueToHighLimit ()
  628. {
  629.   return setValue (highLimit()) ;
  630. }
  631.  
  632. /*------------------------------------------------------------------------------
  633. | IVBLongPart::assignValueToDefault                                            |
  634. |                                                                              |
  635. | Assign the value attribute to default.                                       |
  636. ------------------------------------------------------------------------------*/
  637. #pragma export (IVBLongPart::assignValueToDefault(),, 2335)
  638. IVBLongPart& IVBLongPart::assignValueToDefault ()
  639. {
  640.   return setValue (defaultValue ()) ;
  641. }
  642.  
  643. /*------------------------------------------------------------------------------
  644. | IVBLongPart::assignValueToRandom                                             |
  645. |                                                                              |
  646. | Assign the value attribute to a pseudo-random number.                        |
  647. ------------------------------------------------------------------------------*/
  648. #pragma export (IVBLongPart::assignValueToRandom(),, 2336)
  649. IVBLongPart& IVBLongPart::assignValueToRandom ()
  650. {
  651.   return setValue (rand ()) ;
  652. }
  653.  
  654. /*------------------------------------------------------------------------------
  655. | IVBLongPart::copyValueToDefault                                              |
  656. |                                                                              |
  657. | Copy the value attribute to default.                                         |
  658. ------------------------------------------------------------------------------*/
  659. #pragma export (IVBLongPart::copyValueToDefault(),, 2337)
  660. IVBLongPart& IVBLongPart::copyValueToDefault ()
  661. {
  662.   return setDefaultValue (value()) ;
  663. }
  664.  
  665. /*------------------------------------------------------------------------------
  666. | IVBLongPart::squareValue                                                     |
  667. |                                                                              |
  668. | Square the value attribute.                                                  |
  669. ------------------------------------------------------------------------------*/
  670. #pragma export (IVBLongPart::squareValue(),, 2338)
  671. IVBLongPart& IVBLongPart::squareValue()
  672. {
  673.   return setValue (value() * value()) ;
  674. }
  675.  
  676. /*------------------------------------------------------------------------------
  677. | IVBLongPart::addValue                                                        |
  678. |                                                                              |
  679. | Perform the add operator to the value attribute.                             |
  680. ------------------------------------------------------------------------------*/
  681. #pragma export (IVBLongPart::addValue (long),, 2339)
  682. IVBLongPart& IVBLongPart::addValue (long addValue)
  683. {
  684.   return setValue (value() + addValue) ;
  685. }
  686.  
  687. /*------------------------------------------------------------------------------
  688. | IVBLongPart::subtractValue                                                   |
  689. |                                                                              |
  690. | Perform the subtract operator to the value attribute.                        |
  691. ------------------------------------------------------------------------------*/
  692. #pragma export (IVBLongPart::subtractValue (long),, 2340)
  693. IVBLongPart& IVBLongPart::subtractValue (long subtractValue)
  694. {
  695.   return setValue (value() - subtractValue) ;
  696. }
  697.  
  698. /*------------------------------------------------------------------------------
  699. | IVBLongPart::multiplyValue                                                   |
  700. |                                                                              |
  701. | Perform the multiply operator to the value attribute.                        |
  702. ------------------------------------------------------------------------------*/
  703. #pragma export (IVBLongPart::multiplyValue (long),, 2341)
  704. IVBLongPart& IVBLongPart::multiplyValue (long multiplyValue)
  705. {
  706.   return setValue (value() * multiplyValue) ;
  707. }
  708.  
  709. /*------------------------------------------------------------------------------
  710. | IVBLongPart::divideValue                                                    |
  711. |                                                                             |
  712. | Perform the divide operator to the value attribute.                         |
  713. ------------------------------------------------------------------------------*/
  714. #pragma export (IVBLongPart::divideValue (long),, 2342)
  715. IVBLongPart& IVBLongPart::divideValue (long divideValue)
  716. {
  717.   if (divideValue)
  718.     return setValue (value() / divideValue) ;
  719.   return *this;
  720. }
  721.  
  722. /*------------------------------------------------------------------------------
  723. | IVBLongPart::andValue                                                        |
  724. |                                                                              |
  725. | Perform the and operator to the value attribute.                             |
  726. ------------------------------------------------------------------------------*/
  727. #pragma export (IVBLongPart::andValue (long),, 2343)
  728. IVBLongPart& IVBLongPart::andValue (long andValue)
  729. {
  730.   return setValue (value() & andValue) ;
  731. }
  732.  
  733. /*------------------------------------------------------------------------------
  734. | IVBLongPart::orValue                                                         |
  735. |                                                                              |
  736. | Perform the or operator to the value attribute.                              |
  737. ------------------------------------------------------------------------------*/
  738. #pragma export (IVBLongPart::orValue (long),, 2344)
  739. IVBLongPart& IVBLongPart::orValue (long orValue)
  740. {
  741.   return setValue (value() | orValue) ;
  742. }
  743.  
  744. /*------------------------------------------------------------------------------
  745. | IVBLongPart::operator == (const IVBLongPart & aValue)                        |
  746. |                                                                              |
  747. ------------------------------------------------------------------------------*/
  748. #pragma export (IVBLongPart::operator == (const IVBLongPart&) const,, 2345)
  749. Boolean IVBLongPart::
  750.   operator == (const IVBLongPart& aValue) const
  751. {
  752.   if (value() != aValue.value()) {
  753.     return false;
  754.   } /* endif */
  755.   if (defaultValue() != aValue.defaultValue()) {
  756.     return false;
  757.   } /* endif */
  758.   if (lowLimit() != aValue.lowLimit()) {
  759.     return false;
  760.   } /* endif */
  761.   if (highLimit() != aValue.highLimit()) {
  762.     return false;
  763.   } /* endif */
  764.   return true;
  765. }
  766.  
  767. /*------------------------------------------------------------------------------
  768. | IVBLongPart::operator != (const IVBLongPart & aValue)                        |
  769. |                                                                              |
  770. ------------------------------------------------------------------------------*/
  771. #pragma export (IVBLongPart::operator != (const IVBLongPart&) const,, 2346)
  772. Boolean IVBLongPart::
  773.   operator != (const IVBLongPart& aValue) const
  774. {
  775.   if (value() != aValue.value()) {
  776.     return true;
  777.   } /* endif */
  778.   if (defaultValue() != aValue.defaultValue()) {
  779.     return true;
  780.   } /* endif */
  781.   if (lowLimit() != aValue.lowLimit()) {
  782.     return true;
  783.   } /* endif */
  784.   if (highLimit() != aValue.highLimit()) {
  785.     return true;
  786.   } /* endif */
  787.   return false;
  788. }
  789.  
  790. /*------------------------------------------------------------------------------
  791. | IVBLongPart::operator == (const IVBLongPart * aValue)                        |
  792. |                                                                              |
  793. ------------------------------------------------------------------------------*/
  794. #pragma export (IVBLongPart::operator == (const IVBLongPart*) const,, 2347)
  795. Boolean IVBLongPart::
  796.   operator == (const IVBLongPart* aValue) const
  797. {
  798.   if (value() != aValue->value()) {
  799.     return false;
  800.   } /* endif */
  801.   if (defaultValue() != aValue->defaultValue()) {
  802.     return false;
  803.   } /* endif */
  804.   if (lowLimit() != aValue->lowLimit()) {
  805.     return false;
  806.   } /* endif */
  807.   if (highLimit() != aValue->highLimit()) {
  808.     return false;
  809.   } /* endif */
  810.   return true;
  811. }
  812.  
  813. /*------------------------------------------------------------------------------
  814. | IVBLongPart::operator != (const IVBLongPart * aValue)                        |
  815. |                                                                              |
  816. ------------------------------------------------------------------------------*/
  817. #pragma export (IVBLongPart::operator != (const IVBLongPart*) const,, 2348)
  818. Boolean IVBLongPart::
  819.   operator != (const IVBLongPart* aValue) const
  820. {
  821.   if (value() != aValue->value()) {
  822.     return true;
  823.   } /* endif */
  824.   if (defaultValue() != aValue->defaultValue()) {
  825.     return true;
  826.   } /* endif */
  827.   if (lowLimit() != aValue->lowLimit()) {
  828.     return true;
  829.   } /* endif */
  830.   if (highLimit() != aValue->highLimit()) {
  831.     return true;
  832.   } /* endif */
  833.   return false;
  834. }
  835.