diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-01-03 21:59:04 +0100 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-02-11 14:23:49 +0100 |
commit | 10ac7c13cdcd62b62af6e89cb726376cfbc53302 (patch) | |
tree | 6d8aacb95f9175ed08f213556ccdf2a6fefc363c /lib/csapi/receipts.cpp | |
parent | 4f581f22d707fd226a56400817c9e47e54116589 (diff) | |
download | libquotient-10ac7c13cdcd62b62af6e89cb726376cfbc53302.tar.gz libquotient-10ac7c13cdcd62b62af6e89cb726376cfbc53302.zip |
Enable to/fromJson to work with non-assignable objects
Previously you could not use toJson() on a polymorphic structure such
as one of those defined in eventcontent.h because it is not assignable
and the default specialisation of JsonObjectConverter used assignment.
To avoid that limitation, one had to specialise JsonObjectConverter for
each descendant of EventContent::Base, which is a lot of boilerplate.
The new JsonConverter (the template underpinning the "default"
to/fromJson implementation) improves on two things:
1. dump() allows to construct your own QJsonObject - or anything else
convertable to QJsonValue - instead of requiring to fill in the
pre-constructed one.
2. load() allows to construct your value type directly from QJsonObject
instead of default-constructing it in advance.
Diffstat (limited to 'lib/csapi/receipts.cpp')
0 files changed, 0 insertions, 0 deletions