aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2020-08-21 22:44:10 +0200
committerRenaud G <renaud@rolisteam.org>2020-08-21 22:52:29 +0200
commitb48e29ad3cc1be1b0ee66b54bf19537a0bfdc782 (patch)
tree9a5bcb2de0e9ce1fcfacbea404fa5649b91959be /include
parent8087429c108c4f6bef5f792ce256b8d5b8b69101 (diff)
downloadOneRoll-b48e29ad3cc1be1b0ee66b54bf19537a0bfdc782.tar.gz
OneRoll-b48e29ad3cc1be1b0ee66b54bf19537a0bfdc782.zip
Better export in json.
Diffstat (limited to 'include')
-rw-r--r--include/diceparser.h2
-rw-r--r--include/parsingtoolbox.h6
2 files changed, 5 insertions, 3 deletions
diff --git a/include/diceparser.h b/include/diceparser.h
index 4d5555e..56dcb7d 100644
--- a/include/diceparser.h
+++ b/include/diceparser.h
@@ -105,7 +105,7 @@ public:
QString comment() const;
QString humanReadableWarning() const;
QString humanReadableError() const;
- QString resultAsJSon() const;
+ QString resultAsJSon(std::function<QString(const QString&, const QString&, bool)> colorize) const;
// QStringList stringResult() const;
// QStringList allDiceResult(bool& hasAlias) const;
diff --git a/include/parsingtoolbox.h b/include/parsingtoolbox.h
index d0a757f..f9c7484 100644
--- a/include/parsingtoolbox.h
+++ b/include/parsingtoolbox.h
@@ -231,8 +231,9 @@ public:
static SubtituteInfo readPlaceHolderFromString(const QString& source, int& start);
static ExportedDiceResult finalDiceResultFromInstruction(ExecutionNode* start);
static ExportedDiceResult allDiceResultFromInstruction(ExecutionNode* start);
- void addResultInJson(QJsonObject obj, Dice::RESULT_TYPE type, const QString& key, ExecutionNode* start, bool b);
- void addDiceResultInJson(QJsonObject obj, ExecutionNode* start);
+ void addResultInJson(QJsonObject& obj, Dice::RESULT_TYPE type, const QString& key, ExecutionNode* start, bool b);
+ void addDiceResultInJson(QJsonObject& obj, ExecutionNode* start,
+ std::function<QString(const QString&, const QString&, bool)> colorize);
// accessors
void setComment(const QString& comment);
@@ -249,6 +250,7 @@ public:
void cleanUpAliases();
static bool readStringResultParameter(QString& str);
+ static QString replacePlaceHolderFromJson(const QString& source, const QJsonObject& obj);
private:
QMap<QString, BooleanCondition::LogicOperator> m_logicOp;