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

Method ExtractTargetFile

FileFilter/UnifiedDiffParser.cpp:182–197  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

180
181 //---------------------------------------------------------------------
182 std::filesystem::path UnifiedDiffParser::ExtractTargetFile(Stream& stream) const
183 {
184 std::wstring line;
185 if (!stream.GetLine(line))
186 ThrowError(stream, UnifiedDiffParserException::ErrorCannotReadLine);
187
188 if (!boost::algorithm::starts_with(line, ToFilePrefix))
189 ThrowError(stream, UnifiedDiffParserException::ErrorExpectFromFilePrefix);
190
191 const auto startIndex = ToFilePrefix.size();
192 const auto endIndex = line.find('\t');
193
194 if (endIndex != std::string::npos)
195 return line.substr(startIndex, endIndex - startIndex);
196 return line.substr(startIndex);
197 }
198
199 //-------------------------------------------------------------------------
200 UnifiedDiffParser::HunksDifferences

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected