forked from jaege/Cpp-Primer-5th-Exercises
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAndQuery.h
37 lines (29 loc) · 1.01 KB
/
AndQuery.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
#ifndef ANDQUERY_H
#define ANDQUERY_H
class TextQuery;
class QueryResult;
#if DEBUG_LEVEL >= 1
#include <iostream>
#endif
#include <string>
#include "BinaryQuery.h"
class AndQuery : public BinaryQuery {
friend Query operator&(const Query &, const Query &);
AndQuery(const Query &l, const Query &r) : BinaryQuery(l, r, "&") {
#if DEBUG_LEVEL >= 1
std::cout << "AndQuery::AndQuery(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 AndQuery(lhs, rhs));
//}
Query operator&(const Query &, const Query &);
#endif