diff options
| author | 2020-07-05 02:39:59 +0200 | |
|---|---|---|
| committer | 2020-08-21 22:50:44 +0200 | |
| commit | 35d019ec86f272d4189852a3e69ede403c415a8c (patch) | |
| tree | 45ee1459e5c92029018795f4694712d3d803440d /diceparser.cpp | |
| parent | 62b7114ce29af10395273acec8dffeb41f255145 (diff) | |
| download | OneRoll-35d019ec86f272d4189852a3e69ede403c415a8c.tar.gz OneRoll-35d019ec86f272d4189852a3e69ede403c415a8c.zip | |
WIP: Export result in json.
Diffstat (limited to 'diceparser.cpp')
| -rw-r--r-- | diceparser.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
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 <QDebug> #include <QFile> +#include <QJsonArray> #include <QObject> #include <QStringList> #include <functional> @@ -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) |