MCPcopy Create free account
hub / github.com/catboost/catboost / ConsumeLine

Method ConsumeLine

library/cpp/string_utils/csv/csv.cpp:70–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70TString NCsvFormat::TLinesSplitter::ConsumeLine() {
71 bool Escape = false;
72 TString result;
73 TString line;
74 while (Input.ReadLine(line)) {
75 const size_t quoteCount = std::count(line.cbegin(), line.cend(), Quote);
76 // A theoretically faster version of "if (quoteCount %2 == 1)"
77 if (quoteCount & 1) {
78 Escape = !Escape;
79 }
80 if (!result) {
81 result = line;
82 } else {
83 result += line;
84 }
85 if (!Escape) {
86 break;
87 } else {
88 result += "\n";
89 }
90 }
91 return result;
92}

Callers

nothing calls this directly

Calls 4

countFunction · 0.50
ReadLineMethod · 0.45
cbeginMethod · 0.45
cendMethod · 0.45

Tested by

no test coverage detected