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