| 9 | } |
| 10 | |
| 11 | bool SourceAnalysisReport::fromJson(Json::Value Report) { |
| 12 | if (!Report.isMember(getReportType())) |
| 13 | return false; |
| 14 | |
| 15 | const auto &SourceAnalysisJson = Report[getReportType()]; |
| 16 | if (SourceAnalysisJson.isMember("mainfuncloc")) { |
| 17 | const auto &MainFuncLocJson = SourceAnalysisJson["mainfuncloc"]; |
| 18 | MainFuncLoc.setFilePath(MainFuncLocJson["FilePath"].asString()); |
| 19 | MainFuncLoc.setLength(MainFuncLocJson["Length"].asUInt()); |
| 20 | MainFuncLoc.setOffset(MainFuncLocJson["Offset"].asUInt()); |
| 21 | } |
| 22 | |
| 23 | if (SourceAnalysisJson.isMember("sourceinfo")) { |
| 24 | const auto &SourceInfoArrayJson = SourceAnalysisJson["sourceinfo"]; |
| 25 | for (auto MemberName : SourceInfoArrayJson.getMemberNames()) { |
| 26 | const auto &SourceInfoJson = SourceInfoArrayJson[MemberName]; |
| 27 | if (!SourceInfoJson.isMember("endoffset") || |
| 28 | !SourceInfoJson.isMember("includedheaders")) |
| 29 | continue; |
| 30 | |
| 31 | std::vector<std::string> IncludedHeaders; |
| 32 | for (auto &Element : SourceInfoJson["includedheaders"]) |
| 33 | IncludedHeaders.push_back(Element.asString()); |
| 34 | SourceInfoMap.emplace( |
| 35 | MemberName, |
| 36 | SourceInfo{SourceInfoJson["endoffset"].asUInt(), IncludedHeaders}); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | if (SourceAnalysisJson.isMember("srcbasedir")) |
| 41 | SrcBaseDir = SourceAnalysisJson["srcbasedir"].asString(); |
| 42 | |
| 43 | return true; |
| 44 | } |
| 45 | |
| 46 | unsigned SourceAnalysisReport::getEndOffset(std::string SourceName) const { |
| 47 | auto Iter = SourceInfoMap.find(SourceName); |
nothing calls this directly
no test coverage detected