forked from jaege/Cpp-Primer-5th-Exercises
-
Notifications
You must be signed in to change notification settings - Fork 0
/
QueryResult.h
33 lines (27 loc) · 961 Bytes
/
QueryResult.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
#ifndef QUERYRESULT_H
#define QUERYRESULT_H
#include <iostream>
#include <memory>
#include <set>
#include <vector>
#include <string>
class QueryResult {
friend std::ostream &print(std::ostream &os, const QueryResult &qr);
public:
typedef std::vector<std::string>::size_type line_no_type;
//typedef TextQuery::line_no_type line_no_type;
explicit QueryResult(const std::string &wd)
: word(wd), total(0), line_numbers(), line_text() {}
QueryResult(const std::string &wd,
line_no_type t,
std::shared_ptr<const std::set<line_no_type>> lns,
std::shared_ptr<const std::vector<std::string>> lt)
: word(wd), total(t), line_numbers(lns), line_text(lt) {}
private:
std::string word;
line_no_type total;
std::shared_ptr<const std::set<line_no_type>> line_numbers;
std::shared_ptr<const std::vector<std::string>> line_text;
};
std::ostream &print(std::ostream &os, const QueryResult &qr);
#endif