diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-12-14 23:32:16 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-14 23:32:16 +0900 |
commit | fcc8d2ca615fce6e42bf1cf6585d60f94a2db926 (patch) | |
tree | b0dd17b632a5c5775f2221fd0b53b21a8c02ce58 /lib/application-service/definitions/protocol.h | |
parent | 50571a92b4e9f634c4daf546222fa082120db6c7 (diff) | |
parent | 12a0b95fdcfea15cd0ef313aec8868656629b986 (diff) | |
download | libquotient-fcc8d2ca615fce6e42bf1cf6585d60f94a2db926.tar.gz libquotient-fcc8d2ca615fce6e42bf1cf6585d60f94a2db926.zip |
Merge pull request #263 from QMatrixClient/kitsune-lazy-loading
Lazy loading members
Diffstat (limited to 'lib/application-service/definitions/protocol.h')
-rw-r--r-- | lib/application-service/definitions/protocol.h | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/lib/application-service/definitions/protocol.h b/lib/application-service/definitions/protocol.h index 2aca7d66..0a1f9a21 100644 --- a/lib/application-service/definitions/protocol.h +++ b/lib/application-service/definitions/protocol.h @@ -25,12 +25,10 @@ namespace QMatrixClient /// An placeholder serving as a valid example of the field value. QString placeholder; }; - - QJsonObject toJson(const FieldType& pod); - - template <> struct FromJsonObject<FieldType> + template <> struct JsonObjectConverter<FieldType> { - FieldType operator()(const QJsonObject& jo) const; + static void dumpTo(QJsonObject& jo, const FieldType& pod); + static void fillFrom(const QJsonObject& jo, FieldType& pod); }; struct ProtocolInstance @@ -45,12 +43,10 @@ namespace QMatrixClient /// A unique identifier across all instances. QString networkId; }; - - QJsonObject toJson(const ProtocolInstance& pod); - - template <> struct FromJsonObject<ProtocolInstance> + template <> struct JsonObjectConverter<ProtocolInstance> { - ProtocolInstance operator()(const QJsonObject& jo) const; + static void dumpTo(QJsonObject& jo, const ProtocolInstance& pod); + static void fillFrom(const QJsonObject& jo, ProtocolInstance& pod); }; struct ThirdPartyProtocol @@ -78,12 +74,10 @@ namespace QMatrixClient /// same application service. QVector<ProtocolInstance> instances; }; - - QJsonObject toJson(const ThirdPartyProtocol& pod); - - template <> struct FromJsonObject<ThirdPartyProtocol> + template <> struct JsonObjectConverter<ThirdPartyProtocol> { - ThirdPartyProtocol operator()(const QJsonObject& jo) const; + static void dumpTo(QJsonObject& jo, const ThirdPartyProtocol& pod); + static void fillFrom(const QJsonObject& jo, ThirdPartyProtocol& pod); }; } // namespace QMatrixClient |