1 | |
---|
2 | #ifndef __BOOLVALUE_H__ |
---|
3 | #define __BOOLVALUE_H__ |
---|
4 | |
---|
5 | #include <iostream> |
---|
6 | |
---|
7 | |
---|
8 | class BoolValue { |
---|
9 | public: |
---|
10 | enum Value { Zero=0, One=1, Undefined=2 }; |
---|
11 | public: |
---|
12 | BoolValue (); |
---|
13 | BoolValue ( int ); |
---|
14 | ~BoolValue (); |
---|
15 | void print ( std::ostream& ) const; |
---|
16 | int toInt () const; |
---|
17 | void fromInt ( int ); |
---|
18 | private: |
---|
19 | int _value; |
---|
20 | |
---|
21 | friend bool operator == ( const BoolValue& lhs, const BoolValue& rhs ); |
---|
22 | }; |
---|
23 | |
---|
24 | |
---|
25 | BoolValue operator not ( const BoolValue& lhs ); |
---|
26 | BoolValue operator and ( const BoolValue& lhs, const BoolValue& rhs ); |
---|
27 | BoolValue operator or ( const BoolValue& lhs, const BoolValue& rhs ); |
---|
28 | BoolValue operator xor ( const BoolValue& lhs, const BoolValue& rhs ); |
---|
29 | bool operator == ( const BoolValue& lhs, const BoolValue& rhs ); |
---|
30 | |
---|
31 | inline std::ostream& operator<< ( std::ostream& o, const BoolValue& v ) { v.print(o); return o; } |
---|
32 | |
---|
33 | #endif // __BOOLVALUE_H__ |
---|