forked from jaege/Cpp-Primer-5th-Exercises
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OrQuery.h
36 lines (28 loc) · 1009 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
#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
}
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