blob: 38449bd5aa0fa1f20f157e4216a7fa7e0f48846a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "result.h"
#include <ostream>
namespace document::select {
Result Result::Invalid;
Result Result::False;
Result Result::True;
Result::Result() = default;
const Result&
Result::operator!() const {
if (this == &Invalid) {
return Invalid;
}
return (this == &True ? False : True);
}
const Result&
Result::operator&&(const Result& r) const {
if (this == &False || &r == &False) {
return False;
}
return (this == &True && &r == &True ? True : Invalid);
}
const Result&
Result::operator||(const Result& r) const {
if (this == &True || &r == &True) {
return True;
}
if (this == &Invalid || &r == &Invalid) {
return Invalid;
}
return False;
}
void
Result::print(std::ostream& out, bool,
const std::string&) const
{
if (this == &Invalid) out << "Invalid";
else if (this == &True) out << "True";
else out << "False";
}
}
|