From 2c861078b1a75ba00550fb33dc7733536c413331 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 29 Oct 2012 10:08:30 +0200 Subject: Add static multi-database support for lazy pointers A lazy pointer must load the object using the static database interface with which it was initialized. --- odb/qt/smart-ptr/lazy-ptr.hxx | 31 ++++++++++++++++--------------- odb/qt/smart-ptr/lazy-ptr.ixx | 39 ++++++++++++++++++++------------------- 2 files changed, 36 insertions(+), 34 deletions(-) (limited to 'odb/qt/smart-ptr') diff --git a/odb/qt/smart-ptr/lazy-ptr.hxx b/odb/qt/smart-ptr/lazy-ptr.hxx index 1744a46..c50020a 100644 --- a/odb/qt/smart-ptr/lazy-ptr.hxx +++ b/odb/qt/smart-ptr/lazy-ptr.hxx @@ -153,19 +153,20 @@ public: // void unload () const; - template - QLazySharedPointer (database_type&, const ID&); + template + QLazySharedPointer (DB&, const ID&); - QLazySharedPointer (database_type&, T*); + template + QLazySharedPointer (DB&, T*); - template - QLazySharedPointer (database_type&, T*, Deleter); + template + QLazySharedPointer (DB&, T*, Deleter); - template - QLazySharedPointer (database_type&, const QSharedPointer&); + template + QLazySharedPointer (DB&, const QSharedPointer&); - template - QLazySharedPointer (database_type&, const QWeakPointer&); + template + QLazySharedPointer (DB&, const QWeakPointer&); #ifdef ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT template @@ -327,14 +328,14 @@ public: void unload () const; - template - QLazyWeakPointer (database_type&, const ID&); + template + QLazyWeakPointer (DB&, const ID&); - template - QLazyWeakPointer (database_type&, const QSharedPointer&); + template + QLazyWeakPointer (DB&, const QSharedPointer&); - template - QLazyWeakPointer (database_type&, const QWeakPointer&); + template + QLazyWeakPointer (DB&, const QWeakPointer&); // The objectId() function can only be called when the object is persistent, // or: toStrongRef().isNull() XOR loaded() (can use != for XOR). diff --git a/odb/qt/smart-ptr/lazy-ptr.ixx b/odb/qt/smart-ptr/lazy-ptr.ixx index 5fd3b2b..fd817ae 100644 --- a/odb/qt/smart-ptr/lazy-ptr.ixx +++ b/odb/qt/smart-ptr/lazy-ptr.ixx @@ -221,47 +221,48 @@ unload () const } template -template +template inline QLazySharedPointer:: -QLazySharedPointer (database_type& db, const ID& id): i_ (db, id) {} +QLazySharedPointer (DB& db, const ID& id): i_ (db, id) {} template +template inline QLazySharedPointer:: -QLazySharedPointer (database_type& db, T* p) +QLazySharedPointer (DB& db, T* p) : p_ (p) { if (p_) - i_.reset (db); + i_.reset_db (db); } template -template +template inline QLazySharedPointer:: -QLazySharedPointer (database_type& db, T* p, Deleter d) +QLazySharedPointer (DB& db, T* p, Deleter d) : p_ (p, d) { if (p_) - i_.reset (db); + i_.reset_db (db); } template -template +template inline QLazySharedPointer:: -QLazySharedPointer (database_type& db, const QSharedPointer& r) +QLazySharedPointer (DB& db, const QSharedPointer& r) : p_ (r) { if (p_) - i_.reset (db); + i_.reset_db (db); } template -template +template inline QLazySharedPointer:: -QLazySharedPointer (database_type& db, const QWeakPointer& r) +QLazySharedPointer (DB& db, const QWeakPointer& r) : p_ (r) { if (p_) - i_.reset (db); + i_.reset_db (db); } template @@ -478,14 +479,14 @@ unload () const } template -template +template inline QLazyWeakPointer:: -QLazyWeakPointer (database_type& db, const ID& id): i_ (db, id) {} +QLazyWeakPointer (DB& db, const ID& id): i_ (db, id) {} template -template +template inline QLazyWeakPointer:: -QLazyWeakPointer (database_type& db, const QSharedPointer& r) +QLazyWeakPointer (DB& db, const QSharedPointer& r) : p_ (r) { typedef typename odb::object_traits::object_type object_type; @@ -495,9 +496,9 @@ QLazyWeakPointer (database_type& db, const QSharedPointer& r) } template -template +template inline QLazyWeakPointer:: -QLazyWeakPointer (database_type& db, const QWeakPointer& r) +QLazyWeakPointer (DB& db, const QWeakPointer& r) : p_ (r) { typedef typename odb::object_traits::object_type object_type; -- cgit v1.1