From 203a6b61480f726fae341d119f09f9dc83b8829a Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Tue, 1 May 2018 13:52:23 +0900 Subject: Integrate converters with EventPtr partially So that events can be created from JSON in the same way as all other types. --- lib/events/event.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/events/event.h b/lib/events/event.h index d614115a..68e598ad 100644 --- a/lib/events/event.h +++ b/lib/events/event.h @@ -18,15 +18,9 @@ #pragma once -#include -#include -#include -#include - +#include "converters.h" #include "util.h" -#include - namespace QMatrixClient { template @@ -110,6 +104,14 @@ namespace QMatrixClient EventPtr doMakeEvent(const QJsonObject& obj); } + template <> struct FromJson + { + EventPtr operator()(const QJsonValue& jv) const + { + return makeEvent(jv.toObject()); + } + }; + /** * \brief A vector of pointers to events with deserialisation capabilities * -- cgit v1.2.3