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

Method Parse

FileFilter/UnifiedDiffParser.cpp:143–167  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

141
142 //-------------------------------------------------------------------------
143 std::vector<File> UnifiedDiffParser::Parse(std::wistream& istr) const
144 {
145 std::wstring line;
146 std::vector<File> files;
147 Stream stream(istr);
148 std::vector<std::wstring> sourceFileLines;
149 bool foundGitHeader = false;
150
151 while (stream.GetLine(line))
152 {
153 if (boost::algorithm::starts_with(line, L"diff --git"))
154 foundGitHeader = true;
155 else if (boost::algorithm::starts_with(line, FromFilePrefix))
156 {
157 sourceFileLines.push_back(line);
158 files.emplace_back(ExtractTargetFile(stream));
159 }
160 else if (boost::algorithm::starts_with(line, L"@@"))
161 FillUpdatedLines(line, files, stream);
162 }
163 RemoveDevNull(files, sourceFileLines);
164 UpdateFilePathIfGitDetected(files, sourceFileLines, foundGitHeader);
165
166 return files;
167 }
168
169 //---------------------------------------------------------------------
170 void UnifiedDiffParser::FillUpdatedLines(

Callers 3

ParseUnifiedDiffFunction · 0.45
GetErrorMethod · 0.45
TEST_FFunction · 0.45

Calls 2

RemoveDevNullFunction · 0.85

Tested by 2

GetErrorMethod · 0.36
TEST_FFunction · 0.36