32#ifndef _QX_DAO_POINTER_H_
33#define _QX_DAO_POINTER_H_
46#include <QtCore/qsharedpointer.h>
47#include <QtCore/qstringlist.h>
48#include <QtCore/qdatastream.h>
58template <
typename T>
class ptr;
141 template <
class U>
friend QDataStream & ::operator<< (QDataStream & stream,
const qx::dao::ptr<U> & t);
142 template <
class U>
friend QDataStream & ::operator>> (QDataStream & stream,
qx::dao::ptr<U> & t);
156 ptr(
const QSharedPointer<T> & other,
const QSharedPointer<T> & original) :
m_pWork(other),
m_pOriginal(original) { ; }
165 template <
class X>
ptr(
const QSharedPointer<X> & other) :
m_pWork(qSharedPointerCast<T>(other)) { ; }
166 template <
class X>
ptr(
const QSharedPointer<X> & other,
const QSharedPointer<T> & original) :
m_pWork(qSharedPointerCast<T>(other)),
m_pOriginal(qSharedPointerCast<T>(original)) { ; }
167 template <
class X>
ptr(
const QWeakPointer<X> & other) :
m_pWork(qSharedPointerCast<T>(other.toStrongRef())) { ; }
168 template <
class X>
ptr(
const QWeakPointer<X> & other,
const QWeakPointer<X> & original) :
m_pWork(qSharedPointerCast<T>(other.toStrongRef())),
m_pOriginal(qSharedPointerCast<T>(original.toStrongRef())) { ; }
183 inline operator bool()
const {
return (!
m_pWork.isNull()); }
206 return (! lstDiff.isEmpty());
bool operator==(const qx::dao::ptr< T > &ptr1, const qx::dao::ptr< X > &ptr2)
QDataStream & operator<<(QDataStream &stream, const qx::dao::ptr< T > &t)
bool operator!=(const qx::dao::ptr< T > &ptr1, const qx::dao::ptr< X > &ptr2)
QDataStream & operator>>(QDataStream &stream, qx::dao::ptr< T > &t)
Provide a Qt QDataStream serialization method (save/load) for type QSharedPointer<T>
qx::dao::ptr<T> : provide a classic smart-pointer (like boost::shared_ptr<T> or QSharedPointer<T>) wi...
ptr(const QWeakPointer< T > &other)
bool isDirty(QStringList &lstDiff) const
qx::dao::ptr< X > constCast() const
ptr(T *ptr, T *original, Deleter deleter)
qx::dao::ptr< T > & operator=(const QSharedPointer< T > &other)
ptr(const QSharedPointer< X > &other, const QSharedPointer< T > &original)
qx::dao::ptr< T > & operator=(const qx::dao::ptr< X > &other)
qx::dao::ptr< X > dynamicCast() const
qx::dao::ptr< X > staticCast() const
ptr(const QSharedPointer< X > &other)
ptr(const QWeakPointer< X > &other)
void resetOriginal(const QSharedPointer< T > &ptr)
ptr(const qx::dao::ptr< T > &other)
ptr(T *ptr, Deleter deleter)
void restoreFromOriginal()
qx::dao::ptr< T > & operator=(const QWeakPointer< T > &other)
ptr(const QSharedPointer< T > &other)
ptr(const QSharedPointer< T > &other, const QSharedPointer< T > &original)
QSharedPointer< T > m_pOriginal
Keep original pointer containing all values from database.
qx::dao::ptr< T > & operator=(const QSharedPointer< X > &other)
qx::dao::ptr< T > & operator=(const qx::dao::ptr< T > &other)
QSharedPointer< T > m_pWork
Default pointer => user works with this pointer.
qx::dao::ptr< T > & operator=(const QWeakPointer< X > &other)
QSharedPointer< T > toQtSharedPointer() const
ptr(const QWeakPointer< X > &other, const QWeakPointer< X > &original)
void reset(const QSharedPointer< T > &ptr)
ptr(const qx::dao::ptr< X > &other)
ptr(const QWeakPointer< T > &other, const QWeakPointer< T > &original)
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...
Root namespace for all QxOrm library features.
static void compare(const T &obj1, const T &obj2, QStringList &lstDiff)