added json for line info
This commit is contained in:
@@ -1464,19 +1464,33 @@ int SPF_GetFileLineInfo(void*& context, int winHandler, short *options, short *p
|
||||
{
|
||||
runPassesForVisualizer(projName, { FILE_LINE_INFO });
|
||||
|
||||
string resVal = "";
|
||||
for (auto it = lineInfo.begin(); it != lineInfo.end(); ++it)
|
||||
json metric_array = json::array();
|
||||
for (const auto& fileInfo : lineInfo)
|
||||
{
|
||||
if (it != lineInfo.begin())
|
||||
resVal += "@";
|
||||
json fileMetric;
|
||||
|
||||
auto itD = dirsInfo.find(it->first);
|
||||
if (itD == dirsInfo.end())
|
||||
resVal += it->first + "@" + to_string(it->second) + "_0_0";
|
||||
fileMetric["file"] = fileInfo.first;
|
||||
fileMetric["linesCount"] = fileInfo.second;
|
||||
|
||||
auto it = dirsInfo.find(fileInfo.first);
|
||||
if (it == dirsInfo.end())
|
||||
{
|
||||
fileMetric["numSPF"] = 0;
|
||||
fileMetric["numDVM"] = 0;
|
||||
}
|
||||
else
|
||||
resVal += it->first + "@" + to_string(it->second) + "_" + to_string(itD->second.first.size()) + "_" + to_string(itD->second.second.size());
|
||||
{
|
||||
fileMetric["numSPF"] = (int)it->second.first.size();
|
||||
fileMetric["numDVM"] = (int)it->second.second.size();
|
||||
}
|
||||
|
||||
metric_array.push_back(fileMetric);
|
||||
}
|
||||
|
||||
json allMetrics;
|
||||
allMetrics["allMetrics"] = metric_array;
|
||||
string resVal = allMetrics.dump();
|
||||
|
||||
copyStringToShort(result, resVal);
|
||||
retSize = (int)resVal.size() + 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user