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

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