diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-02-05 15:50:07 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-02-05 15:50:07 +0200 |
commit | 1b88d6afa7839d087e5fc252195c5c4f60475e9f (patch) | |
tree | df7e216f369295e15211f5dbb92979bff8aef731 /odb/boost/unordered | |
parent | ddd2dd88c8b52d33a9306066c626f4405179b921 (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/boost/unordered')
-rw-r--r-- | odb/boost/unordered/container-traits.hxx | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/odb/boost/unordered/container-traits.hxx b/odb/boost/unordered/container-traits.hxx index 49011eb..369027f 100644 --- a/odb/boost/unordered/container-traits.hxx +++ b/odb/boost/unordered/container-traits.hxx @@ -29,7 +29,8 @@ namespace odb class access::container_traits< ::boost::unordered_set<V, H, P, A> > { public: - static container_kind const kind = ck_set; + static const container_kind kind = ck_set; + static const bool smart = false; typedef ::boost::unordered_set<V, H, P, A> container_type; typedef V value_type; @@ -42,7 +43,7 @@ namespace odb { for (typename container_type::const_iterator i (c.begin ()), e (c.end ()); i != e; ++i) - f.insert_one (*i); + f.insert (*i); } static void @@ -53,7 +54,7 @@ namespace odb while (more) { value_type v; - more = f.load_all (v); + more = f.select (v); #ifdef ODB_CXX11 c.insert (std::move (v)); #else @@ -65,17 +66,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); + f.insert (*i); } static void erase (const functions& f) { - f.delete_all (); + f.delete_ (); } }; @@ -89,7 +90,8 @@ namespace odb class access::container_traits< ::boost::unordered_multiset<V, H, P, A> > { public: - static container_kind const kind = ck_multiset; + static const container_kind kind = ck_multiset; + static const bool smart = false; typedef ::boost::unordered_multiset<V, H, P, A> container_type; typedef V value_type; @@ -102,7 +104,7 @@ namespace odb { for (typename container_type::const_iterator i (c.begin ()), e (c.end ()); i != e; ++i) - f.insert_one (*i); + f.insert (*i); } static void @@ -113,7 +115,7 @@ namespace odb while (more) { value_type v; - more = f.load_all (v); + more = f.select (v); #ifdef ODB_CXX11 c.insert (std::move (v)); #else @@ -125,17 +127,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); + f.insert (*i); } static void erase (const functions& f) { - f.delete_all (); + f.delete_ (); } }; @@ -145,7 +147,8 @@ namespace odb class access::container_traits< ::boost::unordered_map<K, V, H, P, A> > { public: - static container_kind const kind = ck_map; + static const container_kind kind = ck_map; + static const bool smart = false; typedef ::boost::unordered_map<K, V, H, P, A> container_type; @@ -161,7 +164,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 @@ -173,7 +176,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))); @@ -186,17 +189,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_ (); } }; @@ -210,7 +213,8 @@ namespace odb class access::container_traits< ::boost::unordered_multimap<K, V, H, P, A> > { public: - static container_kind const kind = ck_multimap; + static const container_kind kind = ck_multimap; + static const bool smart = false; typedef ::boost::unordered_multimap<K, V, H, P, A> container_type; @@ -226,7 +230,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 @@ -238,7 +242,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))); @@ -251,17 +255,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_ (); } }; } |