33#ifndef _QX_SERIALIZE_QJSON_STD_TUPLE_H_
34#define _QX_SERIALIZE_QJSON_STD_TUPLE_H_
47#include <QtCore/qjsonvalue.h>
48#include <QtCore/qjsonobject.h>
49#include <QtCore/qjsonarray.h>
58template <
typename T0,
typename T1>
61 static inline QJsonValue
toJson(
const std::tuple<T0, T1> & t,
const QString & format)
63 QJsonArray arr; QJsonValue val;
66 return QJsonValue(arr);
70template <
typename T0,
typename T1,
typename T2>
73 static inline QJsonValue
toJson(
const std::tuple<T0, T1, T2> & t,
const QString & format)
75 QJsonArray arr; QJsonValue val;
79 return QJsonValue(arr);
83template <
typename T0,
typename T1,
typename T2,
typename T3>
86 static inline QJsonValue
toJson(
const std::tuple<T0, T1, T2, T3> & t,
const QString & format)
88 QJsonArray arr; QJsonValue val;
93 return QJsonValue(arr);
97template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4>
100 static inline QJsonValue
toJson(
const std::tuple<T0, T1, T2, T3, T4> & t,
const QString & format)
102 QJsonArray arr; QJsonValue val;
108 return QJsonValue(arr);
112template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
115 static inline QJsonValue
toJson(
const std::tuple<T0, T1, T2, T3, T4, T5> & t,
const QString & format)
117 QJsonArray arr; QJsonValue val;
124 return QJsonValue(arr);
128template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6>
131 static inline QJsonValue
toJson(
const std::tuple<T0, T1, T2, T3, T4, T5, T6> & t,
const QString & format)
133 QJsonArray arr; QJsonValue val;
141 return QJsonValue(arr);
145template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7>
148 static inline QJsonValue
toJson(
const std::tuple<T0, T1, T2, T3, T4, T5, T6, T7> & t,
const QString & format)
150 QJsonArray arr; QJsonValue val;
159 return QJsonValue(arr);
163template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8>
166 static inline QJsonValue
toJson(
const std::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8> & t,
const QString & format)
168 QJsonArray arr; QJsonValue val;
178 return QJsonValue(arr);
182template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8,
typename T9>
185 static inline QJsonValue
toJson(
const std::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> & t,
const QString & format)
187 QJsonArray arr; QJsonValue val;
198 return QJsonValue(arr);
202template <
typename T0,
typename T1>
205 static inline qx_bool fromJson(
const QJsonValue & j, std::tuple<T0, T1> & t,
const QString & format)
207 if (! j.isArray()) {
return qx_bool(
true); }
208 QJsonArray arr = j.toArray();
215template <
typename T0,
typename T1,
typename T2>
218 static inline qx_bool fromJson(
const QJsonValue & j, std::tuple<T0, T1, T2> & t,
const QString & format)
220 if (! j.isArray()) {
return qx_bool(
true); }
221 QJsonArray arr = j.toArray();
229template <
typename T0,
typename T1,
typename T2,
typename T3>
232 static inline qx_bool fromJson(
const QJsonValue & j, std::tuple<T0, T1, T2, T3> & t,
const QString & format)
234 if (! j.isArray()) {
return qx_bool(
true); }
235 QJsonArray arr = j.toArray();
244template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4>
247 static inline qx_bool fromJson(
const QJsonValue & j, std::tuple<T0, T1, T2, T3, T4> & t,
const QString & format)
249 if (! j.isArray()) {
return qx_bool(
true); }
250 QJsonArray arr = j.toArray();
260template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
263 static inline qx_bool fromJson(
const QJsonValue & j, std::tuple<T0, T1, T2, T3, T4, T5> & t,
const QString & format)
265 if (! j.isArray()) {
return qx_bool(
true); }
266 QJsonArray arr = j.toArray();
277template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6>
280 static inline qx_bool fromJson(
const QJsonValue & j, std::tuple<T0, T1, T2, T3, T4, T5, T6> & t,
const QString & format)
282 if (! j.isArray()) {
return qx_bool(
true); }
283 QJsonArray arr = j.toArray();
295template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7>
298 static inline qx_bool fromJson(
const QJsonValue & j, std::tuple<T0, T1, T2, T3, T4, T5, T6, T7> & t,
const QString & format)
300 if (! j.isArray()) {
return qx_bool(
true); }
301 QJsonArray arr = j.toArray();
314template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8>
317 static inline qx_bool fromJson(
const QJsonValue & j, std::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8> & t,
const QString & format)
319 if (! j.isArray()) {
return qx_bool(
true); }
320 QJsonArray arr = j.toArray();
334template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8,
typename T9>
337 static inline qx_bool fromJson(
const QJsonValue & j, std::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> & t,
const QString & format)
339 if (! j.isArray()) {
return qx_bool(
true); }
340 QJsonArray arr = j.toArray();
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, std::tuple< T0, T1, T2, T3, T4 > &t, const QString &format)
static qx_bool fromJson(const QJsonValue &j, std::tuple< T0, T1, T2, T3 > &t, const QString &format)
static qx_bool fromJson(const QJsonValue &j, std::tuple< T0, T1, T2 > &t, const QString &format)
static qx_bool fromJson(const QJsonValue &j, std::tuple< T0, T1, T2, T3, T4, T5 > &t, const QString &format)
static qx_bool fromJson(const QJsonValue &j, std::tuple< T0, T1, T2, T3, T4, T5, T6, T7 > &t, const QString &format)
static qx_bool fromJson(const QJsonValue &j, std::tuple< T0, T1, T2, T3, T4, T5, T6, T7, T8 > &t, const QString &format)
static qx_bool fromJson(const QJsonValue &j, std::tuple< T0, T1, T2, T3, T4, T5, T6 > &t, const QString &format)
static qx_bool fromJson(const QJsonValue &j, std::tuple< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 > &t, const QString &format)
static qx_bool fromJson(const QJsonValue &j, std::tuple< T0, T1 > &t, const QString &format)
static QJsonValue toJson(const std::tuple< T0, T1, T2, T3, T4 > &t, const QString &format)
static QJsonValue toJson(const std::tuple< T0, T1, T2, T3 > &t, const QString &format)
static QJsonValue toJson(const std::tuple< T0, T1, T2, T3, T4, T5, T6, T7, T8 > &t, const QString &format)
static QJsonValue toJson(const std::tuple< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 > &t, const QString &format)
static QJsonValue toJson(const std::tuple< T0, T1, T2, T3, T4, T5, T6, T7 > &t, const QString &format)
static QJsonValue toJson(const std::tuple< T0, T1, T2, T3, T4, T5 > &t, const QString &format)
static QJsonValue toJson(const std::tuple< T0, T1, T2, T3, T4, T5, T6 > &t, const QString &format)
static QJsonValue toJson(const std::tuple< T0, T1, T2 > &t, const QString &format)
static QJsonValue toJson(const std::tuple< T0, T1 > &t, const QString &format)