diff options
-rw-r--r-- | odb/qt/smart-ptr/lazy-ptr.hxx | 7 | ||||
-rw-r--r-- | odb/qt/smart-ptr/lazy-ptr.ixx | 7 | ||||
-rw-r--r-- | odb/qt/smart-ptr/lazy-ptr.txx | 23 |
3 files changed, 14 insertions, 23 deletions
diff --git a/odb/qt/smart-ptr/lazy-ptr.hxx b/odb/qt/smart-ptr/lazy-ptr.hxx index e964837..664eb7f 100644 --- a/odb/qt/smart-ptr/lazy-ptr.hxx +++ b/odb/qt/smart-ptr/lazy-ptr.hxx @@ -196,6 +196,13 @@ private: template <class X> friend class QLazySharedPointer; template <class X> friend class QLazyWeakPointer; + // For QLazyWeakPointer::toStrongRef(). + // + QLazySharedPointer (const QSharedPointer<T>& p, + const odb::lazy_ptr_impl<T>& i) + : p_ (p), i_ (i) {} + +private: mutable QSharedPointer<T> p_; mutable odb::lazy_ptr_impl<T> i_; }; diff --git a/odb/qt/smart-ptr/lazy-ptr.ixx b/odb/qt/smart-ptr/lazy-ptr.ixx index d2b462f..181044c 100644 --- a/odb/qt/smart-ptr/lazy-ptr.ixx +++ b/odb/qt/smart-ptr/lazy-ptr.ixx @@ -196,6 +196,13 @@ loaded () const } template <class T> +inline QLazySharedPointer<T> QLazyWeakPointer<T>:: +toStrongRef () const +{ + return QLazySharedPointer<T> (p_.toStrongRef (), i_); +} + +template <class T> inline QSharedPointer<T> QLazySharedPointer<T>:: load () const { diff --git a/odb/qt/smart-ptr/lazy-ptr.txx b/odb/qt/smart-ptr/lazy-ptr.txx index 9e8be80..2497811 100644 --- a/odb/qt/smart-ptr/lazy-ptr.txx +++ b/odb/qt/smart-ptr/lazy-ptr.txx @@ -73,26 +73,3 @@ equal (const QLazySharedPointer<X>& r) const return r.equal (sp); } - -template <class T> -QLazySharedPointer<T> QLazyWeakPointer<T>:: -toStrongRef () const -{ - QSharedPointer<T> sp (p_.toStrongRef ()); - - if (sp) - { - if (database_type* db = i_.database ()) - return QLazySharedPointer<T> (*db, sp); - else - return QLazySharedPointer<T> (sp); - } - else - { - if (i_) - return QLazySharedPointer<T> ( - *i_.database (), i_.template object_id<T> ()); - else - return QLazySharedPointer<T> (); - } -} |