summaryrefslogtreecommitdiff
path: root/libodb-qt/odb/qt/containers
diff options
context:
space:
mode:
Diffstat (limited to 'libodb-qt/odb/qt/containers')
-rw-r--r--libodb-qt/odb/qt/containers/list-iterator.hxx30
-rw-r--r--libodb-qt/odb/qt/containers/list-traits.hxx107
-rw-r--r--libodb-qt/odb/qt/containers/list-traits.txx101
-rw-r--r--libodb-qt/odb/qt/containers/list.hxx433
-rw-r--r--libodb-qt/odb/qt/containers/list.ixx318
-rw-r--r--libodb-qt/odb/qt/containers/mutable-list-iterator.hxx110
-rw-r--r--libodb-qt/odb/qt/containers/qhash-traits.hxx129
-rw-r--r--libodb-qt/odb/qt/containers/qlinked-list-traits.hxx82
-rw-r--r--libodb-qt/odb/qt/containers/qlist-traits.hxx72
-rw-r--r--libodb-qt/odb/qt/containers/qmap-traits.hxx130
-rw-r--r--libodb-qt/odb/qt/containers/qset-traits.hxx69
-rw-r--r--libodb-qt/odb/qt/containers/qvector-traits.hxx82
12 files changed, 1663 insertions, 0 deletions
diff --git a/libodb-qt/odb/qt/containers/list-iterator.hxx b/libodb-qt/odb/qt/containers/list-iterator.hxx
new file mode 100644
index 0000000..67f56fd
--- /dev/null
+++ b/libodb-qt/odb/qt/containers/list-iterator.hxx
@@ -0,0 +1,30 @@
+// file : odb/qt/containers/list-iterator.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_QT_CONTAINERS_LIST_ITERATOR_HXX
+#define ODB_QT_CONTAINERS_LIST_ITERATOR_HXX
+
+#include <odb/pre.hxx>
+
+#include <QtCore/QListIterator>
+
+#include <odb/qt/list.hxx>
+
+// Java-style QListIterator-like iterator. You can also use the
+// QListIterator directly (but not QMutableListIterator).
+//
+template <typename T>
+class QOdbListIterator: public QListIterator<T>
+{
+public:
+ QOdbListIterator (const QOdbList<T>& c): QListIterator<T> (c) {}
+ QOdbListIterator& operator=(const QOdbList<T>& c)
+ {
+ static_cast<QListIterator<T>&> (*this) = c;
+ return *this;
+ }
+};
+
+#include <odb/post.hxx>
+
+#endif // ODB_QT_CONTAINERS_LIST_ITERATOR_HXX
diff --git a/libodb-qt/odb/qt/containers/list-traits.hxx b/libodb-qt/odb/qt/containers/list-traits.hxx
new file mode 100644
index 0000000..5a3ee38
--- /dev/null
+++ b/libodb-qt/odb/qt/containers/list-traits.hxx
@@ -0,0 +1,107 @@
+// file : odb/qt/containers/list-traits.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_QT_CONTAINERS_LIST_TRAITS_HXX
+#define ODB_QT_CONTAINERS_LIST_TRAITS_HXX
+
+#include <odb/pre.hxx>
+
+#include <odb/vector-impl.hxx>
+#include <odb/container-traits.hxx>
+#include <odb/transaction.hxx>
+
+#include <odb/qt/containers/list.hxx>
+
+namespace odb
+{
+ template <typename V>
+ class access::container_traits<QOdbList<V> >
+ {
+ public:
+ static const container_kind kind = ck_ordered;
+ static const bool smart = true;
+
+ typedef QOdbList<V> container_type;
+
+ typedef V value_type;
+ typedef typename container_type::size_type index_type;
+
+ typedef smart_ordered_functions<index_type, value_type> functions;
+ typedef ordered_functions<index_type, value_type> dumb_functions;
+
+ public:
+ static void
+ persist (const container_type& c, const functions& f)
+ {
+ for (index_type i (0), n (c.size ()); i < n; ++i)
+ f.insert (i, c[i]);
+
+ // Now that this container is persistent, start tracking changes.
+ //
+ c._start ();
+ }
+
+ static void
+ load (container_type& c, bool more, const functions& f)
+ {
+ // Stop tracking changes.
+ //
+ c._stop ();
+
+ // Load.
+ //
+ c.clear ();
+ while (more)
+ {
+ index_type dummy;
+ c.append (value_type ());
+ more = f.select (dummy, c.modify_back ());
+ }
+
+ // Start tracking changes.
+ //
+ c._start ();
+ }
+
+ static bool
+ changed (const container_type&);
+
+ static void
+ update (const container_type&, const functions&);
+
+ static void
+ erase (const container_type* c, const functions& f)
+ {
+ f.delete_ (0);
+
+ // Stop tracking changes.
+ //
+ if (c != 0)
+ c->_stop ();
+ }
+
+ // Version of load() for dumb functions. Used to support
+ // inverse members of the container type. The implementation
+ // is identical to the smart one except we don't turn off/on
+ // change tracking.
+ //
+ static void
+ load (container_type& c, bool more, const dumb_functions& f)
+ {
+ c.clear ();
+
+ while (more)
+ {
+ index_type dummy;
+ c.append (value_type ());
+ more = f.select (dummy, c.modify_back ());
+ }
+ }
+ };
+}
+
+#include <odb/qt/containers/list-traits.txx>
+
+#include <odb/post.hxx>
+
+#endif // ODB_QT_CONTAINERS_LIST_TRAITS_HXX
diff --git a/libodb-qt/odb/qt/containers/list-traits.txx b/libodb-qt/odb/qt/containers/list-traits.txx
new file mode 100644
index 0000000..105fc2a
--- /dev/null
+++ b/libodb-qt/odb/qt/containers/list-traits.txx
@@ -0,0 +1,101 @@
+// file : odb/qt/containers/list-traits.txx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+namespace odb
+{
+ template <typename V>
+ bool access::container_traits<QOdbList<V> >::
+ changed (const container_type& c)
+ {
+ // Because modifications can cancel each other (e.g., push and pop),
+ // it is tricky to keep track of whether there are any changes in
+ // the container. Instead, we are just going to examine each element
+ // just like update().
+ //
+
+ // We should either be tracking or summarily changed.
+ //
+ if (c._tracking ())
+ {
+ const vector_impl& impl (c._impl ());
+
+ for (std::size_t i (0), n (impl.size ()); i < n; ++i)
+ {
+ if (impl.state (i) != vector_impl::state_unchanged)
+ return true;
+ }
+ }
+ else
+ return true;
+
+ return false;
+ }
+
+ template <typename V>
+ void access::container_traits<QOdbList<V> >::
+ update (const container_type& c, const functions& f)
+ {
+ bool u (false); // Updated flag.
+
+ if (c._tracking ())
+ {
+ const vector_impl& impl (c._impl ());
+
+ for (std::size_t i (0), n (impl.size ()); i < n; ++i)
+ {
+ vector_impl::element_state_type s (impl.state (i));
+ index_type ii (static_cast<index_type> (i));
+
+ switch (s)
+ {
+ case vector_impl::state_unchanged:
+ {
+ break;
+ }
+ case vector_impl::state_inserted:
+ {
+ f.insert (ii, c[ii]);
+ u = u || true;
+ break;
+ }
+ case vector_impl::state_updated:
+ {
+ f.update (ii, c[ii]);
+ u = u || true;
+ break;
+ }
+ case vector_impl::state_erased:
+ {
+ f.delete_ (ii); // Delete from i onwards.
+ u = u || true;
+ break;
+ }
+ }
+
+ // We delete all trailing elements in one go.
+ //
+ if (s == vector_impl::state_erased)
+ break;
+ }
+ }
+ else
+ {
+ // Fall back to delete all/insert all.
+ //
+ f.delete_ (0);
+
+ for (index_type i (0), n (c.size ()); i < n; ++i)
+ f.insert (i, c[i]);
+
+ u = true;
+ }
+
+ // Arm the rollback callback and (re)start change tracking.
+ //
+ if (u)
+ {
+ c._arm (transaction::current ());
+ c._start ();
+ }
+ }
+}
diff --git a/libodb-qt/odb/qt/containers/list.hxx b/libodb-qt/odb/qt/containers/list.hxx
new file mode 100644
index 0000000..143deed
--- /dev/null
+++ b/libodb-qt/odb/qt/containers/list.hxx
@@ -0,0 +1,433 @@
+// file : odb/qt/containers/list.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_QT_CONTAINERS_LIST_HXX
+#define ODB_QT_CONTAINERS_LIST_HXX
+
+#include <odb/pre.hxx>
+#include <odb/details/config.hxx> // ODB_CXX11
+
+#include <QtCore/QtGlobal> // QT_VERSION
+#include <QtCore/QList>
+
+#ifdef ODB_CXX11
+# include <utility> // std::move
+# if defined(ODB_CXX11_INITIALIZER_LIST) && \
+ defined(Q_COMPILER_INITIALIZER_LISTS)
+# include <initializer_list>
+# endif
+#endif
+
+#include <odb/vector-impl.hxx>
+
+// A QList-like container that keeps track of changes.
+//
+// Note that the style and order of definitions is (mostly) as
+// appears in the qlist.h Qt header (except for some cleanups,
+// such as superfluous inline use).
+//
+template <typename L>
+class QOdbListIteratorImpl;
+
+template <typename T>
+class QOdbList: public odb::vector_base
+{
+public:
+ typedef QList<T> base_list_type;
+ typedef typename base_list_type::iterator base_iterator_type;
+
+ QOdbList() {}
+ QOdbList(const QOdbList &x): vector_base (x), l_ (x.l_) {}
+ // ~QOdbList();
+ QOdbList &operator=(const QOdbList &l);
+
+#if QT_VERSION >= 0x040800
+ void swap(QOdbList &other);
+#endif
+
+#ifdef ODB_CXX11
+ QOdbList(QOdbList &&x) noexcept
+ : vector_base (std::move (x)), l_ (std::move (x.l_)) {}
+
+ // Note: noexcept is not specified since it can throw while reallocating
+ // impl_.
+ //
+ QOdbList &operator=(QOdbList &&other);
+
+#if defined(ODB_CXX11_INITIALIZER_LIST) && \
+ defined(Q_COMPILER_INITIALIZER_LISTS)
+ QOdbList(std::initializer_list<T> il): l_ (il) {}
+#endif
+#endif
+
+ // Implicit conversion.
+ //
+ bool operator==(const QList<T> &x) const {return l_ == x;}
+ bool operator!=(const QList<T> &x) const {return l_ != x;}
+
+ int size() const {return l_.size ();}
+ void detach() {l_.detach ();}
+ void detachShared() {l_.detachShared ();}
+ bool isDetached() const {return l_.isDetached ();}
+ void setSharable(bool sharable) {l_.setSharable (sharable);}
+ // Implicit conversion.
+ bool isSharedWith(const QList<T> &x) const {return l_.isSharedWith (x);}
+ bool isEmpty() const {return l_.isEmpty ();}
+ void clear();
+
+ const T &at(int i) const {return l_.at (i);}
+ const T &operator[](int i) const {return l_[i];}
+ //T &operator[](int i);
+ T &modify (int i);
+
+ void reserve(int size);
+ void append(const T &t);
+ void append(const QList<T> &t); // Implicit conversion.
+ void prepend(const T &t);
+ void insert(int i, const T &t);
+ void replace(int i, const T &t);
+ void removeAt(int i);
+ int removeAll(const T &t);
+ bool removeOne(const T &t);
+ T takeAt(int i);
+ T takeFirst();
+ T takeLast();
+ void move(int from, int to);
+ void swap(int i, int j);
+
+ int indexOf(const T &t, int from = 0) const {return l_.indexOf (t, from);}
+ int lastIndexOf(const T &t, int from = -1) const
+ {return l_.lastIndexOf (t, from);}
+ bool contains(const T &t) const {return l_.contains (t);}
+ int count(const T &t) const {return l_.count (t);}
+
+ typedef QOdbListIteratorImpl<QOdbList> iterator;
+ typedef typename base_list_type::const_iterator const_iterator;
+
+ // stl style
+ iterator begin() {return iterator (this, l_.begin ());}
+ const_iterator begin() const {return l_.begin ();}
+ const_iterator cbegin() const {return l_.cbegin ();}
+ const_iterator constBegin() const {return l_.constBegin ();}
+ iterator end() {return iterator (this, l_.end ());}
+ const_iterator end() const {return l_.end ();}
+ const_iterator cend() const {return l_.cend ();}
+ const_iterator constEnd() const {return l_.constEnd ();}
+
+ // Return QList iterators. The begin() functions mark all
+ // the elements as modified.
+ //
+ base_iterator_type mbegin ();
+ base_iterator_type modifyBegin () {return mbegin ();}
+ base_iterator_type mend () {return l_.end ();}
+ base_iterator_type modifyEnd () {return mend ();}
+
+ iterator insert(iterator before, const T &t);
+ iterator erase(iterator pos);
+ iterator erase(iterator first, iterator last);
+
+ // more Qt
+ typedef iterator Iterator;
+ typedef const_iterator ConstIterator;
+
+ int count() const {return l_.count ();}
+ int length() const {return l_.length ();}
+ //T& first();
+ T& modifyFirst();
+ const T& first() const {return l_.first ();}
+ //T& last();
+ T& modifyLast();
+ const T& last() const {return l_.last ();}
+ void removeFirst();
+ void removeLast();
+ bool startsWith(const T &t) const {return l_.startsWith (t);}
+ bool endsWith(const T &t) const {return l_.endsWith (t);}
+ QList<T> mid(int pos, int length = -1) const {return l_.mid (pos, length);}
+
+ T value(int i) const {return l_.value (i);}
+ T value(int i, const T &defValue) const {return l_.value (i, defValue);}
+
+ // stl compatibility
+ void push_back(const T &t) {append(t);}
+ void push_front(const T &t) {prepend(t);}
+ //T& front();
+ T& modify_front() {return modifyFirst ();}
+ const T& front() const {return l_.front ();}
+ //T& back();
+ T& modify_back() {return modifyLast ();}
+ const T& back() const {return l_.back ();}
+ void pop_front() {removeFirst();}
+ void pop_back() {removeLast();}
+ bool empty() const {return l_.empty ();}
+
+ typedef int size_type;
+ typedef T value_type;
+ typedef value_type *pointer;
+ typedef const value_type *const_pointer;
+ typedef value_type &reference;
+ typedef const value_type &const_reference;
+ typedef typename base_list_type::difference_type difference_type;
+
+ // comfort
+ // Implicit conversion.
+ QOdbList &operator+=(const QList<T> &l) {append (l); return *this;}
+ QOdbList operator+(const QList<T> &l) const
+ {QOdbList r (*this); r.append (l); return r;}
+ QOdbList &operator+=(const T &t) {append (t); return *this;}
+ QOdbList &operator<< (const T &t) {append (t); return *this;}
+ QOdbList &operator<<(const QList<T> &l) {append (l); return *this;}
+
+ QVector<T> toVector() const {return l_.toVector ();}
+ QSet<T> toSet() const {return l_.toSet ();}
+
+ static QOdbList fromVector(const QVector<T> &v)
+ {return base_list_type::fromVector (v);}
+ static QOdbList fromSet(const QSet<T> &s)
+ {return base_list_type::fromSet (s);}
+
+ static QOdbList fromStdList(const std::list<T> &l)
+ {return base_list_type::fromStdList (l);}
+ std::list<T> toStdList() const {return l_.toStdList ();}
+
+ // Interfacing with the base list.
+ //
+ QOdbList (const base_list_type& x): l_ (x) {}
+ QOdbList& operator= (const base_list_type&);
+ operator const base_list_type& () const {return l_;}
+ base_list_type& base () {return l_;}
+ const base_list_type& base () const {return l_;}
+
+#ifdef ODB_CXX11
+ QOdbList (base_list_type&& x): l_ (std::move (x)) {}
+ QOdbList& operator= (base_list_type&&);
+#endif
+
+ // Change tracking (the rest comes from vector_base).
+ //
+public:
+ void _start () const {impl_.start (l_.size ());}
+
+private:
+ base_list_type l_;
+};
+
+template <typename L>
+class QOdbListIteratorImpl
+{
+public:
+ typedef L list_type;
+ typedef typename list_type::base_iterator_type base_iterator_type;
+ typedef typename list_type::const_iterator const_iterator_type;
+
+ typedef typename base_iterator_type::iterator_category iterator_category;
+ typedef typename base_iterator_type::difference_type difference_type;
+ typedef typename base_iterator_type::value_type value_type;
+ typedef typename base_iterator_type::pointer pointer;
+ typedef typename base_iterator_type::reference reference;
+
+ typedef typename list_type::size_type size_type;
+ typedef typename list_type::const_reference const_reference;
+ typedef typename list_type::const_pointer const_pointer;
+
+ QOdbListIteratorImpl (): l_ (0), i_ () {}
+ QOdbListIteratorImpl (list_type* l, const base_iterator_type& i)
+ : l_ (l), i_ (i) {}
+
+#ifndef QT_STRICT_ITERATORS
+ operator const_iterator_type () const {return i_;}
+#endif
+ base_iterator_type base () const {return i_;}
+ list_type* list () const {return l_;}
+
+ // Note: const_{reference,pointer}.
+ //
+ const_reference operator* () const {return *i_;}
+ const_pointer operator-> () const {return i_.operator -> ();}
+ const_reference operator[] (difference_type n) const {return i_[n];}
+
+ // Modifiers.
+ //
+ reference modify () const;
+ reference modify (difference_type n) const;
+
+ QOdbListIteratorImpl& operator++ () {++i_; return *this;}
+ QOdbListIteratorImpl operator++ (int)
+ {return QOdbListIteratorImpl (l_, i_++);}
+ QOdbListIteratorImpl& operator-- () {--i_; return *this;}
+ QOdbListIteratorImpl operator-- (int)
+ {return QOdbListIteratorImpl (l_, i_--);}
+
+ QOdbListIteratorImpl operator+ (int n) const
+ {return QOdbListIteratorImpl (l_, i_ + n);}
+ QOdbListIteratorImpl& operator+= (int n) {i_ += n; return *this;}
+ QOdbListIteratorImpl operator- (int n) const
+ {return QOdbListIteratorImpl (l_, i_ - n);}
+ QOdbListIteratorImpl& operator-= (int n) {i_ -= n; return *this;}
+
+private:
+ list_type* l_;
+ base_iterator_type i_;
+};
+
+// operator==
+//
+template <typename L>
+inline bool
+operator== (const QOdbListIteratorImpl<L>& x, const QOdbListIteratorImpl<L>& y)
+{return x.base () == y.base ();}
+
+#ifndef QT_STRICT_ITERATORS
+template <typename L>
+inline bool
+operator== (const QOdbListIteratorImpl<L>& x,
+ const typename QOdbListIteratorImpl<L>::const_iterator_type& y)
+{return x.base () == y;}
+
+template <typename L>
+inline bool
+operator== (const typename QOdbListIteratorImpl<L>::const_iterator_type& x,
+ const QOdbListIteratorImpl<L>& y)
+{return x == y.base ();}
+#endif
+
+// operator<
+//
+template <typename L>
+inline bool
+operator< (const QOdbListIteratorImpl<L>& x, const QOdbListIteratorImpl<L>& y)
+{return x.base () < y.base ();}
+
+#ifndef QT_STRICT_ITERATORS
+template <typename L>
+inline bool
+operator< (const QOdbListIteratorImpl<L>& x,
+ const typename QOdbListIteratorImpl<L>::const_iterator_type& y)
+{return x.base () < y;}
+
+template <typename L>
+inline bool
+operator< (const typename QOdbListIteratorImpl<L>::const_iterator_type& x,
+ const QOdbListIteratorImpl<L>& y)
+{return x < y.base ();}
+#endif
+
+// operator!=
+//
+template <typename L>
+inline bool
+operator!= (const QOdbListIteratorImpl<L>& x, const QOdbListIteratorImpl<L>& y)
+{return x.base () != y.base ();}
+
+#ifndef QT_STRICT_ITERATORS
+template <typename L>
+inline bool
+operator!= (const QOdbListIteratorImpl<L>& x,
+ const typename QOdbListIteratorImpl<L>::const_iterator_type& y)
+{return x.base () != y;}
+
+template <typename L>
+inline bool
+operator!= (const typename QOdbListIteratorImpl<L>::const_iterator_type& x,
+ const QOdbListIteratorImpl<L>& y)
+{return x != y.base ();}
+#endif
+
+// operator>
+//
+template <typename L>
+inline bool
+operator> (const QOdbListIteratorImpl<L>& x, const QOdbListIteratorImpl<L>& y)
+{return x.base () > y.base ();}
+
+#ifndef QT_STRICT_ITERATORS
+template <typename L>
+inline bool
+operator> (const QOdbListIteratorImpl<L>& x,
+ const typename QOdbListIteratorImpl<L>::const_iterator_type& y)
+{return x.base () > y;}
+
+template <typename L>
+inline bool
+operator> (const typename QOdbListIteratorImpl<L>::const_iterator_type& x,
+ const QOdbListIteratorImpl<L>& y)
+{return x > y.base ();}
+#endif
+
+// operator>=
+//
+template <typename L>
+inline bool
+operator>= (const QOdbListIteratorImpl<L>& x, const QOdbListIteratorImpl<L>& y)
+{return x.base () >= y.base ();}
+
+#ifndef QT_STRICT_ITERATORS
+template <typename L>
+inline bool
+operator>= (const QOdbListIteratorImpl<L>& x,
+ const typename QOdbListIteratorImpl<L>::const_iterator_type& y)
+{return x.base () >= y;}
+
+template <typename L>
+inline bool
+operator>= (const typename QOdbListIteratorImpl<L>::const_iterator_type& x,
+ const QOdbListIteratorImpl<L>& y)
+{return x >= y.base ();}
+#endif
+
+// operator<=
+//
+template <typename L>
+inline bool
+operator<= (const QOdbListIteratorImpl<L>& x, const QOdbListIteratorImpl<L>& y)
+{return x.base () <= y.base ();}
+
+#ifndef QT_STRICT_ITERATORS
+template <typename L>
+inline bool
+operator<= (const QOdbListIteratorImpl<L>& x,
+ const typename QOdbListIteratorImpl<L>::const_iterator_type& y)
+{return x.base () <= y;}
+
+template <typename L>
+inline bool
+operator<= (const typename QOdbListIteratorImpl<L>::const_iterator_type& x,
+ const QOdbListIteratorImpl<L>& y)
+{return x <= y.base ();}
+#endif
+
+// operator-
+//
+template <typename L>
+inline typename QOdbListIteratorImpl<L>::difference_type
+operator-(const QOdbListIteratorImpl<L>& x, const QOdbListIteratorImpl<L>& y)
+{return x.base () - y.base ();}
+
+#ifndef QT_STRICT_ITERATORS
+template <typename L>
+inline typename QOdbListIteratorImpl<L>::difference_type
+operator-(const QOdbListIteratorImpl<L>& x,
+ const typename QOdbListIteratorImpl<L>::const_iterator_type& y)
+{return x.base () - y;}
+
+template <typename L>
+inline typename QOdbListIteratorImpl<L>::difference_type
+operator-(const typename QOdbListIteratorImpl<L>::const_iterator_type& x,
+ const QOdbListIteratorImpl<L>& y)
+{return x - y.base ();}
+#endif
+
+// operator+
+//
+template <typename L>
+inline QOdbListIteratorImpl<L>
+operator+(typename QOdbListIteratorImpl<L>::difference_type n,
+ const QOdbListIteratorImpl<L>& x)
+{return QOdbListIteratorImpl<L> (x.list (), n + x.base ());}
+
+#include <odb/qt/containers/list.ixx>
+
+#include <odb/qt/containers/list-traits.hxx>
+
+#include <odb/post.hxx>
+
+#endif // ODB_QT_CONTAINERS_LIST_HXX
diff --git a/libodb-qt/odb/qt/containers/list.ixx b/libodb-qt/odb/qt/containers/list.ixx
new file mode 100644
index 0000000..d9d37b6
--- /dev/null
+++ b/libodb-qt/odb/qt/containers/list.ixx
@@ -0,0 +1,318 @@
+// file : odb/qt/containers/list.ixx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+//
+// QOdbList
+//
+
+template <typename T>
+inline QOdbList<T>& QOdbList<T>::
+operator= (const QOdbList<T>& x)
+{
+ l_ = x.l_;
+ if (_tracking ())
+ impl_.assign (static_cast<std::size_t> (l_.size ()));
+ return *this;
+}
+
+template <typename T>
+inline QOdbList<T>& QOdbList<T>::
+operator= (const base_list_type& x)
+{
+ l_ = x;
+ if (_tracking ())
+ impl_.assign (static_cast<std::size_t> (l_.size ()));
+ return *this;
+}
+
+#ifdef ODB_CXX11
+template <typename T>
+inline QOdbList<T>& QOdbList<T>::
+operator= (QOdbList&& x)
+{
+ l_ = std::move (x.l_);
+ if (_tracking ())
+ impl_.assign (static_cast<std::size_t> (l_.size ()));
+ return *this;
+}
+
+template <typename T>
+inline QOdbList<T>& QOdbList<T>::
+operator= (base_list_type&& x)
+{
+ l_ = std::move (x);
+ if (_tracking ())
+ impl_.assign (static_cast<std::size_t> (l_.size ()));
+ return *this;
+}
+#endif
+
+#if QT_VERSION >= 0x040800
+template <typename T>
+inline void QOdbList<T>::
+swap (QOdbList<T>& x)
+{
+ l_.swap (x.l_);
+ vector_base::swap (x);
+}
+#endif
+
+template <typename T>
+inline void QOdbList<T>::
+clear()
+{
+ l_.clear ();
+ if (_tracking ())
+ impl_.clear ();
+}
+
+template <typename T>
+inline T& QOdbList<T>::
+modify (int i)
+{
+ T& r (l_[i]);
+ if (_tracking ())
+ impl_.modify (static_cast<std::size_t> (i));
+ return r;
+}
+
+template <typename T>
+inline void QOdbList<T>::
+reserve (int n)
+{
+ l_.reserve (n);
+ if (_tracking ())
+ impl_.reserve (static_cast<std::size_t> (n));
+}
+
+template <typename T>
+inline void QOdbList<T>::
+append (const T& x)
+{
+ l_.append (x);
+ if (_tracking ())
+ impl_.push_back ();
+}
+
+template <typename T>
+inline void QOdbList<T>::
+append (const QList<T>& x)
+{
+ l_.append (x);
+ if (_tracking ())
+ impl_.push_back (static_cast<std::size_t> (x.size ()));
+}
+
+template <typename T>
+inline void QOdbList<T>::
+prepend (const T& x)
+{
+ l_.prepend (x);
+ if (_tracking ())
+ impl_.insert (0);
+}
+
+template <typename T>
+inline void QOdbList<T>::
+insert (int i, const T& x)
+{
+ l_.insert (i, x);
+ if (_tracking ())
+ impl_.insert (static_cast<std::size_t> (i));
+}
+
+template <typename T>
+inline void QOdbList<T>::
+replace (int i, const T& x)
+{
+ l_.insert (i, x);
+ if (_tracking ())
+ impl_.modify (static_cast<std::size_t> (i));
+}
+
+template <typename T>
+inline void QOdbList<T>::
+removeAt (int i)
+{
+ l_.removeAt (i);
+ if (_tracking ())
+ impl_.erase (static_cast<std::size_t> (i));
+}
+
+template <typename T>
+inline int QOdbList<T>::
+removeAll (const T& x)
+{
+ // We have to re-implement this one ourselves since we need to
+ // know the indexes of the removed elements.
+ //
+ int r (0);
+ for (int i (l_.indexOf (x)); i != -1; i = l_.indexOf (x, i))
+ {
+ removeAt (i);
+ r++;
+ }
+ return r;
+}
+
+template <typename T>
+inline bool QOdbList<T>::
+removeOne (const T& x)
+{
+ // We have to re-implement this one ourselves since we need to
+ // know the index of the removed element.
+ //
+ int i (l_.indexOf (x));
+ if (i != -1)
+ removeAt (i);
+ return i != -1;
+}
+
+template <typename T>
+inline T QOdbList<T>::
+takeAt (int i)
+{
+ if (_tracking ())
+ impl_.erase (static_cast<std::size_t> (i));
+ return l_.takeAt (i);
+}
+
+template <typename T>
+inline T QOdbList<T>::
+takeFirst ()
+{
+ if (_tracking ())
+ impl_.erase (0);
+ return l_.takeFirst ();
+}
+
+template <typename T>
+inline T QOdbList<T>::
+takeLast ()
+{
+ if (_tracking ())
+ impl_.pop_back ();
+ return l_.takeLast ();
+}
+
+template <typename T>
+inline void QOdbList<T>::
+move (int from, int to)
+{
+ l_.move (from, to);
+ if (_tracking ())
+ {
+ impl_.erase (static_cast<std::size_t> (from));
+ impl_.insert (static_cast<std::size_t> (to));
+ }
+}
+
+template <typename T>
+inline void QOdbList<T>::
+swap (int i, int j)
+{
+ l_.swap (i, j);
+ if (_tracking ())
+ {
+ impl_.modify (static_cast<std::size_t> (i));
+ impl_.modify (static_cast<std::size_t> (j));
+ }
+}
+
+template <typename T>
+inline typename QOdbList<T>::base_iterator_type QOdbList<T>::
+mbegin ()
+{
+ if (_tracking ())
+ impl_.modify (0, static_cast<std::size_t> (l_.size ()));
+ return l_.begin ();
+}
+
+template <typename T>
+inline typename QOdbList<T>::iterator QOdbList<T>::
+insert (iterator p, const T& x)
+{
+ if (_tracking ())
+ impl_.insert (static_cast<std::size_t> (p.base () - l_.begin ()));
+ return iterator (this, l_.insert (p.base (), x));
+}
+
+template <typename T>
+inline typename QOdbList<T>::iterator QOdbList<T>::
+erase (iterator p)
+{
+ if (_tracking ())
+ impl_.erase (static_cast<std::size_t> (p.base () - l_.begin ()));
+ return iterator (this, l_.erase (p.base ()));
+}
+
+template <typename T>
+inline typename QOdbList<T>::iterator QOdbList<T>::
+erase (iterator f, iterator l)
+{
+ if (_tracking ())
+ impl_.erase (static_cast<std::size_t> (f.base () - l_.begin ()),
+ static_cast<std::size_t> (l - f));
+ return iterator (this, l_.erase (f.base (), l.base ()));
+}
+
+template <typename T>
+inline T& QOdbList<T>::
+modifyFirst ()
+{
+ T& r (l_.first ());
+ if (_tracking ())
+ impl_.modify (0);
+ return r;
+}
+
+template <typename T>
+inline T& QOdbList<T>::
+modifyLast ()
+{
+ T& r (l_.last ());
+ if (_tracking ())
+ impl_.modify (static_cast<std::size_t> (l_.size () - 1));
+ return r;
+}
+
+template <typename T>
+inline void QOdbList<T>::
+removeFirst ()
+{
+ l_.removeFirst ();
+ if (_tracking ())
+ impl_.erase (0);
+}
+
+template <typename T>
+inline void QOdbList<T>::
+removeLast ()
+{
+ l_.removeLast ();
+ if (_tracking ())
+ impl_.pop_back ();
+}
+
+//
+// QOdbListIteratorImpl
+//
+
+template <typename L>
+inline typename QOdbListIteratorImpl<L>::reference QOdbListIteratorImpl<L>::
+modify () const
+{
+ if (l_->_tracking ())
+ l_->_impl ().modify (static_cast<std::size_t> (i_ - l_->base ().begin ()));
+ return *i_;
+}
+
+template <typename L>
+inline typename QOdbListIteratorImpl<L>::reference QOdbListIteratorImpl<L>::
+modify (difference_type n) const
+{
+ if (l_->_tracking ())
+ l_->_impl ().modify (
+ static_cast<std::size_t> (i_ - l_->base ().begin () + n));
+ return i_[n];
+}
diff --git a/libodb-qt/odb/qt/containers/mutable-list-iterator.hxx b/libodb-qt/odb/qt/containers/mutable-list-iterator.hxx
new file mode 100644
index 0000000..271633a
--- /dev/null
+++ b/libodb-qt/odb/qt/containers/mutable-list-iterator.hxx
@@ -0,0 +1,110 @@
+// file : odb/qt/containers/mutable-list-iterator.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_QT_CONTAINERS_MUTABLE_LIST_ITERATOR_HXX
+#define ODB_QT_CONTAINERS_MUTABLE_LIST_ITERATOR_HXX
+
+#include <odb/pre.hxx>
+
+#include <QtCore/QMutableListIterator>
+
+#include <odb/qt/list.hxx>
+
+// Java-style QMutableListIterator-like iterator. The implementation
+// is based on what's found in qiterator.h.
+//
+template <typename T>
+class QMutableOdbListIterator
+{
+public:
+ QMutableOdbListIterator(QOdbList<T> &x)
+ : c (&x)
+ {
+ c->setSharable(false);
+ i = c->begin();
+ n = c->end();
+ }
+
+ ~QMutableOdbListIterator() {c->setSharable(true);}
+
+ QMutableOdbListIterator &operator=(QOdbList<T> &x)
+ {
+ c->setSharable(true);
+ c = &x;
+ c->setSharable(false);
+ i = c->begin();
+ n = c->end();
+ return *this;
+ }
+
+ void toFront() {i = c->begin(); n = c->end();}
+ void toBack() {i = c->end(); n = i;}
+ bool hasNext() const {return c->constEnd() != const_iterator(i.base ());}
+ bool hasPrevious() const
+ {
+ return c->constBegin() != const_iterator(i.base ());
+ }
+
+ bool findNext(const T &t)
+ {
+ while (c->constEnd() != const_iterator((n = i).base ()))
+ if (*i++ == t)
+ return true;
+ return false;
+ }
+
+ bool findPrevious(const T &t)
+ {
+ while (c->constBegin() != const_iterator(i.base ()))
+ if (*(n = --i) == t)
+ return true;
+
+ n = c->end();
+ return false;
+ }
+
+ T &next() {n = i++; return n.modify ();}
+ T &peekNext() const {return i.modify ();}
+ T &previous() {n = --i; return n.modify ();}
+ T &peekPrevious() const {iterator p (i); return (--p).modify ();}
+
+ void remove()
+ {
+ if (c->constEnd() != const_iterator(n.base ()))
+ {
+ i = c->erase (n);
+ n = c->end();
+ }
+ }
+
+ void setValue(const T &t) const
+ {
+ if (c->constEnd() != const_iterator(n.base ()))
+ n.modify () = t;
+ }
+
+ T &value()
+ {
+ Q_ASSERT(c->constEnd() != const_iterator(n.base ()));
+ return n.modify ();
+ }
+
+ const T &value() const
+ {
+ Q_ASSERT(c->constEnd() != const_iterator(n.base ()));
+ return *n;
+ }
+
+ void insert(const T &t) {n = i = c->insert(i, t); ++i;}
+
+private:
+ typedef typename QOdbList<T>::iterator iterator;
+ typedef typename QOdbList<T>::const_iterator const_iterator;
+
+ QOdbList<T>* c;
+ iterator i, n;
+};
+
+#include <odb/post.hxx>
+
+#endif // ODB_QT_CONTAINERS_MUTABLE_LIST_ITERATOR_HXX
diff --git a/libodb-qt/odb/qt/containers/qhash-traits.hxx b/libodb-qt/odb/qt/containers/qhash-traits.hxx
new file mode 100644
index 0000000..9f42d37
--- /dev/null
+++ b/libodb-qt/odb/qt/containers/qhash-traits.hxx
@@ -0,0 +1,129 @@
+// file : odb/qt/containers/qhash-traits.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_QT_CONTAINER_QHASH_TRAITS_HXX
+#define ODB_QT_CONTAINER_QHASH_TRAITS_HXX
+
+#include <odb/pre.hxx>
+
+#include <QtCore/QHash>
+#include <QtCore/QMultiHash>
+
+#include <odb/container-traits.hxx>
+
+namespace odb
+{
+ template <typename Key, typename T>
+ class access::container_traits<QHash<Key, T> >
+ {
+ public:
+ static const container_kind kind = ck_map;
+ static const bool smart = false;
+
+ typedef QHash<Key, T> container_type;
+ typedef Key key_type;
+ typedef T value_type;
+
+ typedef map_functions<key_type, value_type> functions;
+
+ public:
+ static void
+ persist (const container_type& c, const functions& f)
+ {
+ for (typename container_type::const_iterator i (c.begin ()),
+ e (c.end ()); i != e; ++i)
+ f.insert (i.key (), i.value ());
+ }
+
+ static void
+ load (container_type& c, bool more, const functions& f)
+ {
+ c.clear ();
+
+ while (more)
+ {
+ key_type k;
+ value_type v;
+ more = f.select (k, v);
+ c.insert (k, v); // @@ Use std::move in C++11.
+ }
+ }
+
+ static void
+ update (const container_type& c, const functions& f)
+ {
+ f.delete_ ();
+
+ for (typename container_type::const_iterator i (c.begin ()),
+ e (c.end ()); i != e; ++i)
+ f.insert (i.key (), i.value ());
+ }
+
+ static void
+ erase (const functions& f)
+ {
+ f.delete_ ();
+ }
+ };
+
+ // @@ QMultiHash guarantees elements to be stored in reverse order of
+ // insertion. The current implementation of the generated code does
+ // not guarantee this.
+ //
+ template <typename Key, typename T>
+ class access::container_traits<QMultiHash<Key, T> >
+ {
+ public:
+ static const container_kind kind = ck_multimap;
+ static const bool smart = false;
+
+ typedef QMultiHash<Key, T> container_type;
+ typedef Key key_type;
+ typedef T value_type;
+
+ typedef map_functions<key_type, value_type> functions;
+
+ public:
+ static void
+ persist (const container_type& c, const functions& f)
+ {
+ for (typename container_type::const_iterator i (c.begin ()),
+ e (c.end ()); i != e; ++i)
+ f.insert (i.key (), i.value ());
+ }
+
+ static void
+ load (container_type& c, bool more, const functions& f)
+ {
+ c.clear ();
+
+ while (more)
+ {
+ key_type k;
+ value_type v;
+ more = f.select (k, v);
+ c.insert (k, v); //@@ Use std::move in C++11.
+ }
+ }
+
+ static void
+ update (const container_type& c, const functions& f)
+ {
+ f.delete_ ();
+
+ for (typename container_type::const_iterator i (c.begin ()),
+ e (c.end ()); i != e; ++i)
+ f.insert (i.key (), i.value ());
+ }
+
+ static void
+ erase (const functions& f)
+ {
+ f.delete_ ();
+ }
+ };
+}
+
+#include <odb/post.hxx>
+
+#endif // ODB_QT_CONTAINER_QHASH_TRAITS_HXX
diff --git a/libodb-qt/odb/qt/containers/qlinked-list-traits.hxx b/libodb-qt/odb/qt/containers/qlinked-list-traits.hxx
new file mode 100644
index 0000000..3bfc9e9
--- /dev/null
+++ b/libodb-qt/odb/qt/containers/qlinked-list-traits.hxx
@@ -0,0 +1,82 @@
+// file : odb/qt/containers/qlinked-list-traits.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_QT_CONTAINER_QLINKED_LIST_TRAITS_HXX
+#define ODB_QT_CONTAINER_QLINKED_LIST_TRAITS_HXX
+
+#include <odb/pre.hxx>
+
+#include <QtCore/QtGlobal> // QT_VERSION
+
+// QLinkedList is deprecated since Qt5 5.15 and in Qt6 it has been moved to a
+// separate library.
+//
+#if (QT_VERSION < 0x050F00) || ODB_QT_FORCE_QLINKEDLIST
+
+#include <QtCore/QLinkedList>
+
+#include <odb/container-traits.hxx>
+
+namespace odb
+{
+ template <typename T>
+ class access::container_traits<QLinkedList<T> >
+ {
+ public:
+ static const container_kind kind = ck_ordered;
+ static const bool smart = false;
+
+ typedef QLinkedList<T> container_type;
+
+ typedef T value_type;
+ typedef typename container_type::size_type index_type;
+
+ typedef ordered_functions<index_type, value_type> functions;
+
+ public:
+ static void
+ persist (const container_type& c, const functions& f)
+ {
+ index_type i (0);
+ for (typename container_type::const_iterator j (c.begin ()),
+ e (c.end ()); j != e; ++j)
+ f.insert (i++, *j);
+ }
+
+ static void
+ load (container_type& c, bool more, const functions& f)
+ {
+ c.clear ();
+
+ while (more)
+ {
+ index_type dummy;
+ c.append (value_type ());
+ more = f.select (dummy, c.back ());
+ }
+ }
+
+ static void
+ update (const container_type& c, const functions& f)
+ {
+ f.delete_ ();
+
+ index_type i (0);
+ for (typename container_type::const_iterator j (c.begin ()),
+ e (c.end ()); j != e; ++j)
+ f.insert (i++, *j);
+ }
+
+ static void
+ erase (const functions& f)
+ {
+ f.delete_ ();
+ }
+ };
+}
+
+#endif
+
+#include <odb/post.hxx>
+
+#endif // ODB_QT_CONTAINER_QLINKED_LIST_TRAITS_HXX
diff --git a/libodb-qt/odb/qt/containers/qlist-traits.hxx b/libodb-qt/odb/qt/containers/qlist-traits.hxx
new file mode 100644
index 0000000..572d02a
--- /dev/null
+++ b/libodb-qt/odb/qt/containers/qlist-traits.hxx
@@ -0,0 +1,72 @@
+// file : odb/qt/containers/qlist-traits.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_QT_CONTAINER_QLIST_TRAITS_HXX
+#define ODB_QT_CONTAINER_QLIST_TRAITS_HXX
+
+#include <odb/pre.hxx>
+
+#include <QtCore/QList>
+
+#include <odb/container-traits.hxx>
+
+namespace odb
+{
+ template <typename T>
+ class access::container_traits<QList<T> >
+ {
+ public:
+ static const container_kind kind = ck_ordered;
+ static const bool smart = false;
+
+ typedef QList<T> container_type;
+
+ typedef T value_type;
+ typedef typename container_type::size_type index_type;
+
+ typedef ordered_functions<index_type, value_type> functions;
+
+ public:
+ static void
+ persist (const container_type& c, const functions& f)
+ {
+ // Index based access is just as fast as iterator based access for
+ // QList.
+ //
+ for (index_type i (0), n (c.size ()); i < n; ++i)
+ f.insert (i, c[i]);
+ }
+
+ static void
+ load (container_type& c, bool more, const functions& f)
+ {
+ c.clear ();
+
+ while (more)
+ {
+ index_type dummy;
+ c.append (value_type ());
+ more = f.select (dummy, c.back ());
+ }
+ }
+
+ static void
+ update (const container_type& c, const functions& f)
+ {
+ f.delete_ ();
+
+ for (index_type i (0), n (c.size ()); i < n; ++i)
+ f.insert (i, c[i]);
+ }
+
+ static void
+ erase (const functions& f)
+ {
+ f.delete_ ();
+ }
+ };
+}
+
+#include <odb/post.hxx>
+
+#endif // ODB_QT_CONTAINER_QLIST_TRAITS_HXX
diff --git a/libodb-qt/odb/qt/containers/qmap-traits.hxx b/libodb-qt/odb/qt/containers/qmap-traits.hxx
new file mode 100644
index 0000000..5f13b29
--- /dev/null
+++ b/libodb-qt/odb/qt/containers/qmap-traits.hxx
@@ -0,0 +1,130 @@
+// file : odb/qt/containers/qmap-traits.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_QT_CONTAINER_QMAP_TRAITS_HXX
+#define ODB_QT_CONTAINER_QMAP_TRAITS_HXX
+
+#include <odb/pre.hxx>
+
+#include <QtCore/QMap>
+#include <QtCore/QMultiMap>
+
+#include <odb/container-traits.hxx>
+
+namespace odb
+{
+ template <typename Key, typename T>
+ class access::container_traits<QMap<Key, T> >
+ {
+ public:
+ static const container_kind kind = ck_map;
+ static const bool smart = false;
+
+ typedef QMap<Key, T> container_type;
+
+ typedef Key key_type;
+ typedef T value_type;
+
+ typedef map_functions<key_type, value_type> functions;
+
+ public:
+ static void
+ persist (const container_type& c, const functions& f)
+ {
+ for (typename container_type::const_iterator i (c.begin ()),
+ e (c.end ()); i != e; ++i)
+ f.insert (i.key (), i.value ());
+ }
+
+ static void
+ load (container_type& c, bool more, const functions& f)
+ {
+ c.clear ();
+
+ while (more)
+ {
+ key_type k;
+ value_type v;
+ more = f.select (k, v);
+ c.insert (k, v); //@@ Use std::move in C++11.
+ }
+ }
+
+ static void
+ update (const container_type& c, const functions& f)
+ {
+ f.delete_ ();
+
+ for (typename container_type::const_iterator i (c.begin ()),
+ e (c.end ()); i != e; ++i)
+ f.insert (i.key (), i.value ());
+ }
+
+ static void
+ erase (const functions& f)
+ {
+ f.delete_ ();
+ }
+ };
+ // @@ QMultiMap guarantees elements to be stored in reverse order of
+ // insertion. The current implementation of the generated code does
+ // not guarantee this.
+ //
+ template <typename Key, typename T>
+ class access::container_traits<QMultiMap<Key, T> >
+ {
+ public:
+ static const container_kind kind = ck_multimap;
+ static const bool smart = false;
+
+ typedef QMultiMap<Key, T> container_type;
+
+ typedef Key key_type;
+ typedef T value_type;
+
+ typedef map_functions<key_type, value_type> functions;
+
+ public:
+ static void
+ persist (const container_type& c, const functions& f)
+ {
+ for (typename container_type::const_iterator i (c.begin ()),
+ e (c.end ()); i != e; ++i)
+ f.insert (i.key (), i.value ());
+ }
+
+ static void
+ load (container_type& c, bool more, const functions& f)
+ {
+ c.clear ();
+
+ while (more)
+ {
+ key_type k;
+ value_type v;
+ more = f.select (k, v);
+ c.insert (k, v); //@@ Use std::move in C++11.
+ }
+ }
+
+ static void
+ update (const container_type& c, const functions& f)
+ {
+ f.delete_ ();
+
+ for (typename container_type::const_iterator i (c.begin ()),
+ e (c.end ()); i != e; ++i)
+ f.insert (i.key (), i.value ());
+ }
+
+ static void
+ erase (const functions& f)
+ {
+ f.delete_ ();
+ }
+ };
+}
+
+#include <odb/post.hxx>
+
+#endif // ODB_QT_CONTAINER_QMAP_TRAITS_HXX
diff --git a/libodb-qt/odb/qt/containers/qset-traits.hxx b/libodb-qt/odb/qt/containers/qset-traits.hxx
new file mode 100644
index 0000000..fbea8b7
--- /dev/null
+++ b/libodb-qt/odb/qt/containers/qset-traits.hxx
@@ -0,0 +1,69 @@
+// file : odb/qt/containers/qset-traits.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_QT_CONTAINER_QSET_TRAITS_HXX
+#define ODB_QT_CONTAINER_QSET_TRAITS_HXX
+
+#include <odb/pre.hxx>
+
+#include <QtCore/QSet>
+
+#include <odb/container-traits.hxx>
+
+namespace odb
+{
+ template <typename T>
+ class access::container_traits<QSet<T> >
+ {
+ public:
+ static const container_kind kind = ck_set;
+ static const bool smart = false;
+
+ typedef QSet<T> container_type;
+ typedef T value_type;
+
+ typedef set_functions<value_type> functions;
+
+ public:
+ static void
+ persist (const container_type& c, const functions& f)
+ {
+ for (typename container_type::const_iterator i (c.begin ()),
+ e (c.end ()); i != e; ++i)
+ f.insert (*i);
+ }
+
+ static void
+ load (container_type& c, bool more, const functions& f)
+ {
+ c.clear ();
+
+ while (more)
+ {
+ value_type v;
+ more = f.select (v);
+ c.insert (v); //@@ Use std::move in C++11.
+ }
+ }
+
+ static void
+ update (const container_type& c, const functions& f)
+ {
+ f.delete_ ();
+
+ for (typename container_type::const_iterator i (c.begin ()),
+ e (c.end ()); i != e; ++i)
+ f.insert (*i);
+ }
+
+ static void
+ erase (const functions& f)
+ {
+ f.delete_ ();
+ }
+ };
+}
+
+#include <odb/post.hxx>
+
+#endif // ODB_QT_CONTAINER_QSET_TRAITS_HXX
diff --git a/libodb-qt/odb/qt/containers/qvector-traits.hxx b/libodb-qt/odb/qt/containers/qvector-traits.hxx
new file mode 100644
index 0000000..516475d
--- /dev/null
+++ b/libodb-qt/odb/qt/containers/qvector-traits.hxx
@@ -0,0 +1,82 @@
+// file : odb/qt/containers/qvector-traits.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_QT_CONTAINER_QVECTOR_TRAITS_HXX
+#define ODB_QT_CONTAINER_QVECTOR_TRAITS_HXX
+
+#include <odb/pre.hxx>
+
+#include <QtCore/QtGlobal> // QT_VERSION
+
+// In Qt 6 QVector is an alias for QList.
+//
+#if QT_VERSION >= 0x060000
+#include <odb/qt/containers/qlist-traits.hxx>
+#else
+
+#include <QtCore/QVector>
+
+#include <odb/container-traits.hxx>
+
+namespace odb
+{
+ template <typename T>
+ class access::container_traits<QVector<T> >
+ {
+ public:
+ static const container_kind kind = ck_ordered;
+ static const bool smart = false;
+
+ typedef QVector<T> container_type;
+
+ typedef T value_type;
+ typedef typename container_type::size_type index_type;
+
+ typedef ordered_functions<index_type, value_type> functions;
+
+ public:
+ static void
+ persist (const container_type& c, const functions& f)
+ {
+ // Index based access is just as fast as iterator based access for
+ // QVector.
+ //
+ for (index_type i (0), n (c.size ()); i < n; ++i)
+ f.insert (i, c[i]);
+ }
+
+ static void
+ load (container_type& c, bool more, const functions& f)
+ {
+ c.clear ();
+
+ while (more)
+ {
+ index_type dummy;
+ c.append (value_type ());
+ more = f.select (dummy, c.back ());
+ }
+ }
+
+ static void
+ update (const container_type& c, const functions& f)
+ {
+ f.delete_ ();
+
+ for (index_type i (0), n (c.size ()); i < n; ++i)
+ f.insert (i, c[i]);
+ }
+
+ static void
+ erase (const functions& f)
+ {
+ f.delete_ ();
+ }
+ };
+}
+
+#endif
+
+#include <odb/post.hxx>
+
+#endif // ODB_QT_CONTAINER_QVECTOR_TRAITS_HXX