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:40 +0200 |
commit | e93dcc2ecabee46d31aedf9f4ddc8058956c78ad (patch) | |
tree | e4a40ef98f4534cd9f3090b2d69e07f04642dcfb /odb/qt/containers/qlinked-list-traits.hxx | |
parent | 5ddc3cc84883aef3fbb5ab8991ad36c0185404ac (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/qt/containers/qlinked-list-traits.hxx')
-rw-r--r-- | odb/qt/containers/qlinked-list-traits.hxx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/odb/qt/containers/qlinked-list-traits.hxx b/odb/qt/containers/qlinked-list-traits.hxx index 6c1e9f0..c995fe1 100644 --- a/odb/qt/containers/qlinked-list-traits.hxx +++ b/odb/qt/containers/qlinked-list-traits.hxx @@ -17,7 +17,8 @@ namespace odb class access::container_traits<QLinkedList<T> > { public: - static container_kind const kind = ck_ordered; + static const container_kind kind = ck_ordered; + static const bool smart = false; typedef QLinkedList<T> container_type; @@ -33,7 +34,7 @@ namespace odb index_type i (0); for (typename container_type::const_iterator j (c.begin ()), e (c.end ()); j != e; ++j) - f.insert_one (i++, *j); + f.insert (i++, *j); } static void @@ -45,25 +46,25 @@ namespace odb { index_type dummy; c.append (value_type ()); - more = f.load_all (dummy, c.back ()); + more = f.select (dummy, c.back ()); } } static void update (const container_type& c, const functions& f) { - f.delete_all (); + f.delete_ (); index_type i (0); for (typename container_type::const_iterator j (c.begin ()), e (c.end ()); j != e; ++j) - f.insert_one (i++, *j); + f.insert (i++, *j); } static void erase (const functions& f) { - f.delete_all (); + f.delete_ (); } }; } |