diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-02-05 15:50:06 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-02-05 15:50:06 +0200 |
commit | 2b856f69d490f6cedffac03ecbed8fef318ecc43 (patch) | |
tree | 0876ef0d3539bb313a9dd66659e805e6980399aa /odb/std-map-traits.hxx | |
parent | 20daa3c4285c91dfcd35361f6550f80315e008a5 (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/std-map-traits.hxx')
-rw-r--r-- | odb/std-map-traits.hxx | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/odb/std-map-traits.hxx b/odb/std-map-traits.hxx index a30b13e..7347172 100644 --- a/odb/std-map-traits.hxx +++ b/odb/std-map-traits.hxx @@ -19,7 +19,8 @@ namespace odb class access::container_traits<std::map<K, V, C, A> > { public: - static container_kind const kind = ck_map; + static const container_kind kind = ck_map; + static const bool smart = false; typedef std::map<K, V, C, A> container_type; @@ -35,7 +36,7 @@ namespace odb { for (typename container_type::const_iterator i (c.begin ()), e (c.end ()); i != e; ++i) - f.insert_one (i->first, i->second); + f.insert (i->first, i->second); } static void @@ -47,7 +48,7 @@ namespace odb { key_type k; value_type v; - more = f.load_all (k, v); + more = f.select (k, v); #ifdef ODB_CXX11 c.insert (pair_type (std::move (k), std::move (v))); #else @@ -59,17 +60,17 @@ namespace odb static void update (const container_type& c, const functions& f) { - f.delete_all (); + f.delete_ (); for (typename container_type::const_iterator i (c.begin ()), e (c.end ()); i != e; ++i) - f.insert_one (i->first, i->second); + f.insert (i->first, i->second); } static void erase (const functions& f) { - f.delete_all (); + f.delete_ (); } }; @@ -81,7 +82,8 @@ namespace odb class access::container_traits<std::multimap<K, V, C, A> > { public: - static container_kind const kind = ck_multimap; + static const container_kind kind = ck_multimap; + static const bool smart = false; typedef std::multimap<K, V, C, A> container_type; @@ -97,7 +99,7 @@ namespace odb { for (typename container_type::const_iterator i (c.begin ()), e (c.end ()); i != e; ++i) - f.insert_one (i->first, i->second); + f.insert (i->first, i->second); } static void @@ -109,7 +111,7 @@ namespace odb { key_type k; value_type v; - more = f.load_all (k, v); + more = f.select (k, v); #ifdef ODB_CXX11 c.insert (pair_type (std::move (k), std::move (v))); #else @@ -121,17 +123,17 @@ namespace odb static void update (const container_type& c, const functions& f) { - f.delete_all (); + f.delete_ (); for (typename container_type::const_iterator i (c.begin ()), e (c.end ()); i != e; ++i) - f.insert_one (i->first, i->second); + f.insert (i->first, i->second); } static void erase (const functions& f) { - f.delete_all (); + f.delete_ (); } }; } |