From 43fa55c1b8e389838c83be933bb30a2caaf7468d Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 5 Feb 2013 15:50:08 +0200 Subject: 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. --- qt/common/containers/change-tracking/test.hxx | 43 +++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 qt/common/containers/change-tracking/test.hxx (limited to 'qt/common/containers/change-tracking/test.hxx') diff --git a/qt/common/containers/change-tracking/test.hxx b/qt/common/containers/change-tracking/test.hxx new file mode 100644 index 0000000..7ad230e --- /dev/null +++ b/qt/common/containers/change-tracking/test.hxx @@ -0,0 +1,43 @@ +// file : qt/common/containers/change-tracking/test.hxx +// copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef TEST_HXX +#define TEST_HXX + +#include // HAVE_CXX11 + +#include + +#ifdef HAVE_CXX11 +# include // std::move +#endif + +#include + +#include +#include + +#pragma db object pointer(std::auto_ptr) +struct object +{ + object () {} + object (const QString& id): id_ (id) {} + +#ifdef HAVE_CXX11 + object (const object& x): id_ (x.id_), i (x.i), s (x.s) {} + object (object&& x): id_ (std::move (x.id_)), i (x.i), s (std::move (x.s)) {} +#endif + + #pragma db id + QString id_; + + unsigned int i; + + QOdbList s; + + inline bool + operator== (const object& o) {return id_ == o.id_ && i == o.i && s == o.s;} +}; + +#endif // TEST_HXX -- cgit v1.1