50 |
|
|
51 |
|
#include "Outputter.hpp" |
52 |
|
|
53 |
< |
void Outputter::output(Searcher& searcher, unsigned page) |
53 |
> |
void Outputter::output(Searcher& searcher, size_t page) |
54 |
|
{ |
55 |
|
MultiSet pagesSet(searcher.getPages()); |
56 |
< |
|
56 |
> |
|
57 |
|
numWebpages = pagesSet.size(); |
58 |
|
numPages = (numWebpages + 9) / 10; |
59 |
|
|
100 |
|
footer(query, page, common, searcher.getAnd(), searcher.getOr(), ignore); |
101 |
|
} |
102 |
|
|
103 |
< |
void Outputter::header(const string& query, unsigned page, const vector<string>& |
103 |
> |
void Outputter::header(const string& query, size_t page, const vector<string>& |
104 |
|
common, bool and_, bool or_, const string& ignore) |
105 |
|
{ |
106 |
|
ifstream fin(headerFile.c_str()); |
189 |
|
} |
190 |
|
} |
191 |
|
|
192 |
< |
void Outputter::footer(const string& query, unsigned page, const vector<string>& |
192 |
> |
void Outputter::footer(const string& query, size_t page, const vector<string>& |
193 |
|
common, bool and_, bool or_, const string& ignore) |
194 |
|
{ |
195 |
|
ifstream fin(footerFile.c_str()); |
227 |
|
fin.close(); |
228 |
|
} |
229 |
|
|
230 |
< |
void Outputter::notfound(const string& query, unsigned keywords) |
230 |
> |
void Outputter::notfound(const string& query, size_t keywords) |
231 |
|
{ |
232 |
|
ifstream fin(notfoundFile.c_str()); |
233 |
|
string line; |
244 |
|
fin.close(); |
245 |
|
} |
246 |
|
|
247 |
< |
string Outputter::pages(string query, unsigned page) |
247 |
> |
string Outputter::pages(string query, size_t page) |
248 |
|
{ |
249 |
|
entities(query, "<", '<'); |
250 |
|
entities(query, ">", '>'); |
302 |
|
fin.close(); |
303 |
|
fin.clear(); |
304 |
|
|
305 |
< |
for (unsigned index(0); index < numPages; index++) |
305 |
> |
for (size_t index(0); index < numPages; index++) |
306 |
|
{ |
307 |
|
fin.open(pagesFile.c_str()); |
308 |
|
|
370 |
|
return lines; |
371 |
|
} |
372 |
|
|
373 |
< |
string Outputter::range(unsigned page) |
373 |
> |
string Outputter::range(size_t page) |
374 |
|
{ |
375 |
< |
unsigned bottom(page * 10 + 1), top(numWebpages > page * 10 + 10 ? page * |
375 |
> |
size_t bottom(page * 10 + 1), top(numWebpages > page * 10 + 10 ? page * |
376 |
|
10 + 10 : numWebpages); |
377 |
|
ostringstream range; |
378 |
|
|
416 |
|
return line; |
417 |
|
} |
418 |
|
|
419 |
< |
void Outputter::tag(string& line, char* tag, const string& replacement) |
419 |
> |
void Outputter::tag(string& line, const char* tag, const string& replacement) |
420 |
|
{ |
421 |
|
size_t begin(0); |
422 |
|
|
434 |
|
} |
435 |
|
} |
436 |
|
|
437 |
< |
void Outputter::conditional(string& line, ifstream& fin, char* tag, bool |
437 |
> |
void Outputter::conditional(string& line, ifstream& fin, const char* tag, bool |
438 |
|
condition) |
439 |
|
{ |
440 |
< |
unsigned begin(0); |
440 |
> |
size_t begin(0); |
441 |
|
|
442 |
|
while (begin < line.length()) |
443 |
|
{ |
444 |
< |
unsigned start(line.find(tag, begin)), finish(line.find("<?endif?>", |
444 |
> |
size_t start(line.find(tag, begin)), finish(line.find("<?endif?>", |
445 |
|
start)); |
446 |
|
|
447 |
|
if (start == string::npos) break; |