diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2020-06-07 19:46:40 +0200 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2020-06-07 19:46:40 +0200 |
commit | 32729d9a7519cd2c4cddb0174b8329c6fd4a4a83 (patch) | |
tree | 9a966d7dc0bf628f610d5de1ad64c8d29b6b26f8 /lib/csapi/definitions/push_rule.h | |
parent | a0430b1fb722a77ad7cbd28f181727d46d92b3a2 (diff) | |
download | libquotient-32729d9a7519cd2c4cddb0174b8329c6fd4a4a83.tar.gz libquotient-32729d9a7519cd2c4cddb0174b8329c6fd4a4a83.zip |
Update generated files according to gtad/* changes
Diffstat (limited to 'lib/csapi/definitions/push_rule.h')
-rw-r--r-- | lib/csapi/definitions/push_rule.h | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/lib/csapi/definitions/push_rule.h b/lib/csapi/definitions/push_rule.h index c09d063f..43749bae 100644 --- a/lib/csapi/definitions/push_rule.h +++ b/lib/csapi/definitions/push_rule.h @@ -8,14 +8,8 @@ #include "csapi/definitions/push_condition.h" -#include <QtCore/QJsonObject> -#include <QtCore/QVariant> -#include <QtCore/QVector> - namespace Quotient { -// Data structures - struct PushRule { /// The actions to perform when this rule is matched. QVector<QVariant> actions; @@ -41,8 +35,24 @@ struct PushRule { template <> struct JsonObjectConverter<PushRule> { - static void dumpTo(QJsonObject& jo, const PushRule& pod); - static void fillFrom(const QJsonObject& jo, PushRule& pod); + static void dumpTo(QJsonObject& jo, const PushRule& pod) + { + addParam<>(jo, QStringLiteral("actions"), pod.actions); + addParam<>(jo, QStringLiteral("default"), pod.isDefault); + addParam<>(jo, QStringLiteral("enabled"), pod.enabled); + addParam<>(jo, QStringLiteral("rule_id"), pod.ruleId); + addParam<IfNotEmpty>(jo, QStringLiteral("conditions"), pod.conditions); + addParam<IfNotEmpty>(jo, QStringLiteral("pattern"), pod.pattern); + } + static void fillFrom(const QJsonObject& jo, PushRule& pod) + { + fromJson(jo.value("actions"_ls), pod.actions); + fromJson(jo.value("default"_ls), pod.isDefault); + fromJson(jo.value("enabled"_ls), pod.enabled); + fromJson(jo.value("rule_id"_ls), pod.ruleId); + fromJson(jo.value("conditions"_ls), pod.conditions); + fromJson(jo.value("pattern"_ls), pod.pattern); + } }; } // namespace Quotient |