libQuotient
A Qt library for building matrix clients
Quotient::JsonConverter< T > Struct Template Reference

The switchboard for extra conversion algorithms behind from/toJson. More...

#include <converters.h>

Inheritance diagram for Quotient::JsonConverter< T >:
Collaboration diagram for Quotient::JsonConverter< T >:

Static Public Member Functions

static auto dump (const T &data)
 
static T load (const QJsonObject &jo)
 
- Static Public Member Functions inherited from Quotient::JsonObjectUnpacker< T >
static T load (const QJsonValue &jv)
 
static T load (const QJsonDocument &jd)
 

Detailed Description

template<typename T>
struct Quotient::JsonConverter< T >

The switchboard for extra conversion algorithms behind from/toJson.

This template is mainly intended for partial conversion specialisations since from/toJson are functions and cannot be partially specialised. Another case for JsonConverter is to insulate types that can be constructed from basic types - namely, QVariant and QUrl can be directly constructed from QString and having an overload or specialisation for those leads to ambiguity between these and QJsonValue. For trivial (converting QJsonObject/QJsonValue) and most simple cases such as primitive types or QString this class is not needed.

Do NOT call the functions of this class directly unless you know what you're doing; and do not try to specialise basic things unless you're really sure that they are not supported and it's not feasible to support those by means of overloading toJson() and specialising fromJson().

Definition at line 78 of file converters.h.

Member Function Documentation

◆ dump()

template<typename T >
static auto Quotient::JsonConverter< T >::dump ( const T &  data)
inlinestatic

Definition at line 79 of file converters.h.

◆ load()

template<typename T >
static T Quotient::JsonConverter< T >::load ( const QJsonObject &  jo)
inlinestatic

Definition at line 91 of file converters.h.


The documentation for this struct was generated from the following file: