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

  1. **
  2. **  PROGRAM TITLE  : BOOLEAN
  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. #include "oclip.ch"
  11.  
  12.  
  13. // Simple low-level class for boolean objects
  14. CLASS Boolean
  15.    VAR lWhether                           // The "value" of the object (.t./.f.)
  16.    METHOD New = BooleanNew                // Constructor
  17.    METHOD Destruct = BooleanDestruct      // Destructor
  18.    METHOD Value = BooleanValue            // Put and get boolean value
  19. ENDCLASS
  20.  
  21.  
  22. *******************************************************
  23. *
  24. *                             BooleanNew
  25. *
  26. *******************************************************
  27. * Construct Boolean object.  If no value given, defaults to .f.
  28. *
  29. METHOD FUNCTION BooleanNew(lInitialValue)
  30.  
  31. ::Value(if(lInitialValue == nil, .f., lInitialValue))
  32.  
  33. return Self
  34.  
  35.  
  36. *******************************************************
  37. *
  38. *                             BooleanDestruct
  39. *
  40. *******************************************************
  41. * Destruct Boolean object.  (no-op)
  42. *
  43. METHOD FUNCTION BooleanDestruct
  44.  
  45. return nil
  46.  
  47.  
  48. *******************************************************
  49. *
  50. *                             BooleanValue
  51. *
  52. *******************************************************
  53. * Return whether last search succeeded.  If argument is provided, set
  54. * instance variable to that value.  Regardless, return the current value.
  55. * Note: lWhether is different than ::lWhether.
  56. *
  57. METHOD FUNCTION BooleanValue(lWhether)
  58.  
  59. if lWhether != nil
  60.    ::lWhether := lWhether
  61. endif
  62.  
  63. return ::lWhether
  64.