From 35d019ec86f272d4189852a3e69ede403c415a8c Mon Sep 17 00:00:00 2001 From: Renaud G Date: Sun, 5 Jul 2020 02:39:59 +0200 Subject: WIP: Export result in json. --- diceparser.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'diceparser.cpp') diff --git a/diceparser.cpp b/diceparser.cpp index ffd4e8b..87f052a 100644 --- a/diceparser.cpp +++ b/diceparser.cpp @@ -22,6 +22,7 @@ #include "diceparser.h" #include #include +#include #include #include #include @@ -482,6 +483,25 @@ QString DiceParser::humanReadableWarning() const QJsonObject DiceParser::exportResult() const { QJsonObject obj; + QJsonArray instructions; + for(auto start : m_parsingToolbox->getStartNodes()) + { + QJsonObject inst; + + inst["str"]= ; + inst["diceval"]= ; + inst["scalar"]= ; + + instructions.append(inst); + } + obj["instruction"]= instructions; + obj["comment"]= m_parsingToolbox->getComment(); + obj["error"]= humanReadableError(); + obj["scalar"]= scalarText; + obj["string"]= resultStr; + obj["warning"]= humanReadableWarning(); + obj["command"]= m_command; + return obj; } void DiceParser::writeDownDotTree(QString filepath) -- cgit v1.2.3-70-g09d2