MCPcopy Create free account
hub / github.com/Samsung/UTopia / fromJson

Method fromJson

lib/sourceanalysis/SourceAnalysisReport.cpp:11–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9}
10
11bool 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
46unsigned SourceAnalysisReport::getEndOffset(std::string SourceName) const {
47 auto Iter = SourceInfoMap.find(SourceName);

Callers

nothing calls this directly

Calls 7

isMemberMethod · 0.80
setFilePathMethod · 0.80
asStringMethod · 0.80
setLengthMethod · 0.80
asUIntMethod · 0.80
setOffsetMethod · 0.80
getMemberNamesMethod · 0.80

Tested by

no test coverage detected