aboutsummaryrefslogtreecommitdiff
path: root/lib/jobs/generated/create_room.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-04-14 14:12:03 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-04-14 14:12:03 +0900
commit4ced9792f27ed3d891c1f7772ae30d9fe452dd79 (patch)
tree30c4372cdb8dab60c54804ebd0e2fd26efe07345 /lib/jobs/generated/create_room.cpp
parente5cb9b6380040e40de1b3766ac90296d3828375a (diff)
downloadlibquotient-4ced9792f27ed3d891c1f7772ae30d9fe452dd79.tar.gz
libquotient-4ced9792f27ed3d891c1f7772ae30d9fe452dd79.zip
jobs/generated: Overload toJson() instead of operator QJsonObject()/QJsonValue()
It slightly reduces the header interface and shortcuts the actual call chain (not that it had any performance implications, just easier reasoning).
Diffstat (limited to 'lib/jobs/generated/create_room.cpp')
-rw-r--r--lib/jobs/generated/create_room.cpp38
1 files changed, 20 insertions, 18 deletions
diff --git a/lib/jobs/generated/create_room.cpp b/lib/jobs/generated/create_room.cpp
index de7807b5..008bc697 100644
--- a/lib/jobs/generated/create_room.cpp
+++ b/lib/jobs/generated/create_room.cpp
@@ -10,17 +10,18 @@ using namespace QMatrixClient;
static const auto basePath = QStringLiteral("/_matrix/client/r0");
-CreateRoomJob::Invite3pid::operator QJsonObject() const
-{
- QJsonObject o;
- o.insert("id_server", toJson(idServer));
- o.insert("medium", toJson(medium));
- o.insert("address", toJson(address));
-
- return o;
-}
namespace QMatrixClient
{
+ QJsonObject toJson(const CreateRoomJob::Invite3pid& pod)
+ {
+ QJsonObject o;
+ o.insert("id_server", toJson(pod.idServer));
+ o.insert("medium", toJson(pod.medium));
+ o.insert("address", toJson(pod.address));
+
+ return o;
+ }
+
template <> struct FromJson<CreateRoomJob::Invite3pid>
{
CreateRoomJob::Invite3pid operator()(QJsonValue jv)
@@ -39,17 +40,18 @@ namespace QMatrixClient
};
} // namespace QMatrixClient
-CreateRoomJob::StateEvent::operator QJsonObject() const
-{
- QJsonObject o;
- o.insert("type", toJson(type));
- o.insert("state_key", toJson(stateKey));
- o.insert("content", toJson(content));
-
- return o;
-}
namespace QMatrixClient
{
+ QJsonObject toJson(const CreateRoomJob::StateEvent& pod)
+ {
+ QJsonObject o;
+ o.insert("type", toJson(pod.type));
+ o.insert("state_key", toJson(pod.stateKey));
+ o.insert("content", toJson(pod.content));
+
+ return o;
+ }
+
template <> struct FromJson<CreateRoomJob::StateEvent>
{
CreateRoomJob::StateEvent operator()(QJsonValue jv)