32#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
34#ifndef _QX_SERIALIZE_QJSON_QPAIR_H_
35#define _QX_SERIALIZE_QJSON_QPAIR_H_
48#include <QtCore/qjsonvalue.h>
49#include <QtCore/qjsonobject.h>
50#include <QtCore/qjsonarray.h>
51#include <QtCore/qpair.h>
60template <
typename T1,
typename T2>
61struct QxConvert_ToJson< QPair<T1, T2> >
63 static inline QJsonValue
toJson(
const QPair<T1, T2> & t,
const QString & format)
68 return QJsonValue(arr);
72template <
typename T1,
typename T2>
73struct QxConvert_FromJson< QPair<T1, T2> >
75 static inline qx_bool fromJson(
const QJsonValue & j, QPair<T1, T2> & t,
const QString & format)
78 if (! j.isArray()) {
return qx_bool(
true); }
79 QJsonArray arr = j.toArray();
80 if (arr.count() != 2) {
return qx_bool(
true); }
83 t = qMakePair(tmp1, tmp2);
qx::cvt : namespace to provide global functions to convert any kind of objects to/from QString and QV...
qx_bool : boolean type with code and description message when an error occured
qx_bool from_json(const QJsonValue &j, T &t, const QString &format=QString())
QJsonValue to_json(const T &t, const QString &format=QString())
Root namespace for all QxOrm library features.
static qx_bool fromJson(const QJsonValue &j, T &t, const QString &format)
static QJsonValue toJson(const T &t, const QString &format)