MCPcopy Create free account
hub / github.com/OpenCppCoverage/OpenCppCoverage / ExtractUpdatedLines

Method ExtractUpdatedLines

FileFilter/UnifiedDiffParser.cpp:228–252  ·  view source on GitHub ↗

-------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

226
227 //-------------------------------------------------------------------------
228 std::vector<int> UnifiedDiffParser::ExtractUpdatedLines(
229 Stream& stream,
230 const std::wstring& hunksDifferencesLine) const
231 {
232 HunksDifferences hunksDifferences = ExtractHunksDifferences(stream, hunksDifferencesLine);
233
234 std::wstring lineStr;
235 int currentLine = hunksDifferences.startTo;
236 const int endLine = hunksDifferences.startTo + hunksDifferences.countTo;
237 std::vector<int> updatedLines;
238 while (currentLine < endLine && stream.GetLine(lineStr))
239 {
240 if (!boost::algorithm::starts_with(lineStr, "-") &&
241 !boost::algorithm::starts_with(lineStr, "\\")) // For: \ No newline at end of file
242 {
243 if (boost::algorithm::starts_with(lineStr, "+"))
244 updatedLines.push_back(currentLine);
245 ++currentLine;
246 }
247 }
248
249 if (currentLine != endLine)
250 ThrowError(stream, UnifiedDiffParserException::ErrorContextHunks);
251 return updatedLines;
252 }
253
254 //-------------------------------------------------------------------------
255 void UnifiedDiffParser::ThrowError(const Stream& stream, const std::wstring& message) const

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected