aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/definitions/push_ruleset.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-12-14 23:32:16 +0900
committerGitHub <noreply@github.com>2018-12-14 23:32:16 +0900
commitfcc8d2ca615fce6e42bf1cf6585d60f94a2db926 (patch)
treeb0dd17b632a5c5775f2221fd0b53b21a8c02ce58 /lib/csapi/definitions/push_ruleset.cpp
parent50571a92b4e9f634c4daf546222fa082120db6c7 (diff)
parent12a0b95fdcfea15cd0ef313aec8868656629b986 (diff)
downloadlibquotient-fcc8d2ca615fce6e42bf1cf6585d60f94a2db926.tar.gz
libquotient-fcc8d2ca615fce6e42bf1cf6585d60f94a2db926.zip
Merge pull request #263 from QMatrixClient/kitsune-lazy-loading
Lazy loading members
Diffstat (limited to 'lib/csapi/definitions/push_ruleset.cpp')
-rw-r--r--lib/csapi/definitions/push_ruleset.cpp26
1 files changed, 9 insertions, 17 deletions
diff --git a/lib/csapi/definitions/push_ruleset.cpp b/lib/csapi/definitions/push_ruleset.cpp
index 14b7a4b6..f1bad882 100644
--- a/lib/csapi/definitions/push_ruleset.cpp
+++ b/lib/csapi/definitions/push_ruleset.cpp
@@ -6,31 +6,23 @@
using namespace QMatrixClient;
-QJsonObject QMatrixClient::toJson(const PushRuleset& pod)
+void JsonObjectConverter<PushRuleset>::dumpTo(
+ QJsonObject& jo, const PushRuleset& pod)
{
- QJsonObject jo;
addParam<IfNotEmpty>(jo, QStringLiteral("content"), pod.content);
addParam<IfNotEmpty>(jo, QStringLiteral("override"), pod.override);
addParam<IfNotEmpty>(jo, QStringLiteral("room"), pod.room);
addParam<IfNotEmpty>(jo, QStringLiteral("sender"), pod.sender);
addParam<IfNotEmpty>(jo, QStringLiteral("underride"), pod.underride);
- return jo;
}
-PushRuleset FromJsonObject<PushRuleset>::operator()(const QJsonObject& jo) const
+void JsonObjectConverter<PushRuleset>::fillFrom(
+ const QJsonObject& jo, PushRuleset& result)
{
- PushRuleset result;
- result.content =
- fromJson<QVector<PushRule>>(jo.value("content"_ls));
- result.override =
- fromJson<QVector<PushRule>>(jo.value("override"_ls));
- result.room =
- fromJson<QVector<PushRule>>(jo.value("room"_ls));
- result.sender =
- fromJson<QVector<PushRule>>(jo.value("sender"_ls));
- result.underride =
- fromJson<QVector<PushRule>>(jo.value("underride"_ls));
-
- return result;
+ fromJson(jo.value("content"_ls), result.content);
+ fromJson(jo.value("override"_ls), result.override);
+ fromJson(jo.value("room"_ls), result.room);
+ fromJson(jo.value("sender"_ls), result.sender);
+ fromJson(jo.value("underride"_ls), result.underride);
}