diff options
-rw-r--r-- | mutator_aux.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
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(); |