-------------------------------------------------------------------------
| 106 | |
| 107 | //------------------------------------------------------------------------- |
| 108 | bool HtmlFileCoverageExporter::Export( |
| 109 | const Plugin::FileCoverage& fileCoverage, |
| 110 | std::wostream& output) const |
| 111 | { |
| 112 | auto filePath = fileCoverage.GetPath(); |
| 113 | |
| 114 | std::wifstream ifs{filePath.string()}; |
| 115 | if (!ifs) |
| 116 | THROW(L"Cannot open file : " + filePath.wstring()); |
| 117 | |
| 118 | std::wstring line; |
| 119 | const Plugin::LineCoverage* previousLineCoverage = nullptr; |
| 120 | int styleChangesCount = 0; |
| 121 | int lineCount = 0; |
| 122 | for (int i = 1; std::getline(ifs, line); ++i) |
| 123 | { |
| 124 | auto lineCoverage = fileCoverage[i]; |
| 125 | |
| 126 | line = boost::spirit::classic::xml::encode(line); |
| 127 | if (AddLineCoverageColor(output, line, lineCoverage, previousLineCoverage)) |
| 128 | ++styleChangesCount; |
| 129 | ++lineCount; |
| 130 | previousLineCoverage = lineCoverage; |
| 131 | } |
| 132 | AddEndStyleIfNeeded(output, previousLineCoverage); |
| 133 | output.flush(); |
| 134 | |
| 135 | return MustEnableCodePrettify(lineCount, styleChangesCount); |
| 136 | } |
| 137 | |
| 138 | //------------------------------------------------------------------------- |
| 139 | bool HtmlFileCoverageExporter::MustEnableCodePrettify( |
nothing calls this directly
no test coverage detected