| 659 | |
| 660 | |
| 661 | void FuzzyStringComparator::StreamElement_::fillFromInputLine(InputLine& input_line, const std::string& str_line) |
| 662 | { |
| 663 | // first reset all internal variables so we do not mess with |
| 664 | // old values |
| 665 | reset(); |
| 666 | |
| 667 | input_line.updatePosition(); |
| 668 | input_line.line_ >> letter; // read letter |
| 669 | if ((is_space = (isspace(letter) != 0))) // is whitespace? |
| 670 | { |
| 671 | input_line.line_ >> std::ws; // skip over further whitespace |
| 672 | } |
| 673 | else |
| 674 | { |
| 675 | // go back to initial position and try to read as double |
| 676 | input_line.seekGToSavedPosition(); |
| 677 | auto it_start = str_line.begin() + (int)input_line.line_position_; |
| 678 | auto it_start_fixed = it_start; |
| 679 | // extracting the double does NOT modify the stream (since we work on the string) |
| 680 | is_number = StringUtils::extractDouble(it_start, str_line.end(), number); |
| 681 | if (is_number) |
| 682 | { // forward the stream |
| 683 | input_line.line_.seekg(long(input_line.line_.tellg()) + long(std::distance(it_start_fixed, it_start))); |
| 684 | } |
| 685 | else |
| 686 | { // no double/float/int either ... so read as letter |
| 687 | input_line.line_ >> letter; |
| 688 | } |
| 689 | } |
| 690 | } |
| 691 | |
| 692 | void FuzzyStringComparator::StreamElement_::reset() |
| 693 | { |
no test coverage detected