-
Notifications
You must be signed in to change notification settings - Fork 248
/
Copy pathOrQuery.h
43 lines (35 loc) · 1.26 KB
/
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
40
41
42
43
#ifndef ORQUERY_H
#define ORQUERY_H
class TextQuery;
class QueryResult;
#if DEBUG_LEVEL >= 1
#include <iostream>
#endif
#include <string>
#include "BinaryQuery.h"
class OrQuery : public BinaryQuery {
friend Query operator|(const Query &, const Query &);
// OrQuery(const Query &l, const Query &r) : BinaryQuery(l, r, "|") {
//#if DEBUG_LEVEL >= 1
// std::cout << "OrQuery::OrQuery(const Query &, const Query &)" << std::endl;
//#endif
// }
OrQuery(std::shared_ptr<Query_base> pl, std::shared_ptr<Query_base> pr)
: BinaryQuery(pl, pr, "|") {
#if DEBUG_LEVEL >= 1
std::cout << "OrQuery::OrQuery(std::shared_ptr<Query_base>, "
"std::shared_ptr<Query_base>)" << std::endl;
#endif
}
QueryResult eval(const TextQuery &) const override;
};
// NOTE The `operator|` should not be `inline` here and should be put into
// seperate implementation file. Otherwise, we must include this header in all
// files where we want to use this operator. And since this header is not part
// of the interface, its a bad idea to have the user include this header in
// user code.
//inline Query operator|(const Query &lhs, const Query &rhs) {
// return std::shared_ptr<Query_base>(new OrQuery(lhs, rhs));
//}
Query operator|(const Query &, const Query &);
#endif