From c4e1e0906558608326210eb333b0beb73636de60 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Wed, 1 Nov 2017 17:42:57 +0300 Subject: Add fromJson> and fromJson --- converters.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/converters.h b/converters.h index f6e850c6..733c2c0e 100644 --- a/converters.h +++ b/converters.h @@ -118,4 +118,19 @@ namespace QMatrixClient return vect; } }; + + template struct FromJson> + { + QList operator()(QJsonValue jv) const + { + const auto jsonArray = jv.toArray(); + QList sl; sl.reserve(jsonArray.size()); + std::transform(jsonArray.begin(), jsonArray.end(), + std::back_inserter(sl), FromJson()); + return sl; + } + }; + + template <> struct FromJson : FromJson> { }; + } // namespace QMatrixClient -- cgit v1.2.3