aboutsummaryrefslogtreecommitdiff
path: root/odb/context.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-02-05 15:50:07 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-02-05 15:50:07 +0200
commit5b27e12cc00c3faf4f8171d4f41a0ec5d155db48 (patch)
tree69c46d3fc0380d1681283c87bd90227e6e1138ae /odb/context.cxx
parent07299aa3a0a840845c5d22b74af30aa0ce3ac9f1 (diff)
Add support for change-tracking containers
ODB now supports "smart" ordered containers. Such containers get extra functions for updating and deleting individual elements. Based on this functionality implement two change-tracking containers: odb::vector (equivalent to std::vector) and QOdbList (equivalent to QList). New tests: common/container/change-tracking and qt/common/container/change- tracking.
Diffstat (limited to 'odb/context.cxx')
-rw-r--r--odb/context.cxx19
1 files changed, 13 insertions, 6 deletions
diff --git a/odb/context.cxx b/odb/context.cxx
index 515e9a8..e419aba 100644
--- a/odb/context.cxx
+++ b/odb/context.cxx
@@ -2274,7 +2274,8 @@ namespace
unsigned short f (flags_ & (context::test_container |
context::test_straight_container |
context::test_inverse_container |
- context::test_readonly_container));
+ context::test_readonly_container |
+ context::test_smart_container));
if (context::is_a (member_path_,
member_scope_,
@@ -2319,22 +2320,28 @@ is_a (data_member_path const& mp,
if (f & test_lazy_pointer)
r = r || (object_pointer (t) && lazy_pointer (t));
+ semantics::type* c;
if ((f & (test_container |
test_straight_container |
test_inverse_container |
- test_readonly_container)) != 0)
+ test_readonly_container |
+ test_smart_container)) != 0 &&
+ (c = container (m)) != 0)
{
if (f & test_container)
- r = r || container (m);
+ r = r || true;
if (f & test_straight_container)
- r = r || (container(m) && !inverse (m, kp));
+ r = r || !inverse (m, kp);
if (f & test_inverse_container)
- r = r || (container (m) && inverse (m, kp));
+ r = r || inverse (m, kp);
if (f & test_readonly_container)
- r = r || (container (m) && readonly (mp, ms));
+ r = r || readonly (mp, ms);
+
+ if (f & test_smart_container)
+ r = r || (!inverse (m, kp) && !unordered (m) && container_smart (*c));
}
return r;