aboutsummaryrefslogtreecommitdiff
path: root/odb/qt/smart-ptr
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-09-21 13:00:34 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-09-21 13:00:34 +0200
commit5e8129bc2924abd1bfefb21598100bc519159fb6 (patch)
tree7cace19e1924d625b919413fdd41f62f762a684a /odb/qt/smart-ptr
parent9a5090e1845898a6b2342620d6f72d465e97171f (diff)
Rework const object handling
Now objects are always loaded as non-const and the object cache in session treats all objects as non-const.
Diffstat (limited to 'odb/qt/smart-ptr')
-rw-r--r--odb/qt/smart-ptr/pointer-traits.hxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/odb/qt/smart-ptr/pointer-traits.hxx b/odb/qt/smart-ptr/pointer-traits.hxx
index 8a981ba..7c26a4b 100644
--- a/odb/qt/smart-ptr/pointer-traits.hxx
+++ b/odb/qt/smart-ptr/pointer-traits.hxx
@@ -12,6 +12,7 @@
#include <QtCore/QWeakPointer>
#include <odb/pointer-traits.hxx>
+#include <odb/details/meta/remove-const.hxx>
namespace odb
{
@@ -27,6 +28,10 @@ namespace odb
typedef T element_type;
typedef QSharedPointer<element_type> pointer_type;
typedef QSharedPointer<const element_type> const_pointer_type;
+ typedef typename details::meta::remove_const<element_type>::result
+ unrestricted_element_type;
+ typedef QSharedPointer<unrestricted_element_type>
+ unrestricted_pointer_type;
typedef smart_ptr_guard<pointer_type> guard;
static element_type*
@@ -47,6 +52,12 @@ namespace odb
return !p;
}
+ static unrestricted_pointer_type
+ cast (const pointer_type& p)
+ {
+ return qSharedPointerConstCast<unrestricted_element_type> (p);
+ }
+
public:
static void*
allocate (std::size_t n)