home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / xbase / library / clipper / oop / oopexm / hboolean.prg next >
Encoding:
Text File  |  1992-01-27  |  1.5 KB  |  65 lines

  1. **
  2. **  PROGRAM TITLE  : HBOOLEAN
  3. **
  4. **   WRITTEN BY    :  Paul Long
  5. **
  6. **   WRITTEN FOR   :  Copyright (C) 1992 All rights reserved. XL Systems, Inc.
  7. **
  8. **   PROGRAM INTENT:  Boolean (true/false) class
  9. **
  10. **   NOTE:            This file uses a hybrid approach  It uses "traditional,"
  11. **                    non-OOP programming, but organizing the code along OOP
  12. **                    lines, e.g., one source file per "class."
  13. **
  14. #include "oclip.ch"
  15.  
  16.  
  17. CLASS Boolean
  18.    VAR lWhether
  19.    METHOD New = BooleanNew
  20.    METHOD Destruct = BooleanDestruct
  21.    METHOD Value = BooleanValue
  22. ENDCLASS
  23.  
  24.  
  25. *******************************************************
  26. *
  27. *                             BooleanNew
  28. *
  29. *******************************************************
  30. * Construct Boolean object
  31. *
  32. METHOD FUNCTION BooleanNew(lInitialValue)
  33.  
  34. ::Value(if(lInitialValue == nil, .f., lInitialValue))
  35.  
  36. return Self
  37.  
  38.  
  39. *******************************************************
  40. *
  41. *                             BooleanDestruct
  42. *
  43. *******************************************************
  44. * Destruct Boolean object
  45. *
  46. METHOD FUNCTION BooleanDestruct
  47.  
  48. return nil
  49.  
  50.  
  51. *******************************************************
  52. *
  53. *                             BooleanValue
  54. *
  55. *******************************************************
  56. * Return whether last search succeeded.
  57. *
  58. METHOD FUNCTION BooleanValue(lWhether)
  59.  
  60. if lWhether != nil
  61.    ::lWhether := lWhether
  62. endif
  63.  
  64. return ::lWhether
  65.