diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-08-01 12:11:58 +0200 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-08-01 12:15:09 +0200 |
commit | 150df8ce08976ac7b8c25dbed1b965b7c2f65249 (patch) | |
tree | 4441d9c617251c8045af94abee59a47aa070dd59 /lib/events | |
parent | d4b8f54f764bec5758c8f672d4ab05d59e02c269 (diff) | |
download | libquotient-150df8ce08976ac7b8c25dbed1b965b7c2f65249.tar.gz libquotient-150df8ce08976ac7b8c25dbed1b965b7c2f65249.zip |
Pull out common JsonConverter code to JsonObjectUnpacker
Diffstat (limited to 'lib/events')
-rw-r--r-- | lib/events/eventloader.h | 11 |
1 files changed, 4 insertions, 7 deletions
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 <typename EventT> -struct JsonConverter<event_ptr_tt<EventT>> { - static auto load(const QJsonValue& jv) +struct JsonConverter<event_ptr_tt<EventT>> + : JsonObjectUnpacker<event_ptr_tt<EventT>> { + static auto load(const QJsonObject& jo) { - return loadEvent<EventT>(jv.toObject()); - } - static auto load(const QJsonDocument& jd) - { - return loadEvent<EventT>(jd.object()); + return loadEvent<EventT>(jo); } }; } // namespace Quotient |