From 150df8ce08976ac7b8c25dbed1b965b7c2f65249 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Mon, 1 Aug 2022 12:11:58 +0200 Subject: Pull out common JsonConverter code to JsonObjectUnpacker --- lib/events/eventloader.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'lib/events') diff --git a/lib/events/eventloader.h b/lib/events/eventloader.h index c7b82e8e..7dde9786 100644 --- a/lib/events/eventloader.h +++ b/lib/events/eventloader.h @@ -48,14 +48,11 @@ inline StateEventPtr loadStateEvent(const QString& matrixType, } template -struct JsonConverter> { - static auto load(const QJsonValue& jv) +struct JsonConverter> + : JsonObjectUnpacker> { + static auto load(const QJsonObject& jo) { - return loadEvent(jv.toObject()); - } - static auto load(const QJsonDocument& jd) - { - return loadEvent(jd.object()); + return loadEvent(jo); } }; } // namespace Quotient -- cgit v1.2.3