/* This file contains the interface for class Boolean.

-------------------------------------------------------------------*/

#ifndef BOOLEAN
#define BOOLEAN

#include <iostream.h>

/********** the enumerated type BoolVal **********/

enum BoolVal {False, True};

/*************** the class Boolean ***************/

class Boolean
{
   BoolVal
      Val;

public:

   /***** Default constructor *****/
   Boolean() { Val = False; }

   /***** Type conversion from int *****/
   Boolean(int i) { Val = (i == 0) ? False : True; }

   /***** Type conversion from BoolVal *****/
   Boolean(BoolVal BV) { Val = BV; }

   /***** Type conversion to BoolVal *****/
   operator BoolVal() { return Val; }

   /***** Equality relation *****/
   friend int operator==(const Boolean& B1, const Boolean& B2)
   { return B1.Val == B2.Val; }

   /***** Inequality relation *****/
   friend int operator!= (const Boolean& B1, const Boolean& B2)
   { return B1.Val != B2.Val; }

   /***** Input I/O *****/
   friend ostream& operator<<(ostream& Out, const Boolean& B)
   {
       Out << ((B.Val == True) ? "True" : "False");
       return Out;
   }

   /***** Output I/O *****/
   friend istream& operator>>(istream& In, Boolean& B);

};

#endif

