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

Method Export

Exporter/Html/HtmlExporter.cpp:79–123  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

77
78 //-------------------------------------------------------------------------
79 void HtmlExporter::Export(
80 const Plugin::CoverageData& coverageData,
81 const std::filesystem::path& outputFolderPrefix)
82 {
83 HtmlFolderStructure htmlFolderStructure{templateFolder_};
84 cov::CoverageRateComputer coverageRateComputer{ coverageData };
85
86 auto mainMessage = GetMainMessage(coverageData);
87
88 auto projectDictionary = exporter_.CreateTemplateDictionary(coverageData.GetName(), mainMessage);
89 auto outputFolder = htmlFolderStructure.CreateCurrentRoot(outputFolderPrefix);
90
91 exporter_.AddModuleSectionToDictionary(
92 coverageData.GetName(),
93 coverageRateComputer.GetCoverageRate(),
94 true,
95 nullptr,
96 *projectDictionary);
97
98 for (const auto& module : coverageRateComputer.SortModulesByCoverageRate())
99 {
100 const auto& moduleCoverageRate = coverageRateComputer.GetCoverageRate(*module);
101
102 if (moduleCoverageRate.GetTotalLinesCount())
103 {
104 const auto& modulePath = module->GetPath();
105 auto moduleFilename = module->GetPath().filename();
106 auto moduleTemplateDictionary = exporter_.CreateTemplateDictionary(moduleFilename.wstring(), L"");
107
108 auto htmlModulePath = htmlFolderStructure.CreateCurrentModule(modulePath);
109 ExportFiles(coverageRateComputer, *module, htmlFolderStructure, *moduleTemplateDictionary);
110
111 exporter_.GenerateModuleTemplate(*moduleTemplateDictionary, htmlModulePath.GetAbsolutePath());
112 exporter_.AddModuleSectionToDictionary(
113 module->GetPath(),
114 moduleCoverageRate,
115 false,
116 &htmlModulePath.GetRelativeLinkPath(),
117 *projectDictionary);
118 }
119 }
120
121 exporter_.GenerateProjectTemplate(*projectDictionary, outputFolder / L"index.html");
122 Tools::ShowOutputMessage(L"Coverage generated in Folder ", outputFolder);
123 }
124
125 //---------------------------------------------------------------------
126 void HtmlExporter::ExportFiles(

Callers 1

ExportFileMethod · 0.45

Calls 10

GetMainMessageFunction · 0.85
ShowOutputMessageFunction · 0.85
CreateCurrentRootMethod · 0.80
GetTotalLinesCountMethod · 0.80
CreateCurrentModuleMethod · 0.80

Tested by

no test coverage detected