aboutsummaryrefslogtreecommitdiff
path: root/odb/qt/smart-ptr
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-10-29 10:08:30 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-10-29 10:08:30 +0200
commit2c861078b1a75ba00550fb33dc7733536c413331 (patch)
tree16307298a2d225680f9d7b386d13701039d3d1bb /odb/qt/smart-ptr
parent44846d8af462f0823836691b488483bb7d9d2db1 (diff)
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.
Diffstat (limited to 'odb/qt/smart-ptr')
-rw-r--r--odb/qt/smart-ptr/lazy-ptr.hxx31
-rw-r--r--odb/qt/smart-ptr/lazy-ptr.ixx39
2 files changed, 36 insertions, 34 deletions
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 <class ID>
- QLazySharedPointer (database_type&, const ID&);
+ template <class DB, class ID>
+ QLazySharedPointer (DB&, const ID&);
- QLazySharedPointer (database_type&, T*);
+ template <class DB>
+ QLazySharedPointer (DB&, T*);
- template <class Deleter>
- QLazySharedPointer (database_type&, T*, Deleter);
+ template <class DB, class Deleter>
+ QLazySharedPointer (DB&, T*, Deleter);
- template <class X>
- QLazySharedPointer (database_type&, const QSharedPointer<X>&);
+ template <class DB, class X>
+ QLazySharedPointer (DB&, const QSharedPointer<X>&);
- template <class X>
- QLazySharedPointer (database_type&, const QWeakPointer<X>&);
+ template <class DB, class X>
+ QLazySharedPointer (DB&, const QWeakPointer<X>&);
#ifdef ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT
template <class O = T>
@@ -327,14 +328,14 @@ public:
void
unload () const;
- template <class ID>
- QLazyWeakPointer (database_type&, const ID&);
+ template <class DB, class ID>
+ QLazyWeakPointer (DB&, const ID&);
- template <class X>
- QLazyWeakPointer (database_type&, const QSharedPointer<X>&);
+ template <class DB, class X>
+ QLazyWeakPointer (DB&, const QSharedPointer<X>&);
- template <class X>
- QLazyWeakPointer (database_type&, const QWeakPointer<X>&);
+ template <class DB, class X>
+ QLazyWeakPointer (DB&, const QWeakPointer<X>&);
// 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 <class T>
-template <class ID>
+template <class DB, class ID>
inline QLazySharedPointer<T>::
-QLazySharedPointer (database_type& db, const ID& id): i_ (db, id) {}
+QLazySharedPointer (DB& db, const ID& id): i_ (db, id) {}
template <class T>
+template <class DB>
inline QLazySharedPointer<T>::
-QLazySharedPointer (database_type& db, T* p)
+QLazySharedPointer (DB& db, T* p)
: p_ (p)
{
if (p_)
- i_.reset (db);
+ i_.reset_db (db);
}
template <class T>
-template <class Deleter>
+template <class DB, class Deleter>
inline QLazySharedPointer<T>::
-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 <class T>
-template <class Y>
+template <class DB, class Y>
inline QLazySharedPointer<T>::
-QLazySharedPointer (database_type& db, const QSharedPointer<Y>& r)
+QLazySharedPointer (DB& db, const QSharedPointer<Y>& r)
: p_ (r)
{
if (p_)
- i_.reset (db);
+ i_.reset_db (db);
}
template <class T>
-template <class Y>
+template <class DB, class Y>
inline QLazySharedPointer<T>::
-QLazySharedPointer (database_type& db, const QWeakPointer<Y>& r)
+QLazySharedPointer (DB& db, const QWeakPointer<Y>& r)
: p_ (r)
{
if (p_)
- i_.reset (db);
+ i_.reset_db (db);
}
template <class T>
@@ -478,14 +479,14 @@ unload () const
}
template <class T>
-template <class ID>
+template <class DB, class ID>
inline QLazyWeakPointer<T>::
-QLazyWeakPointer (database_type& db, const ID& id): i_ (db, id) {}
+QLazyWeakPointer (DB& db, const ID& id): i_ (db, id) {}
template <class T>
-template <class X>
+template <class DB, class X>
inline QLazyWeakPointer<T>::
-QLazyWeakPointer (database_type& db, const QSharedPointer<X>& r)
+QLazyWeakPointer (DB& db, const QSharedPointer<X>& r)
: p_ (r)
{
typedef typename odb::object_traits<T>::object_type object_type;
@@ -495,9 +496,9 @@ QLazyWeakPointer (database_type& db, const QSharedPointer<X>& r)
}
template <class T>
-template <class X>
+template <class DB, class X>
inline QLazyWeakPointer<T>::
-QLazyWeakPointer (database_type& db, const QWeakPointer<X>& r)
+QLazyWeakPointer (DB& db, const QWeakPointer<X>& r)
: p_ (r)
{
typedef typename odb::object_traits<T>::object_type object_type;