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

Function FillFileTree

Exporter/CoberturaExporter.cpp:66–89  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

64
65 //-------------------------------------------------------------------------
66 void FillFileTree(
67 const CppCoverage::CoverageRateComputer& coverageRateComputer,
68 property_tree::wptree& fileTree,
69 const Plugin::FileCoverage& file)
70 {
71 const auto& path = file.GetPath();
72 auto res = path.relative_path();
73 const auto& coverageRate = coverageRateComputer.GetCoverageRate(file);
74
75 fileTree.put(L"<xmlattr>.name", ToUft8WString(path.filename()));
76 fileTree.put(L"<xmlattr>.filename", ToUft8WString(path.relative_path()));
77 SetCoverage(fileTree, coverageRate);
78 AddChild(fileTree, L"methods");
79
80 property_tree::wptree& linesTree = AddChild(fileTree, L"lines");
81
82 for (const auto& line : file.GetLines())
83 {
84 property_tree::wptree& lineTree = AddChild(linesTree, L"line");
85
86 lineTree.put(L"<xmlattr>.number", std::to_wstring(line.GetLineNumber()));
87 lineTree.put(L"<xmlattr>.hits", line.HasBeenExecuted() ? L"1" : L"0");
88 }
89 }
90
91 //-------------------------------------------------------------------------
92 void WriteSourceRoots(

Callers 1

FillCoverageTreeFunction · 0.85

Calls 5

ToUft8WStringFunction · 0.85
SetCoverageFunction · 0.85
GetLineNumberMethod · 0.80
HasBeenExecutedMethod · 0.80
GetLinesMethod · 0.45

Tested by

no test coverage detected