| 565 | } // compareStreams() |
| 566 | |
| 567 | void FuzzyStringComparator::readNextLine_(std::istream& input_stream, std::string& line_string, int& line_number) const |
| 568 | { |
| 569 | // use TextFile::getLine for reading, since it will remove \r automatically on all platforms without much overhead |
| 570 | // This allows to compare otherwise equal lines between files quickly (see compareLines_(...)) |
| 571 | for (line_string.clear(); static_cast<void>(++line_number), TextFile::getLine(input_stream, line_string); ) |
| 572 | { |
| 573 | if (line_string.empty()) |
| 574 | { |
| 575 | continue; // read next line |
| 576 | } |
| 577 | std::string::const_iterator iter = line_string.begin(); // loop initialization |
| 578 | for (; iter != line_string.end() && isspace((unsigned char)*iter); ++iter) |
| 579 | { |
| 580 | } |
| 581 | // skip over whitespace |
| 582 | if (iter != line_string.end()) |
| 583 | { |
| 584 | return; // line is not empty or whitespace only |
| 585 | } |
| 586 | } |
| 587 | } |
| 588 | |
| 589 | bool FuzzyStringComparator::compareFiles(const std::string& filename_1, const std::string& filename_2) |
| 590 | { |