-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOrQuery.h
39 lines (33 loc) · 940 Bytes
/
OrQuery.h
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
#ifndef ORQUERY_H
#define ORQUERY_H
#include "BinaryQuery.h"
class OrQuery : public BinaryQuery {
friend Query operator|(const Query &, const Query &);
OrQuery(const Query &lhs, const Query &rhs) : BinaryQuery(lhs, rhs, "|") {}
QueryResult eval(const TextQuery &) const override;
OrQuery *clone() const override {
return new OrQuery(lhs, rhs);
}
// Copy constructor
OrQuery(const OrQuery &oq) : BinaryQuery(oq) {}
// Move constructor
OrQuery(OrQuery &&oq) noexcept : BinaryQuery(std::move(oq)) {}
// Copy-assignment operator
OrQuery &operator=(const OrQuery &rhs) {
BinaryQuery::operator=(rhs);
return *this;
}
// Move-assignment operator
OrQuery &operator=(OrQuery &&rhs) noexcept {
if (this != &rhs) {
BinaryQuery::operator=(std::move(rhs));
}
return *this;
}
// Destructor
~OrQuery() = default;
};
inline Query operator|(const Query &lhs, const Query &rhs) {
return new OrQuery(lhs, rhs);
}
#endif