-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQueryResult.h
More file actions
26 lines (23 loc) · 855 Bytes
/
QueryResult.h
File metadata and controls
26 lines (23 loc) · 855 Bytes
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
#ifndef QUERYRESULT_H
#define QUERYRESULT_H
#include <string>
#include <vector>
#include <set>
#include <iostream>
class QueryResult {
friend std::ostream& print(std::ostream&, const QueryResult&);
public:
using line_no = std::vector<std::string>::size_type;
QueryResult(std::string s,
std::shared_ptr<std::set<line_no>> p,
std::shared_ptr<std::vector<std::string>> f):
sought(s), lines(p), file(f) { }
std::set<line_no>::iterator begin() {return lines->begin();}
std::set<line_no>::iterator end() {return lines->end();}
std::shared_ptr<std::vector<std::string>> get_file() { return file; }
private:
std::string sought; // word this query represents
std::shared_ptr<std::set<line_no>> lines; // lines it's on
std::shared_ptr<std::vector<std::string>> file; //input file
};
#endif