MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / fillFromInputLine

Method fillFromInputLine

src/openms/source/CONCEPT/FuzzyStringComparator.cpp:661–690  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 1

compareLines_Method · 0.80

Calls 6

resetFunction · 0.85
updatePositionMethod · 0.80
seekGToSavedPositionMethod · 0.80
extractDoubleFunction · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected