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

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