aboutsummaryrefslogtreecommitdiff
path: root/odb/std-set-traits.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-02-05 15:50:06 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-02-05 15:50:06 +0200
commit2b856f69d490f6cedffac03ecbed8fef318ecc43 (patch)
tree0876ef0d3539bb313a9dd66659e805e6980399aa /odb/std-set-traits.hxx
parent20daa3c4285c91dfcd35361f6550f80315e008a5 (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-set-traits.hxx')
-rw-r--r--odb/std-set-traits.hxx26
1 files changed, 14 insertions, 12 deletions
diff --git a/odb/std-set-traits.hxx b/odb/std-set-traits.hxx
index e6b4853..6df5c61 100644
--- a/odb/std-set-traits.hxx
+++ b/odb/std-set-traits.hxx
@@ -19,7 +19,8 @@ namespace odb
class access::container_traits<std::set<V, C, A> >
{
public:
- static container_kind const kind = ck_set;
+ static const container_kind kind = ck_set;
+ static const bool smart = false;
typedef std::set<V, C, A> container_type;
typedef V value_type;
@@ -32,7 +33,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
@@ -43,7 +44,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
@@ -55,17 +56,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_ ();
}
};
@@ -77,7 +78,8 @@ namespace odb
class access::container_traits<std::multiset<V, C, A> >
{
public:
- static container_kind const kind = ck_multiset;
+ static const container_kind kind = ck_multiset;
+ static const bool smart = false;
typedef std::multiset<V, C, A> container_type;
typedef V value_type;
@@ -90,7 +92,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
@@ -101,7 +103,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
@@ -113,17 +115,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_ ();
}
};
}