home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / VISBUILD / VBSAMPLE / IVBSHORT.CPP < prev    next >
Text File  |  1995-05-12  |  38KB  |  801 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) C++ for OS/2(R), Version 3                            *
  10. *   (C) Copyright IBM Corporation 1991, 1995.                                  *
  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.   setValue(aIVBShortPart.value());
  80.   setDefaultValue(aIVBShortPart.defaultValue());
  81.   setLowLimit(aIVBShortPart.lowLimit());
  82.   setHighLimit(aIVBShortPart.highLimit());
  83.   return *this;
  84. }
  85.  
  86. /*------------------------------------------------------------------------------
  87. | IVBShortPart::~IVBShortPart                                                  |
  88. |                                                                              |
  89. | IVBShortPart destructor.                                                     |
  90. ------------------------------------------------------------------------------*/
  91. #pragma export (IVBShortPart::~IVBShortPart(),, 2603)
  92. IVBShortPart::~IVBShortPart()
  93. {
  94. }
  95.  
  96. /*------------------------------------------------------------------------------
  97. | IVBShortPart::asString                                                       |
  98. |                                                                              |
  99. | Perform asString.                                                            |
  100. ------------------------------------------------------------------------------*/
  101. #pragma export (IVBShortPart::asString() const,, 2604)
  102. IString IVBShortPart::asString () const
  103. {
  104.   return valueAsText();
  105. }
  106.  
  107. /*------------------------------------------------------------------------------
  108. | IVBShortPart::value                                                          |
  109. |                                                                              |
  110. | Return the value attribute.                                                  |
  111. ------------------------------------------------------------------------------*/
  112. #pragma export (IVBShortPart::value() const,, 2605)
  113. short IVBShortPart::value () const
  114. {
  115.   return iValue;
  116. }
  117.  
  118. /*------------------------------------------------------------------------------
  119. | IVBShortPart::setValue                                                       |
  120. |                                                                              |
  121. | Set the value attribute.                                                     |
  122. ------------------------------------------------------------------------------*/
  123. #pragma export (IVBShortPart::setValue(const short),, 2606)
  124. IVBShortPart& IVBShortPart::setValue (short aValue)
  125. {
  126.   if (iValue != aValue) {
  127.     short oldValue = iValue;
  128.     iValue = aValue;
  129.     notifyObservers(INotificationEvent(valueId, *this,
  130.                     true, (void*)iValue));
  131.     if (iValue < 0) {
  132.       if (!(oldValue < 0)) {
  133.         notifyObservers(INotificationEvent(valueNegativeId, *this,
  134.                         true, (void*)iValue));
  135.       } ; /* endif */
  136.     } ;
  137.     if (iValue > 0) {
  138.       if (!(oldValue > 0)) {
  139.         notifyObservers(INotificationEvent(valuePositiveId, *this,
  140.                         true, (void*)iValue));
  141.       } ; /* endif */
  142.     } ; /* endif */
  143.     if (iValue == 0) {
  144.       notifyObservers(INotificationEvent(valueZeroId, *this,
  145.                       true, (void*)iValue));
  146.     }
  147.     else {
  148.       if (oldValue == 0) {
  149.         notifyObservers(INotificationEvent(valueNotZeroId, *this,
  150.                         true, (void*)iValue));
  151.       } ; /* endif */
  152.     } ; /* endif */
  153.     if (iDefaultValue == iValue) {
  154.       notifyObservers(INotificationEvent(valueEqualDefaultId, *this,
  155.                       true, (void*)iValue));
  156.     }
  157.     else {
  158.       if (iDefaultValue == oldValue) {
  159.         notifyObservers(INotificationEvent(valueNotEqualDefaultId, *this,
  160.                         true, (void*)iValue));
  161.       } /* endif */
  162.     } /* endif */
  163.     if (iValue == iLowLimit) {
  164.       notifyObservers(INotificationEvent(valueEqualLowLimitId, *this,
  165.                       true, (void*)iValue));
  166.     } ; /* endif */
  167.     if (iLowLimit != SHRT_MIN) {
  168.       if (iValue < iLowLimit) {
  169.         if (!(oldValue < iLowLimit)) {
  170.           notifyObservers(INotificationEvent(valueBelowLowLimitId, *this,
  171.                           true, (void*)iValue));
  172.         } ; /* endif */
  173.       } ; /* endif */
  174.     } ; /* endif */
  175.     if (iValue == iHighLimit) {
  176.       notifyObservers(INotificationEvent(valueEqualHighLimitId, *this,
  177.                       true, (void*)iValue));
  178.     } ; /* endif */
  179.     if (iHighLimit != SHRT_MAX) {
  180.       if (iValue > iHighLimit) {
  181.         if (!(oldValue > iHighLimit)) {
  182.           notifyObservers(INotificationEvent(valueAboveHighLimitId, *this,
  183.                           true, (void*)iValue));
  184.         } ; /* endif */
  185.       } ; /* endif */
  186.     } ; /* endif */
  187.     if ((iValue >= iLowLimit) && (iValue <= iHighLimit)) {
  188.       if (!((oldValue >= iLowLimit) && (oldValue <= iHighLimit))) {
  189.         notifyObservers(INotificationEvent(valueWithinLimitsId, *this,
  190.                         true, (void*)iValue));
  191.       } ; /* endif */
  192.     }
  193.     else {
  194.       if (((oldValue >= iLowLimit) && (oldValue <= iHighLimit))) {
  195.         notifyObservers(INotificationEvent(valueOutsideLimitsId, *this,
  196.                         true, (void*)iValue));
  197.       } ; /* endif */
  198.     } ; /* endif */
  199.   } ; /* endif */
  200.   return *this;
  201. }
  202.  
  203. /*------------------------------------------------------------------------------
  204. | IVBShortPart::setValue                                                       |
  205. |                                                                              |
  206. | Set the value attribute.                                                     |
  207. ------------------------------------------------------------------------------*/
  208. #pragma export (IVBShortPart::setValue(),, 2607)
  209. IVBShortPart& IVBShortPart::setValue ()
  210. {
  211.   return setValue(defaultValue());
  212. }
  213.  
  214. /*------------------------------------------------------------------------------
  215. | IVBShortPart::valueAsText                                                    |
  216. |                                                                              |
  217. | Return the valueAsText attribute.                                            |
  218. ------------------------------------------------------------------------------*/
  219. #pragma export (IVBShortPart::valueAsText() const,, 2608)
  220. IString IVBShortPart::valueAsText () const
  221. {
  222.   return IString (value());
  223. }
  224.  
  225. /*------------------------------------------------------------------------------
  226. | IVBShortPart::setValueAsText                                                 |
  227. |                                                                              |
  228. | Set the valueAsText attribute.                                               |
  229. ------------------------------------------------------------------------------*/
  230. #pragma export (IVBShortPart::setValueAsText(const IString&),, 2609)
  231. IVBShortPart& IVBShortPart::setValueAsText (const IString& aValueAsText)
  232. {
  233.   setValue (aValueAsText.asInt());
  234.   Boolean iValid = aValueAsText.indexOfAnyBut("+-0123456789 ");
  235.   if (iValid) {
  236.     IString eventData(aValueAsText);
  237.     notifyObservers(INotificationEvent(inputStringNotValidId, *this,
  238.                       true, (void*)&eventData));
  239.   } else {
  240.     IString eventData(aValueAsText);
  241.     notifyObservers(INotificationEvent(inputStringIsValidId, *this,
  242.                       true, (void*)&eventData));
  243.   } /* endif */
  244.   return *this;
  245. }
  246.  
  247. /*------------------------------------------------------------------------------
  248. | IVBShortPart::setValueAsText                                                 |
  249. |                                                                              |
  250. | Set the valueAsText attribute.                                               |
  251. ------------------------------------------------------------------------------*/
  252. #pragma export (IVBShortPart::setValueAsText(const IString*),, 2610)
  253. IVBShortPart& IVBShortPart::setValueAsText (const IString* aValueAsText)
  254. {
  255.   return setValueAsText (*aValueAsText);
  256. }
  257.  
  258. /*------------------------------------------------------------------------------
  259. | IVBShortPart::valueAs1Based                                                  |
  260. |                                                                              |
  261. | Return the valueAs1Based attribute.                                          |
  262. ------------------------------------------------------------------------------*/
  263. #pragma export (IVBShortPart::valueAs1Based() const,, 2611)
  264. short IVBShortPart::valueAs1Based () const
  265. {
  266.   return (value() + 1) ;
  267. }
  268.  
  269. /*------------------------------------------------------------------------------
  270. | IVBShortPart::setValueAs1Based                                               |
  271. |                                                                              |
  272. | Set the valueAs1Based attribute.                                             |
  273. ------------------------------------------------------------------------------*/
  274. #pragma export (IVBShortPart::setValueAs1Based(short),, 2612)
  275. IVBShortPart& IVBShortPart::setValueAs1Based (short aValueAs1Based)
  276. {
  277.   return setValue (aValueAs1Based - 1);
  278. }
  279.  
  280. /*------------------------------------------------------------------------------
  281. | IVBShortPart::defaultValue                                                   |
  282. |                                                                              |
  283. | Return the defaultValue attribute.                                           |
  284. ------------------------------------------------------------------------------*/
  285. #pragma export (IVBShortPart::defaultValue() const,, 2613)
  286. short IVBShortPart::defaultValue () const
  287. {
  288.   return iDefaultValue;
  289. }
  290.  
  291. /*------------------------------------------------------------------------------
  292. | IVBShortPart::setDefaultValue                                                |
  293. |                                                                              |
  294. | Set the defaultValue attribute.                                              |
  295. ------------------------------------------------------------------------------*/
  296. #pragma export (IVBShortPart::setDefaultValue(const short),, 2614)
  297. IVBShortPart& IVBShortPart::setDefaultValue (short aDefaultValue)
  298. {
  299.   if (iDefaultValue != aDefaultValue) {
  300.     short oldValue = iDefaultValue;
  301.     iDefaultValue = aDefaultValue;
  302.     notifyObservers(INotificationEvent(defaultValueId, *this,
  303.                       true, (void*)iDefaultValue));
  304.     if (iDefaultValue == iValue) {
  305.       notifyObservers(INotificationEvent(valueEqualDefaultId, *this,
  306.                       true, (void*)iValue));
  307.     }
  308.     else {
  309.       if (oldValue == iValue) {
  310.         notifyObservers(INotificationEvent(valueNotEqualDefaultId, *this,
  311.                         true, (void*)iValue));
  312.       } /* endif */
  313.     } /* endif */
  314.   } /* endif */
  315.   return *this;
  316. }
  317.  
  318. /*------------------------------------------------------------------------------
  319. | IVBShortPart::isValueEqualDefault                                            |
  320. |                                                                              |
  321. | Return the valueEqualDefault attribute.                                      |
  322. ------------------------------------------------------------------------------*/
  323. #pragma export (IVBShortPart::isValueEqualDefault() const,, 2615)
  324. Boolean IVBShortPart::isValueEqualDefault () const
  325. {
  326.   return (value() == defaultValue ()) ;
  327. }
  328.  
  329. /*------------------------------------------------------------------------------
  330. | IVBShortPart::isValueNotEqualDefault                                         |
  331. |                                                                              |
  332. | Return the valueNotEqualDefault attribute.                                   |
  333. ------------------------------------------------------------------------------*/
  334. #pragma export (IVBShortPart::isValueNotEqualDefault() const,, 2616)
  335. Boolean IVBShortPart::isValueNotEqualDefault () const
  336. {
  337.   return (value() != defaultValue ()) ;
  338. }
  339.  
  340. /*------------------------------------------------------------------------------
  341. | IVBShortPart::lowLimit                                                       |
  342. |                                                                              |
  343. | Return the lowLimit attribute.                                               |
  344. ------------------------------------------------------------------------------*/
  345. #pragma export (IVBShortPart::lowLimit() const,, 2617)
  346. short IVBShortPart::lowLimit () const
  347. {
  348.   return iLowLimit;
  349. }
  350.  
  351. /*------------------------------------------------------------------------------
  352. | IVBShortPart::setLowLimit                                                    |
  353. |                                                                              |
  354. | Set the lowLimit attribute.                                                  |
  355. ------------------------------------------------------------------------------*/
  356. #pragma export (IVBShortPart::setLowLimit(const short),, 2618)
  357. IVBShortPart& IVBShortPart::setLowLimit (short aLowLimit)
  358. {
  359.   if (iLowLimit != aLowLimit) {
  360.     short oldValue = iLowLimit;
  361.     iLowLimit = aLowLimit;
  362.     notifyObservers(INotificationEvent(lowLimitId, *this,
  363.                       true, (void*)iLowLimit));
  364.     if (iValue == lowLimit()) {
  365.       notifyObservers(INotificationEvent(valueEqualLowLimitId, *this,
  366.                       true, (void*)iValue));
  367.     } ; /* endif */
  368.     if (lowLimit() != SHRT_MIN) {
  369.       if (iValue < iLowLimit) {
  370.         if (!(iValue < oldValue)) {
  371.           notifyObservers(INotificationEvent(valueBelowLowLimitId, *this,
  372.                           true, (void*)iValue));
  373.         } ; /* endif */
  374.       } ; /* endif */
  375.     } ; /* endif */
  376.     if ((iValue >= lowLimit()) && (iValue <= highLimit())) {
  377.       if (!((iValue >= oldValue) && (iValue <= highLimit()))) {
  378.         notifyObservers(INotificationEvent(valueWithinLimitsId, *this,
  379.                         true, (void*)iLowLimit));
  380.       } ; /* endif */
  381.     }
  382.     else {
  383.       if ((iValue >= oldValue) && (iValue <= highLimit())) {
  384.         notifyObservers(INotificationEvent(valueOutsideLimitsId, *this,
  385.                         true, (void*)iLowLimit));
  386.       } ; /* endif */
  387.     } ; /* endif */
  388.   } /* endif */
  389.   return *this;
  390. }
  391.  
  392. /*------------------------------------------------------------------------------
  393. | IVBShortPart::highLimit                                                      |
  394. |                                                                              |
  395. | Return the highLimit attribute.                                              |
  396. ------------------------------------------------------------------------------*/
  397. #pragma export (IVBShortPart::highLimit() const,, 2619)
  398. short IVBShortPart::highLimit () const
  399. {
  400.   return iHighLimit;
  401. }
  402.  
  403. /*------------------------------------------------------------------------------
  404. | IVBShortPart::setHighLimit                                                   |
  405. |                                                                              |
  406. | Set the highLimit attribute.                                                 |
  407. ------------------------------------------------------------------------------*/
  408. #pragma export (IVBShortPart::setHighLimit(const short),, 2620)
  409. IVBShortPart& IVBShortPart::setHighLimit (short aHighLimit)
  410. {
  411.   if (iHighLimit != aHighLimit) {
  412.     short oldValue = iHighLimit;
  413.     iHighLimit = aHighLimit;
  414.     notifyObservers(INotificationEvent(highLimitId, *this,
  415.                       true, (void*)iHighLimit));
  416.     if (iValue == highLimit()) {
  417.       notifyObservers(INotificationEvent(valueEqualHighLimitId, *this,
  418.                       true, (void*)iValue));
  419.     } ; /* endif */
  420.     if (highLimit() != SHRT_MAX) {
  421.       if (iValue > iHighLimit) {
  422.         if (!(iValue > oldValue)) {
  423.           notifyObservers(INotificationEvent(valueAboveHighLimitId, *this,
  424.                           true, (void*)iValue));
  425.         } ; /* endif */
  426.       } ; /* endif */
  427.     } ; /* endif */
  428.     if ((iValue >= lowLimit()) && (iValue <= highLimit())) {
  429.       if (!((iValue >= lowLimit()) && (iValue <= oldValue))) {
  430.         notifyObservers(INotificationEvent(valueWithinLimitsId, *this,
  431.                         true, (void*)iHighLimit));
  432.       } ; /* endif */
  433.     }
  434.     else {
  435.       if ((iValue >= lowLimit()) && (iValue <= oldValue)) {
  436.         notifyObservers(INotificationEvent(valueOutsideLimitsId, *this,
  437.                         true, (void*)iHighLimit));
  438.       } ; /* endif */
  439.     } ; /* endif */
  440.   } /* endif */
  441.   return *this;
  442. }
  443.  
  444. /*------------------------------------------------------------------------------
  445. | IVBShortPart::isValueEqualLowLimit                                           |
  446. |                                                                              |
  447. | Return the valueEqualLowLimit attribute.                                     |
  448. ------------------------------------------------------------------------------*/
  449. #pragma export (IVBShortPart::isValueEqualLowLimit() const,, 2621)
  450. Boolean IVBShortPart::isValueEqualLowLimit () const
  451. {
  452.   return (value() == lowLimit ()) ;
  453. }
  454.  
  455. /*------------------------------------------------------------------------------
  456. | IVBShortPart::isValueEqualHighLimit                                          |
  457. |                                                                              |
  458. | Return the valueEqualHighLimit attribute.                                    |
  459. ------------------------------------------------------------------------------*/
  460. #pragma export (IVBShortPart::isValueEqualHighLimit() const,, 2622)
  461. Boolean IVBShortPart::isValueEqualHighLimit () const
  462. {
  463.   return (value() == highLimit ()) ;
  464. }
  465.  
  466. /*------------------------------------------------------------------------------
  467. | IVBShortPart::isValueBelowLowLimit                                           |
  468. |                                                                              |
  469. | Return the valueBelowLowLimit attribute.                                     |
  470. ------------------------------------------------------------------------------*/
  471. #pragma export (IVBShortPart::isValueBelowLowLimit() const,, 2623)
  472. Boolean IVBShortPart::isValueBelowLowLimit () const
  473. {
  474.   return (value() < lowLimit ()) ;
  475. }
  476.  
  477. /*------------------------------------------------------------------------------
  478. | IVBShortPart::isValueAboveHighLimit                                          |
  479. |                                                                              |
  480. | Return the valueAboveHighLimit attribute.                                    |
  481. ------------------------------------------------------------------------------*/
  482. #pragma export (IVBShortPart::isValueAboveHighLimit() const,, 2624)
  483. Boolean IVBShortPart::isValueAboveHighLimit () const
  484. {
  485.   return (value() > highLimit ()) ;
  486. }
  487.  
  488. /*------------------------------------------------------------------------------
  489. | IVBShortPart::isValueOutsideLimits                                           |
  490. |                                                                              |
  491. | Return the valueOutsideLimits attribute.                                     |
  492. ------------------------------------------------------------------------------*/
  493. #pragma export (IVBShortPart::isValueOutsideLimits() const,, 2625)
  494. Boolean IVBShortPart::isValueOutsideLimits () const
  495. {
  496.   return ((value() < lowLimit()) || (value() > highLimit())) ;
  497. }
  498.  
  499. /*------------------------------------------------------------------------------
  500. | IVBShortPart::isValueWithinLimits                                            |
  501. |                                                                              |
  502. | Return the valueWithinLimits attribute.                                      |
  503. ------------------------------------------------------------------------------*/
  504. #pragma export (IVBShortPart::isValueWithinLimits() const,, 2626)
  505. Boolean IVBShortPart::isValueWithinLimits () const
  506. {
  507.   return !isValueOutsideLimits ();
  508. }
  509.  
  510. /*------------------------------------------------------------------------------
  511. | IVBShortPart::isValueNotZero                                                 |
  512. |                                                                              |
  513. | Return the valueNotZero attribute.                                           |
  514. ------------------------------------------------------------------------------*/
  515. #pragma export (IVBShortPart::isValueNotZero() const,, 2627)
  516. Boolean IVBShortPart::isValueNotZero () const
  517. {
  518.   return (value() != 0) ;
  519. }
  520.  
  521. /*------------------------------------------------------------------------------
  522. | IVBShortPart::isValueZero                                                    |
  523. |                                                                              |
  524. | Return the valueZero attribute.                                              |
  525. ------------------------------------------------------------------------------*/
  526. #pragma export (IVBShortPart::isValueZero() const,, 2628)
  527. Boolean IVBShortPart::isValueZero () const
  528. {
  529.   return (value() == 0) ;
  530. }
  531.  
  532. /*------------------------------------------------------------------------------
  533. | IVBShortPart::isValuePositive                                                |
  534. |                                                                              |
  535. | Return the valuePositive attribute.                                          |
  536. ------------------------------------------------------------------------------*/
  537. #pragma export (IVBShortPart::isValuePositive() const,, 2629)
  538. Boolean IVBShortPart::isValuePositive () const
  539. {
  540.   return (value() > 0) ;
  541. }
  542.  
  543. /*------------------------------------------------------------------------------
  544. | IVBShortPart::isValueNegative                                                |
  545. |                                                                              |
  546. | Return the valueNegative attribute.                                          |
  547. ------------------------------------------------------------------------------*/
  548. #pragma export (IVBShortPart::isValueNegative() const,, 2630)
  549. Boolean IVBShortPart::isValueNegative () const
  550. {
  551.   return (value() < 0) ;
  552. }
  553.  
  554. /*------------------------------------------------------------------------------
  555. | IVBShortPart::assignValueToZero                                              |
  556. |                                                                              |
  557. | Assign the value attribute to 0.                                             |
  558. ------------------------------------------------------------------------------*/
  559. #pragma export (IVBShortPart::assignValueToZero(),, 2631)
  560. IVBShortPart& IVBShortPart::assignValueToZero ()
  561. {
  562.   return setValue (0) ;
  563. }
  564.  
  565. /*------------------------------------------------------------------------------
  566. | IVBShortPart::assignValueToOne                                               |
  567. |                                                                              |
  568. | Assign the value attribute to 1.                                             |
  569. ------------------------------------------------------------------------------*/
  570. #pragma export (IVBShortPart::assignValueToOne(),, 2632)
  571. IVBShortPart& IVBShortPart::assignValueToOne ()
  572. {
  573.   return setValue (1) ;
  574. }
  575.  
  576. /*------------------------------------------------------------------------------
  577. | IVBShortPart::assignValueToLowLimit                                          |
  578. |                                                                              |
  579. | Assign the value attribute to low limit attribute.                           |
  580. ------------------------------------------------------------------------------*/
  581. #pragma export (IVBShortPart::assignValueToLowLimit(),, 2633)
  582. IVBShortPart& IVBShortPart::assignValueToLowLimit ()
  583. {
  584.   return setValue (lowLimit()) ;
  585. }
  586.  
  587. /*------------------------------------------------------------------------------
  588. | IVBShortPart::assignValueToHighLimit                                         |
  589. |                                                                              |
  590. | Assign the value attribute to high limit attribute.                          |
  591. ------------------------------------------------------------------------------*/
  592. #pragma export (IVBShortPart::assignValueToHighLimit(),, 2634)
  593. IVBShortPart& IVBShortPart::assignValueToHighLimit ()
  594. {
  595.   return setValue (highLimit()) ;
  596. }
  597.  
  598. /*------------------------------------------------------------------------------
  599. | IVBShortPart::assignValueToDefault                                           |
  600. |                                                                              |
  601. | Assign the value attribute to default.                                       |
  602. ------------------------------------------------------------------------------*/
  603. #pragma export (IVBShortPart::assignValueToDefault(),, 2635)
  604. IVBShortPart& IVBShortPart::assignValueToDefault ()
  605. {
  606.   return setValue (defaultValue ()) ;
  607. }
  608.  
  609. /*------------------------------------------------------------------------------
  610. | IVBShortPart::assignValueToRandom                                            |
  611. |                                                                              |
  612. | Assign the value attribute to a pseudo-random number.                        |
  613. ------------------------------------------------------------------------------*/
  614. #pragma export (IVBShortPart::assignValueToRandom(),, 2636)
  615. IVBShortPart& IVBShortPart::assignValueToRandom ()
  616. {
  617.   return setValue (rand ()) ;
  618. }
  619.  
  620. /*------------------------------------------------------------------------------
  621. | IVBShortPart::copyValueToDefault                                             |
  622. |                                                                              |
  623. | Copy the value attribute to default.                                         |
  624. ------------------------------------------------------------------------------*/
  625. #pragma export (IVBShortPart::copyValueToDefault(),, 2637)
  626. IVBShortPart& IVBShortPart::copyValueToDefault ()
  627. {
  628.   return setDefaultValue (value()) ;
  629. }
  630.  
  631. /*------------------------------------------------------------------------------
  632. | IVBShortPart::squareValue                                                    |
  633. |                                                                              |
  634. | Square the value attribute.                                                  |
  635. ------------------------------------------------------------------------------*/
  636. #pragma export (IVBShortPart::squareValue(),, 2638)
  637. IVBShortPart& IVBShortPart::squareValue()
  638. {
  639.   return setValue (value() * value()) ;
  640. }
  641.  
  642. /*------------------------------------------------------------------------------
  643. | IVBShortPart::addValue                                                       |
  644. |                                                                              |
  645. | Perform the add operator to the value attribute.                             |
  646. ------------------------------------------------------------------------------*/
  647. #pragma export (IVBShortPart::addValue (short),, 2639)
  648. IVBShortPart& IVBShortPart::addValue (short addValue)
  649. {
  650.   return setValue (value() + addValue) ;
  651. }
  652.  
  653. /*------------------------------------------------------------------------------
  654. | IVBShortPart::subtractValue                                                  |
  655. |                                                                              |
  656. | Perform the subtract operator to the value attribute.                        |
  657. ------------------------------------------------------------------------------*/
  658. #pragma export (IVBShortPart::subtractValue (short),, 2640)
  659. IVBShortPart& IVBShortPart::subtractValue (short subtractValue)
  660. {
  661.   return setValue (value() - subtractValue) ;
  662. }
  663.  
  664. /*------------------------------------------------------------------------------
  665. | IVBShortPart::multiplyValue                                                  |
  666. |                                                                              |
  667. | Perform the multiply operator to the value attribute.                        |
  668. ------------------------------------------------------------------------------*/
  669. #pragma export (IVBShortPart::multiplyValue (short),, 2641)
  670. IVBShortPart& IVBShortPart::multiplyValue (short multiplyValue)
  671. {
  672.   return setValue (value() * multiplyValue) ;
  673. }
  674.  
  675. /*------------------------------------------------------------------------------
  676. | IVBShortPart::divideValue                                                   |
  677. |                                                                             |
  678. | Perform the divide operator to the value attribute.                         |
  679. ------------------------------------------------------------------------------*/
  680. #pragma export (IVBShortPart::divideValue (short),, 2642)
  681. IVBShortPart& IVBShortPart::divideValue (short divideValue)
  682. {
  683.   if (divideValue)
  684.     return setValue (value() / divideValue) ;
  685.   return *this;
  686. }
  687.  
  688. /*------------------------------------------------------------------------------
  689. | IVBShortPart::andValue                                                       |
  690. |                                                                              |
  691. | Perform the and operator to the value attribute.                             |
  692. ------------------------------------------------------------------------------*/
  693. #pragma export (IVBShortPart::andValue (short),, 2643)
  694. IVBShortPart& IVBShortPart::andValue (short andValue)
  695. {
  696.   return setValue (value() & andValue) ;
  697. }
  698.  
  699. /*------------------------------------------------------------------------------
  700. | IVBShortPart::orValue                                                        |
  701. |                                                                              |
  702. | Perform the or operator to the value attribute.                              |
  703. ------------------------------------------------------------------------------*/
  704. #pragma export (IVBShortPart::orValue (short),, 2644)
  705. IVBShortPart& IVBShortPart::orValue (short orValue)
  706. {
  707.   return setValue (value() | orValue) ;
  708. }
  709.  
  710. /*------------------------------------------------------------------------------
  711. | IVBShortPart::operator == (const IVBShortPart & aValue)                      |
  712. |                                                                              |
  713. ------------------------------------------------------------------------------*/
  714. #pragma export (IVBShortPart::operator == (const IVBShortPart&) const,, 2645)
  715. Boolean IVBShortPart::
  716.   operator == (const IVBShortPart& aValue) const
  717. {
  718.   if (value() != aValue.value()) {
  719.     return false;
  720.   } /* endif */
  721.   if (defaultValue() != aValue.defaultValue()) {
  722.     return false;
  723.   } /* endif */
  724.   if (lowLimit() != aValue.lowLimit()) {
  725.     return false;
  726.   } /* endif */
  727.   if (highLimit() != aValue.highLimit()) {
  728.     return false;
  729.   } /* endif */
  730.   return true;
  731. }
  732.  
  733. /*------------------------------------------------------------------------------
  734. | IVBShortPart::operator != (const IVBShortPart & aValue)                      |
  735. |                                                                              |
  736. ------------------------------------------------------------------------------*/
  737. #pragma export (IVBShortPart::operator != (const IVBShortPart&) const,, 2646)
  738. Boolean IVBShortPart::
  739.   operator != (const IVBShortPart& aValue) const
  740. {
  741.   if (value() != aValue.value()) {
  742.     return true;
  743.   } /* endif */
  744.   if (defaultValue() != aValue.defaultValue()) {
  745.     return true;
  746.   } /* endif */
  747.   if (lowLimit() != aValue.lowLimit()) {
  748.     return true;
  749.   } /* endif */
  750.   if (highLimit() != aValue.highLimit()) {
  751.     return true;
  752.   } /* endif */
  753.   return false;
  754. }
  755.  
  756. /*------------------------------------------------------------------------------
  757. | IVBShortPart::operator == (const IVBShortPart * aValue)                      |
  758. |                                                                              |
  759. ------------------------------------------------------------------------------*/
  760. #pragma export (IVBShortPart::operator == (const IVBShortPart*) const,, 2647)
  761. Boolean IVBShortPart::
  762.   operator == (const IVBShortPart* aValue) const
  763. {
  764.   if (value() != aValue->value()) {
  765.     return false;
  766.   } /* endif */
  767.   if (defaultValue() != aValue->defaultValue()) {
  768.     return false;
  769.   } /* endif */
  770.   if (lowLimit() != aValue->lowLimit()) {
  771.     return false;
  772.   } /* endif */
  773.   if (highLimit() != aValue->highLimit()) {
  774.     return false;
  775.   } /* endif */
  776.   return true;
  777. }
  778.  
  779. /*------------------------------------------------------------------------------
  780. | IVBShortPart::operator != (const IVBShortPart * aValue)                      |
  781. |                                                                              |
  782. ------------------------------------------------------------------------------*/
  783. #pragma export (IVBShortPart::operator != (const IVBShortPart*) const,, 2648)
  784. Boolean IVBShortPart::
  785.   operator != (const IVBShortPart* aValue) const
  786. {
  787.   if (value() != aValue->value()) {
  788.     return true;
  789.   } /* endif */
  790.   if (defaultValue() != aValue->defaultValue()) {
  791.     return true;
  792.   } /* endif */
  793.   if (lowLimit() != aValue->lowLimit()) {
  794.     return true;
  795.   } /* endif */
  796.   if (highLimit() != aValue->highLimit()) {
  797.     return true;
  798.   } /* endif */
  799.   return false;
  800. }
  801.