32#ifndef _QX_ENABLE_BOOST
33#ifndef _QX_BOOST_OPTIONAL_ONLY_H_
34#define _QX_BOOST_OPTIONAL_ONLY_H_
47#include <boost/optional.hpp>
48#include <boost/none.hpp>
52#define _QX_ENABLE_BOOST
54#undef _QX_ENABLE_BOOST
77static inline QJsonValue
toJson(
const boost::optional<T> & t,
const QString & format)
78{
if (t) {
return qx::cvt::to_json((* t), format); };
return QJsonValue(); } };
81static inline qx_bool fromJson(
const QJsonValue & j, boost::optional<T> & t,
const QString & format)
83 if (j.isNull()) { t = boost::none;
return qx_bool(
true); }
84 else if (! t) { t = T(); }
92{
if (t) {
return qx::cvt::to_string((* t), format, index, ctx); };
return QString(); } };
105 if (v.isNull()) { t = boost::none;
return qx_bool(
true); }
106 else if (! t) { t = T(); }
Provide a Qt QDataStream serialization method (save/load) for type boost::optional<T>
qx::trait::construct_null_qvariant<T>::get() : create a NULL QVariant which matches QVariant::Type wi...
#define QX_REGISTER_CLASS_NAME_TEMPLATE_1(className)
Internal helper tools for qx::cvt namespace.
Provide global functions to convert any kind of objects to/from QString and QVariant format.
qx_bool from_variant(const QVariant &v, T &t, const QString &format=QString(), int index=-1, qx::cvt::context::ctx_type ctx=qx::cvt::context::e_no_context)
QVariant to_variant(const T &t, const QString &format=QString(), int index=-1, qx::cvt::context::ctx_type ctx=qx::cvt::context::e_no_context)
QString to_string(const T &t, const QString &format=QString(), int index=-1, qx::cvt::context::ctx_type ctx=qx::cvt::context::e_no_context)
qx_bool from_json(const QJsonValue &j, T &t, const QString &format=QString())
qx_bool from_string(const QString &s, T &t, const QString &format=QString(), int index=-1, qx::cvt::context::ctx_type ctx=qx::cvt::context::e_no_context)
QJsonValue to_json(const T &t, const QString &format=QString())
QxOrm library traits (template metaprogramming) not available in boost::type_traits library.
Root namespace for all QxOrm library features.
static qx_bool fromJson(const QJsonValue &j, T &t, const QString &format)
static qx_bool fromString(const QString &s, T &t, const QString &format, int index, qx::cvt::context::ctx_type ctx)
static qx_bool fromVariant(const QVariant &v, T &t, const QString &format, int index, qx::cvt::context::ctx_type ctx)
static QJsonValue toJson(const T &t, const QString &format)
static QString toString(const T &t, const QString &format, int index, qx::cvt::context::ctx_type ctx)
static QVariant toVariant(const T &t, const QString &format, int index, qx::cvt::context::ctx_type ctx)
qx::trait::get_sql_type<T>::get() : return type name under const char * format used by database engin...
static const char * get()