51#ifdef _QX_ENABLE_BOOST_SERIALIZATION
53#include <boost/archive/archive_exception.hpp>
66#define QX_STR_CLONE_SERIALIZATION_ERROR "[QxOrm] qx::clone() serialization error : '%s'"
67#define QX_STR_CLONE_DESERIALIZATION_ERROR "[QxOrm] qx::clone() deserialization error : '%s'"
71#ifdef _QX_ENABLE_BOOST_SERIALIZATION
83 bool bSerializeOk =
false;
85 try { oar << obj; bSerializeOk = ioss.good(); }
89 if (! bSerializeOk) {
qAssert(
false);
return NULL; }
94 bool bDeserializeOk =
false;
96 try { iar >> (* pClone); bDeserializeOk = ioss.good(); }
102 return (bDeserializeOk ? pClone : NULL);
115 if (baClone.isEmpty()) {
qAssertMsg(
false,
"[QxOrm] qx::clone_to_nude_ptr",
"an error occurred during QDataStream serialization process");
return NULL; }
116 T * pClone =
new T();
118 return (bOk ? pClone : NULL);
128std::shared_ptr<T>
clone(
const T & obj)
131#ifdef _QX_ENABLE_BOOST
#define QX_STR_CLONE_DESERIALIZATION_ERROR
#define QX_STR_CLONE_SERIALIZATION_ERROR
#define qAssertMsg(test, where, what)
#define QX_CLONE_BINARY_OUTPUT_ARCHIVE
#define QX_CLONE_STRING_STREAM
#define QX_CLONE_BINARY_INPUT_ARCHIVE
Used when _QX_ENABLE_BOOST_SERIALIZATION compilation option is not defined to provide serialization e...
Include all Qt QDataStream serialization method (save/load) provided by QxOrm library.
qx_bool : boolean type with code and description message when an error occured
QSharedPointer< T > clone_to_qt_shared_ptr(const T &obj)
qx::clone_to_qt_shared_ptr(const T & obj) : return a Qt smart-pointer (QSharedPointer<T>) of a new in...
T * clone_to_nude_ptr(const T &obj)
qx::clone_to_nude_ptr(const T & obj) : return a nude pointer (be careful with memory leak) of a new i...
std::shared_ptr< T > clone_to_std_shared_ptr(const T &obj)
qx::clone_to_std_shared_ptr(const T & obj) : return a C++11 std smart-pointer (std::shared_ptr<T>) of...
std::shared_ptr< T > clone(const T &obj)
qx::clone(const T & obj) : return a boost smart-pointer (std::shared_ptr<T>) of a new instance of typ...
boost::shared_ptr< T > clone_to_boost_shared_ptr(const T &obj)
qx::clone_to_boost_shared_ptr(const T & obj) : return a boost smart-pointer (boost::shared_ptr<T>) of...
qx_bool from_byte_array(T &obj, const QByteArray &data, unsigned int flags=1)
QByteArray to_byte_array(const T &obj, void *owner=NULL, unsigned int flags=1)
Root namespace for all QxOrm library features.