00001 00023 #ifndef INC_MI32_BOOL3_H 00024 #define INC_MI32_BOOL3_H 00025 00026 00028 enum BOOL3_VALUE { 00029 BOOL3_Unknown = -1, 00030 BOOL3_False = 0, 00031 BOOL3_True = 1 00032 }; 00033 00035 inline BOOL3_VALUE operator! (BOOL3_VALUE rhs) 00036 { return ((rhs == BOOL3_False) ? BOOL3_True : (rhs == BOOL3_True) ? BOOL3_False : BOOL3_Unknown); } 00037 00039 inline BOOL3_VALUE operator&& (BOOL3_VALUE lhs, BOOL3_VALUE rhs) 00040 { return ((lhs == BOOL3_False || rhs == BOOL3_False) ? BOOL3_False : (lhs == BOOL3_True && rhs == BOOL3_True) ? BOOL3_True : BOOL3_Unknown); } 00041 00043 inline BOOL3_VALUE operator|| (BOOL3_VALUE lhs, BOOL3_VALUE rhs) 00044 { return ((lhs == BOOL3_True || rhs == BOOL3_True) ? BOOL3_True : (lhs == BOOL3_False && rhs == BOOL3_False) ? BOOL3_False : BOOL3_Unknown); } 00045 00046 00049 class BOOL3 { 00050 public: 00051 00053 BOOL3 ( 00054 BOOL3_VALUE value = BOOL3_Unknown 00055 ) : m_value(static_cast<signed char>(value)) { } 00056 00058 BOOL3 ( 00059 bool value 00060 ) : m_value(value ? 1 : 0) { } 00061 00063 BOOL3& operator= ( 00064 BOOL3_VALUE value 00065 ) { m_value = static_cast<signed char>(value); return (*this); } 00066 00068 BOOL3& operator= ( 00069 bool value 00070 ) { m_value = (value ? 1 : 0); return (*this); } 00071 00073 operator BOOL3_VALUE ( 00074 ) const { return (static_cast<BOOL3_VALUE>(m_value)); } 00075 00076 private: 00077 #ifndef GENERATING_DOXYGEN_OUTPUT 00078 signed char m_value; 00079 #endif 00080 }; 00081 00082 #endif // INC_MI32_BOOL3_H
1.6.1