From e9b445909f2707ca199e102e8cae2f11f7b64701 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Wed, 6 Dec 2017 09:07:37 +0900 Subject: converters.h: support QByteArray --- converters.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/converters.h b/converters.h index 733c2c0e..5593ee24 100644 --- a/converters.h +++ b/converters.h @@ -44,6 +44,11 @@ namespace QMatrixClient return QJsonArray::fromStringList(strings); } + inline QJsonValue toJson(const QByteArray& bytes) + { + return QJsonValue(static_cast(bytes)); + } + template struct FromJson { @@ -133,4 +138,12 @@ namespace QMatrixClient template <> struct FromJson : FromJson> { }; + template <> struct FromJson + { + QByteArray operator()(QJsonValue jv) const + { + return fromJson(jv).toLatin1(); + } + }; + } // namespace QMatrixClient -- cgit v1.2.3