Vita
trilean.h
Go to the documentation of this file.
1
13#if !defined(VITA_TRILEAN_H)
14#define VITA_TRILEAN_H
15
16#include <iostream>
17
18#include "kernel/common.h"
19
20namespace vita
21{
22
37enum class trilean {unknown = -1, no, yes};
38
39inline std::istream &operator>>(std::iostream &i, trilean &v)
40{
41 int tmp;
42
43 if (i >> tmp)
44 switch (tmp)
45 {
46 case 0: v = trilean::no; break;
47 case 1: v = trilean::yes; break;
48 default: v = trilean::unknown;
49 }
50
51 return i;
52}
53
54inline trilean &assign(trilean &lhs, bool rhs)
55{
56 return lhs = rhs ? trilean::yes : trilean::no;
57}
58
59} // namespace vita
60
61#endif // include guard
The main namespace for the project.
trilean
Three-valued logic enum.
Definition: trilean.h:37