33#ifdef _QX_ENABLE_BOOST
34#ifndef _QX_SERIALIZE_QJSON_BOOST_UNORDERED_SET_H_
35#define _QX_SERIALIZE_QJSON_BOOST_UNORDERED_SET_H_
48#include <QtCore/qjsonvalue.h>
49#include <QtCore/qjsonobject.h>
50#include <QtCore/qjsonarray.h>
62 static inline QJsonValue
toJson(
const boost::unordered_set<T> & t,
const QString & format)
65 typedef typename boost::unordered_set<T>::const_iterator type_itr;
66 for (type_itr itr = t.begin(); itr != t.end(); ++itr)
68 return QJsonValue(arr);
75 static inline qx_bool fromJson(
const QJsonValue & j, boost::unordered_set<T> & t,
const QString & format)
78 if (! j.isArray()) {
return qx_bool(
true); } QJsonArray arr = j.toArray();
79 t.reserve(
static_cast<typename boost::unordered_set<T>::size_type
>(arr.count()));
80 for (
int i = 0; i < arr.count(); i++)
89 static inline QJsonValue
toJson(
const boost::unordered_multiset<T> & t,
const QString & format)
92 typedef typename boost::unordered_multiset<T>::const_iterator type_itr;
93 for (type_itr itr = t.begin(); itr != t.end(); ++itr)
95 return QJsonValue(arr);
102 static inline qx_bool fromJson(
const QJsonValue & j, boost::unordered_multiset<T> & t,
const QString & format)
105 if (! j.isArray()) {
return qx_bool(
true); } QJsonArray arr = j.toArray();
106 t.reserve(
static_cast<typename boost::unordered_multiset<T>::size_type
>(arr.count()));
107 for (
int i = 0; i < arr.count(); i++)
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, boost::unordered_multiset< T > &t, const QString &format)
static qx_bool fromJson(const QJsonValue &j, boost::unordered_set< T > &t, const QString &format)
static QJsonValue toJson(const boost::unordered_multiset< T > &t, const QString &format)
static QJsonValue toJson(const boost::unordered_set< T > &t, const QString &format)