From 928116a7ffc5c112851bd3c72e1b10c277f737c3 Mon Sep 17 00:00:00 2001 From: bloodstalker Date: Thu, 5 Jan 2017 13:03:16 +0330 Subject: added a new overload for each report class for 19.1 --- mutator_aux.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/mutator_aux.cpp b/mutator_aux.cpp index 0bbba8f..6a56352 100644 --- a/mutator_aux.cpp +++ b/mutator_aux.cpp @@ -209,6 +209,17 @@ void XMLReport::XMLAddNode(const SourceManager &SM, SourceLocation SL, std::stri RootPointer->InsertEndChild(MisraElement); } +void XMLReport::XMLAddNode(std::string FilePath, std::string MisraRule, std::string Description) +{ + //assert(SL.isValid() && "SourceLocation Acquired by SourceManager in an overload(3) of XMLAddNode is not valid."); + + XMLElement* MisraElement = XMLReportDoc.NewElement("MisraDiag"); + MisraElement->SetText(Description.c_str()); + MisraElement->SetAttribute("Misra-C:2004Rule", MisraRule.c_str()); + MisraElement->SetAttribute("FileName", FilePath.c_str()); + RootPointer->InsertEndChild(MisraElement); +} + void XMLReport::SaveReport(void) { XMLError XMLErrorResult = XMLReportDoc.SaveFile("./test/misrareport.xml"); @@ -294,6 +305,20 @@ void JSONReport::JSONAddElement(const SourceManager &SM, SourceLocation SL, std: JSONRepFile << RepJ << std::endl; } +void JSONReport::JSONAddElement(std::string FilePath, std::string MisraRule, std::string Description) +{ + //assert(SL.isValid() && "SourceLocation Acquired by SourceManager in an overload(3) of XMLAddNode is not valid."); + + json RepJ; + + RepJ["MisraDiag"]["Description"] = Description.c_str(); + RepJ["MisraDiag"]["Misra-C:2004Rule"] = MisraRule.c_str(); + RepJ["MisraDiag"]["FileName"] = FilePath.c_str(); + + + JSONRepFile << RepJ << std::endl; +} + void JSONReport::CloseReport(void) { JSONRepFile.close(); -- cgit v1.2.3