forked from jaege/Cpp-Primer-5th-Exercises
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WordQuery.h
38 lines (31 loc) · 749 Bytes
/
WordQuery.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
#ifndef WORDQUERY_H
#define WORDQUERY_H
#if DEBUG_LEVEL >= 1
#include <iostream>
#endif
#include <string>
#include "TextQuery.h"
#include "QueryResult.h"
#include "Query_base.h"
class WordQuery : public Query_base {
friend class Query;
WordQuery(const std::string &s) : query_word(s) {
#if DEBUG_LEVEL >= 1
std::cout << "WordQuery::WordQuery(const std::string &)" << std::endl;
#endif
}
QueryResult eval(const TextQuery& t) const override {
#if DEBUG_LEVEL >= 1
std::cout << "WordQuery::eval" << std::endl;
#endif
return t.query(query_word);
}
std::string rep() const override {
#if DEBUG_LEVEL >= 1
std::cout << "WordQuery::rep" << std::endl;
#endif
return query_word;
}
std::string query_word;
};
#endif