aboutsummaryrefslogtreecommitdiff
path: root/qt/common/containers/basics
diff options
context:
space:
mode:
Diffstat (limited to 'qt/common/containers/basics')
-rw-r--r--qt/common/containers/basics/driver.cxx570
-rw-r--r--qt/common/containers/basics/makefile126
-rw-r--r--qt/common/containers/basics/test.hxx225
-rw-r--r--qt/common/containers/basics/test.std0
4 files changed, 921 insertions, 0 deletions
diff --git a/qt/common/containers/basics/driver.cxx b/qt/common/containers/basics/driver.cxx
new file mode 100644
index 0000000..1d22962
--- /dev/null
+++ b/qt/common/containers/basics/driver.cxx
@@ -0,0 +1,570 @@
+// file : qt/common/containers/basics/driver.cxx
+// copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test basic Qt containers persistence.
+//
+
+#include <memory> // std::auto_ptr
+#include <cassert>
+#include <iostream>
+
+#include <QtCore/QCoreApplication>
+
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+
+#include <common/common.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb::core;
+
+int
+main (int argc, char* argv[])
+{
+ QCoreApplication app (argc, argv);
+
+ try
+ {
+ auto_ptr<database> db (create_database (argc, argv));
+
+ for (unsigned short i (0); i < 2; ++i)
+ {
+ object empty ("empty"), med ("medium"), full ("full");
+
+ //
+ // empty
+ //
+
+ empty.num = 0;
+ empty.str = "";
+
+ //
+ // med
+ //
+
+ med.num = 999;
+ med.str = "xxx";
+
+ // vector
+ //
+ med.nv.push_back (123);
+ med.nv.push_back (234);
+
+ med.sv.push_back ("aaa");
+ med.sv.push_back ("bbbb");
+
+ med.cv.push_back (comp (123, "aaa"));
+ med.cv.push_back (comp (234, "bbbb"));
+
+ med.uv.push_back (123);
+ med.uv.push_back (234);
+
+ // list
+ //
+ med.sl.push_back ("aaa");
+ med.sl.push_back ("bbbb");
+
+ med.nl.push_back (123);
+ med.nl.push_back (234);
+
+ med.cl.push_back (comp (123, "aaa"));
+ med.cl.push_back (comp (234, "bbbb"));
+
+ // linked list
+ //
+ med.sll.push_back ("aaa");
+ med.sll.push_back ("bbbb");
+
+ med.nll.push_back (123);
+ med.nll.push_back (234);
+
+ med.cll.push_back (comp (123, "aaa"));
+ med.cll.push_back (comp (234, "bbbb"));
+
+ // set
+ //
+ med.ns.insert (123);
+ med.ns.insert (234);
+
+ med.ss.insert ("aaa");
+ med.ss.insert ("bbbb");
+
+ // map
+ //
+ med.nsm[123] = "aaa";
+ med.nsm[234] = "bbbb";
+
+ med.snm["aaa"] = 123;
+ med.snm["bbbb"] = 234;
+
+ med.ncm[123] = comp (123, "aaa");
+ med.ncm[234] = comp (234, "bbbb");
+
+ med.csm[comp (123, "aaa")] = "aaa";
+ med.csm[comp (234, "bbbb")] = "bbbb";
+
+ // multimap
+ //
+ med.nsmm.insert (123, "aaa");
+ med.nsmm.insert (123, "bbbb");
+ med.nsmm.insert (234, "ccccc");
+
+ med.snmm.insert ("aaa", 123);
+ med.snmm.insert ("aaa", 234);
+ med.snmm.insert ("bbb", 345);
+
+ med.ncmm.insert (123, comp (123, "aaa"));
+ med.ncmm.insert (123, comp (234, "bbbb"));
+ med.ncmm.insert (234, comp (345, "ccccc"));
+
+ // hash
+ //
+ med.nsh[123] = "aaa";
+ med.nsh[234] = "bbbb";
+
+ med.snh["aaa"] = 123;
+ med.snh["bbb"] = 234;
+
+ med.sch["iii"] = comp (123, "aaa");
+ med.sch["jjj"] = comp (234, "bbbb");
+
+ // multihash
+ //
+ med.nsmh.insert (123, "aaa");
+ med.nsmh.insert (123, "bbbb");
+ med.nsmh.insert (234, "ccccc");
+
+ med.snmh.insert ("aaa", 123);
+ med.snmh.insert ("aaa", 234);
+ med.snmh.insert ("bbb", 345);
+
+ med.ncmh.insert (123, comp (123, "aaa"));
+ med.ncmh.insert (123, comp (234, "bbbb"));
+ med.ncmh.insert (234, comp (345, "ccccc"));
+
+ //
+ // full
+ //
+
+ full.num = 9999;
+ full.str = "xxxx";
+
+ // vector
+ //
+ full.nv.push_back (1234);
+ full.nv.push_back (2345);
+ full.nv.push_back (3456);
+
+ full.sv.push_back ("aaaa");
+ full.sv.push_back ("bbbbb");
+ full.sv.push_back ("cccccc");
+
+ full.cv.push_back (comp (1234, "aaaa"));
+ full.cv.push_back (comp (2345, "bbbbb"));
+ full.cv.push_back (comp (3456, "cccccc"));
+
+ full.uv.push_back (1234);
+ full.uv.push_back (2345);
+ full.uv.push_back (3456);
+
+ // list
+ //
+ full.sl.push_back ("aaaa");
+ full.sl.push_back ("bbbbb");
+ full.sl.push_back ("cccccc");
+
+ full.nl.push_back (1234);
+ full.nl.push_back (2345);
+ full.nl.push_back (3456);
+
+ full.cl.push_back (comp (1234, "aaaa"));
+ full.cl.push_back (comp (2345, "bbbbb"));
+ full.cl.push_back (comp (3456, "cccccc"));
+
+ // linked list
+ //
+ full.sll.push_back ("aaaa");
+ full.sll.push_back ("bbbbb");
+ full.sll.push_back ("cccccc");
+
+ full.nll.push_back (1234);
+ full.nll.push_back (2345);
+ full.nll.push_back (3456);
+
+ full.cll.push_back (comp (1234, "aaaa"));
+ full.cll.push_back (comp (2345, "bbbbb"));
+ full.cll.push_back (comp (3456, "cccccc"));
+
+ // set
+ //
+ full.ns.insert (1234);
+ full.ns.insert (2345);
+ full.ns.insert (3456);
+
+ full.ss.insert ("aaaa");
+ full.ss.insert ("bbbbb");
+ full.ss.insert ("cccccc");
+
+ // map
+ //
+ full.nsm[1234] = "aaaa";
+ full.nsm[2345] = "bbbbb";
+ full.nsm[3456] = "cccccc";
+
+ full.snm["aaaa"] = 1234;
+ full.snm["bbbb"] = 2345;
+ full.snm["cccc"] = 3456;
+
+ full.ncm[1234] = comp (1234, "aaaa");
+ full.ncm[2345] = comp (2345, "bbbbb");
+ full.ncm[3456] = comp (3456, "cccccc");
+
+ full.csm[comp (1234, "aaaa")] = "aaaa";
+ full.csm[comp (2345, "bbbb")] = "bbbbb";
+ full.csm[comp (3456, "cccc")] = "cccccc";
+
+ // multimap
+ //
+ full.nsmm.insert (1234, "aaaa");
+ full.nsmm.insert (1234, "bbbbb");
+ full.nsmm.insert (2345, "cccccc");
+ full.nsmm.insert (2345, "ddddddd");
+
+ full.snmm.insert ("aaaa", 1234);
+ full.snmm.insert ("aaaa", 2345);
+ full.snmm.insert ("bbbb", 3456);
+ full.snmm.insert ("bbbb", 4567);
+
+ full.ncmm.insert (1234, comp (1234, "aaaa"));
+ full.ncmm.insert (1234, comp (2345, "bbbbb"));
+ full.ncmm.insert (2345, comp (3456, "cccccc"));
+ full.ncmm.insert (2345, comp (4567, "ddddddd"));
+
+ // hash
+ //
+ full.nsh[1234] = "aaaa";
+ full.nsh[2345] = "bbbbb";
+ full.nsh[3456] = "cccccc";
+
+ full.snh["aaaa"] = 1234;
+ full.snh["bbbb"] = 2345;
+ full.snh["cccc"] = 3456;
+
+ full.sch["iiii"] = comp (1234, "aaaa");
+ full.sch["jjjj"] = comp (2345, "bbbbb");
+ full.sch["kkkk"] = comp (3456, "cccccc");
+
+ // multihash
+ //
+ full.nsmh.insert (1234, "aaaa");
+ full.nsmh.insert (1234, "bbbbb");
+ full.nsmh.insert (2345, "cccccc");
+ full.nsmh.insert (2345, "ddddddd");
+
+ full.snmh.insert ("aaaa", 1234);
+ full.snmh.insert ("aaaa", 2345);
+ full.snmh.insert ("bbbb", 3456);
+ full.snmh.insert ("bbbb", 4567);
+
+ full.ncmh.insert (1234, comp (1234, "aaaa"));
+ full.ncmh.insert (1234, comp (2345, "bbbbb"));
+ full.ncmh.insert (2345, comp (3456, "cccccc"));
+ full.ncmh.insert (2345, comp (4567, "ddddddd"));
+
+ // persist
+ //
+ {
+ transaction t (db->begin ());
+ db->persist (empty);
+ db->persist (med);
+ db->persist (full);
+ t.commit ();
+ }
+
+ // load & check
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> e (db->load<object> ("empty"));
+ auto_ptr<object> m (db->load<object> ("medium"));
+ auto_ptr<object> f (db->load<object> ("full"));
+ t.commit ();
+
+ assert (empty == *e);
+ assert (med == *m);
+ assert (full == *f);
+ }
+
+ //
+ // empty
+ //
+
+ empty.num = 99;
+ empty.str = "xx";
+
+ // vector
+ //
+ empty.nv.push_back (12);
+ empty.sv.push_back ("aa");
+ empty.cv.push_back (comp (12, "aa"));
+ empty.uv.push_back (12);
+
+ // list
+ //
+ empty.sl.push_back ("aa");
+ empty.nl.push_back (12);
+ empty.cl.push_back (comp (12, "aa"));
+
+ // linked list
+ //
+ empty.nll.push_back (12);
+ empty.sll.push_back ("aa");
+ empty.cll.push_back (comp (12, "aa"));
+
+ // set
+ //
+ empty.ns.insert (12);
+ empty.ss.insert ("aa");
+
+ // map
+ //
+ empty.nsm[12] = "aa";
+ empty.snm["aa"] = 12;
+ empty.ncm[12] = comp (12, "aa");
+ empty.csm[comp (12, "aa")] = "aa";
+
+ // multimap
+ //
+ empty.nsmm.insert (12, "aa");
+ empty.nsmm.insert (12, "bbb");
+ empty.nsmm.insert (23, "cccc");
+ empty.snmm.insert ("aa", 12);
+ empty.snmm.insert ("aa", 23);
+ empty.snmm.insert ("bb", 34);
+ empty.ncmm.insert (12, comp (12, "aa"));
+ empty.ncmm.insert (12, comp (23, "bb"));
+ empty.ncmm.insert (23, comp (34, "cc"));
+
+ // hash
+ //
+ empty.nsh[12] = "aa";
+ empty.snh["aa"] = 12;
+ empty.sch["ii"] = comp (12, "aa");
+
+ // multihash
+ //
+ empty.nsmh.insert (12, "aa");
+ empty.nsmh.insert (12, "bbb");
+ empty.nsmh.insert (23, "cccc");
+ empty.snmh.insert ("aa", 12);
+ empty.snmh.insert ("aa", 23);
+ empty.snmh.insert ("bb", 34);
+ empty.ncmh.insert (12, comp (12, "aa"));
+ empty.ncmh.insert (12, comp (23, "bb"));
+ empty.ncmh.insert (23, comp (34, "cc"));
+
+ //
+ // med
+ //
+
+ med.num = 0;
+ med.str = "";
+
+ // vector
+ //
+ med.nv.clear ();
+ med.sv.clear ();
+ med.cv.clear ();
+ med.uv.clear ();
+
+ // list
+ //
+ med.sl.clear ();
+ med.nl.clear ();
+ med.cl.clear ();
+
+ // linked list
+ //
+ med.nll.clear ();
+ med.sll.clear ();
+ med.cll.clear ();
+
+ // set
+ //
+ med.ns.clear ();
+ med.ss.clear ();
+
+ // map
+ //
+ med.nsm.clear ();
+ med.snm.clear ();
+ med.ncm.clear ();
+ med.csm.clear ();
+
+ // multimap
+ //
+ med.nsmm.clear ();
+ med.snmm.clear ();
+ med.ncmm.clear ();
+
+ // hash
+ //
+ med.nsh.clear ();
+ med.snh.clear ();
+ med.sch.clear ();
+
+ // multihash
+ //
+ med.nsmh.clear ();
+ med.snmh.clear ();
+ med.ncmh.clear ();
+
+
+ //
+ // full
+ //
+
+ full.num++;
+ full.str += "x";
+
+ // vector
+ //
+ full.nv.back ()++;
+ full.nv.push_back (4567);
+
+ full.sv.back () += "c";
+ full.sv.push_back ("ddddddd");
+
+ full.cv.back ().num++;
+ full.cv.back ().str += "c";
+ full.cv.push_back (comp (4567, "ddddddd"));
+
+ full.uv.back ()++;
+ full.uv.push_back (4567);
+
+ // list
+ //
+ full.sl.back () += "c";
+ full.sl.push_back ("ddddddd");
+
+ full.nl.back ()++;
+ full.nl.push_back (4567);
+
+ full.cl.back ().num++;
+ full.cl.back ().str += "c";
+ full.cl.push_back (comp (4567, "ddddddd"));
+
+ // linked list
+ //
+ full.sll.back () += "c";
+ full.sll.push_back ("ddddddd");
+
+ full.nll.back ()++;
+ full.nll.push_back (4567);
+
+ full.cll.back ().num++;
+ full.cll.back ().str += "c";
+ full.cll.push_back (comp (4567, "ddddddd"));
+
+ // set
+ //
+ full.ns.insert (4567);
+ full.ss.insert ("ddddddd");
+
+ // map
+ //
+ full.nsm[3456] += "c";
+ full.nsm[4567] = "ddddddd";
+
+ full.snm["cccc"]++;
+ full.snm["dddd"] = 4567;
+
+ full.ncm[3456].num++;
+ full.ncm[3456].str += "c";
+ full.ncm[4567] = comp (4567, "ddddddd");
+
+ full.csm[comp (3456, "cccc")] += "c";
+ full.csm[comp (4567, "dddd")] = "ddddddd";
+
+ // multimap
+ //
+ full.nsmm.find (2345).value () += "d";
+ full.nsmm.insert (3456, "eeeeeeee");
+
+ full.snmm.find ("bbbb").value ()++;
+ full.snmm.insert ("cccc", 5678);
+
+ full.ncmm.find (1234).value ().num++;
+ full.ncmm.find (2345).value ().str += "d";
+ full.ncmm.insert (3456, comp (5678, "eeeeeeee"));
+
+ // hash
+ //
+ full.nsh[3456] += "c";
+ full.nsh[4567] = "ddddddd";
+
+ full.snh["cccc"]++;
+ full.snh["dddd"] = 4567;
+
+ full.sch["iiii"].num++;
+ full.sch["jjjj"].str += "b";
+ full.sch["kkkk"] = comp (4567, "dddddddd");
+
+ // multihash
+ //
+ full.nsmh.find (2345).value () += "d";
+ full.nsmh.insert (3456, "eeeeeeee");
+
+ full.snmh.find ("bbbb").value ()++;
+ full.snmh.insert ("cccc", 5678);
+
+ full.ncmh.find (1234).value ().num++;
+ full.ncmh.find (2345).value ().str += "d";
+ full.ncmh.insert (3456, comp (5678, "eeeeeeee"));
+
+ // update
+ //
+ {
+ transaction t (db->begin ());
+ db->update (empty);
+ db->update (med);
+ db->update (full);
+ t.commit ();
+ }
+
+ // load & check
+ //
+ {
+ transaction t (db->begin ());
+ auto_ptr<object> e (db->load<object> ("empty"));
+ auto_ptr<object> m (db->load<object> ("medium"));
+ auto_ptr<object> f (db->load<object> ("full"));
+ t.commit ();
+
+ assert (empty == *e);
+ assert (med == *m);
+ assert (full == *f);
+ }
+
+ // erase
+ //
+ if (i == 0)
+ {
+ transaction t (db->begin ());
+ db->erase<object> ("empty");
+ db->erase<object> ("medium");
+ db->erase<object> ("full");
+ t.commit ();
+ }
+ }
+ }
+ catch (const odb::exception& e)
+ {
+ cerr << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/qt/common/containers/basics/makefile b/qt/common/containers/basics/makefile
new file mode 100644
index 0000000..2a88495
--- /dev/null
+++ b/qt/common/containers/basics/makefile
@@ -0,0 +1,126 @@
+# file : qt/common/containers/basics/makefile
+# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make
+
+cxx_tun := driver.cxx
+odb_hdr := test.hxx
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+cxx_od := $(cxx_obj:.o=.o.d)
+
+common.l := $(out_root)/libcommon/common/common.l
+common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
+
+driver := $(out_base)/driver
+dist := $(out_base)/.dist
+test := $(out_base)/.test
+clean := $(out_base)/.clean
+
+# Import.
+#
+$(call import,\
+ $(scf_root)/import/odb/stub.make,\
+ odb: odb,odb-rules: odb_rules)
+
+$(call import,\
+ $(scf_root)/import/libodb-qt/stub.make,\
+ l: odb_qt.l,cpp-options: odb_qt.l.cpp-options)
+
+$(call import,\
+ $(scf_root)/import/libqt/core/stub.make,\
+ l: qt_core.l,cpp-options: qt.l.cpp-options)
+
+# Build.
+#
+$(driver): $(cxx_obj) $(odb_qt.l) $(common.l) $(qt_core.l)
+$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
+$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_qt.l.cpp-options) \
+$(qt_core.l.cpp-options)
+
+genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
+gen := $(addprefix $(out_base)/,$(genf))
+
+$(gen): $(odb)
+$(gen): odb := $(odb)
+$(gen) $(dist): export odb_options += --database $(db_id) \
+--profile qt/containers --profile qt/basic --generate-schema \
+--table-prefix qt_cont_bs_
+$(gen): cpp_options := -I$(src_base)
+$(gen): $(common.l.cpp-options) $(odb_qt.l.cpp-options) \
+$(qt_core.l.cpp-options)
+
+$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
+
+# Alias for default target.
+#
+$(out_base)/: $(driver)
+
+# Dist
+#
+name := $(subst /,-,$(subst $(src_root)/qt/common/,,$(src_base)))
+
+$(dist): db_id := @database@
+$(dist): sources := $(cxx_tun)
+$(dist): headers := $(odb_hdr)
+$(dist): data_dist := test.std
+$(dist): export name := $(name)
+$(dist): export extra_dist := $(data_dist) $(call vc9projs,$(name)) \
+$(call vc10projs,$(name)) $(call vc11projs,$(name))
+$(dist):
+ $(call dist-data,$(sources) $(headers) $(data_dist))
+ $(call meta-automake,../../template/Makefile.am)
+ $(call meta-vc9projs,../../template/template,$(name))
+ $(call meta-vc10projs,../../template/template,$(name))
+ $(call meta-vc11projs,../../template/template,$(name))
+
+# Test.
+#
+$(test): $(driver) $(src_base)/test.std
+ $(call schema)
+ $(call message,test $<,$< --options-file $(dcf_root)/db.options \
+>$(out_base)/test.out)
+ $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
+ $(call message,,rm -f $(out_base)/test.out)
+
+# Clean.
+#
+$(clean): \
+ $(driver).o.clean \
+ $(addsuffix .cxx.clean,$(cxx_obj)) \
+ $(addsuffix .cxx.clean,$(cxx_od)) \
+ $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(call message,,rm -f $(out_base)/test.out)
+
+# Generated .gitignore.
+#
+ifeq ($(out_base),$(src_base))
+$(driver): | $(out_base)/.gitignore
+
+$(out_base)/.gitignore: files := driver $(genf)
+$(clean): $(out_base)/.gitignore.clean
+
+$(call include,$(bld_root)/git/gitignore.make)
+endif
+
+# How to.
+#
+$(call include,$(bld_root)/dist.make)
+$(call include,$(bld_root)/meta/vc9proj.make)
+$(call include,$(bld_root)/meta/vc10proj.make)
+$(call include,$(bld_root)/meta/vc11proj.make)
+$(call include,$(bld_root)/meta/automake.make)
+
+$(call include,$(bld_root)/cxx/standard.make) # cxx_standard
+ifdef cxx_standard
+$(gen): odb_options += --std $(cxx_standard)
+$(call include,$(odb_rules))
+endif
+
+$(call include,$(bld_root)/cxx/cxx-d.make)
+$(call include,$(bld_root)/cxx/cxx-o.make)
+$(call include,$(bld_root)/cxx/o-e.make)
+
+# Dependencies.
+#
+$(call import,$(src_root)/libcommon/makefile)
diff --git a/qt/common/containers/basics/test.hxx b/qt/common/containers/basics/test.hxx
new file mode 100644
index 0000000..204d0f9
--- /dev/null
+++ b/qt/common/containers/basics/test.hxx
@@ -0,0 +1,225 @@
+// file : qt/common/containers/basics/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 <QtCore/QString>
+#include <QtCore/QVector>
+#include <QtCore/QList>
+#include <QtCore/QLinkedList>
+#include <QtCore/QSet>
+#include <QtCore/QMap>
+#include <QtCore/QMultiMap>
+#include <QtCore/QHash>
+#include <QtCore/QMultiHash>
+
+#include <odb/core.hxx>
+
+#pragma db value
+struct comp
+{
+ comp () {}
+ comp (int n, const QString& s) : num (n), str (s) {}
+
+ #pragma db column("number")
+ int num;
+ QString str;
+};
+
+inline bool
+operator== (const comp& x, const comp& y)
+{
+ return x.num == y.num && x.str == y.str;
+}
+
+inline bool
+operator< (const comp& x, const comp& y)
+{
+ return x.num != y.num ? x.num < y.num : x.str < y.str;
+}
+
+typedef QVector<int> num_vector;
+typedef QVector<QString> str_vector;
+typedef QVector<comp> comp_vector;
+
+typedef QList<int> num_list;
+typedef QList<QString> str_list;
+typedef QList<comp> comp_list;
+
+typedef QLinkedList<int> num_linked_list;
+typedef QLinkedList<QString> str_linked_list;
+typedef QLinkedList<comp> comp_linked_list;
+
+typedef QSet<int> num_set;
+typedef QSet<QString> str_set;
+
+typedef QMap<int, QString> num_str_map;
+typedef QMap<QString, int> str_num_map;
+typedef QMap<int, comp> num_comp_map;
+typedef QMap<comp, QString> comp_str_map;
+
+typedef QMultiMap<int, QString> num_str_multimap;
+typedef QMultiMap<QString, int> str_num_multimap;
+typedef QMultiMap<int, comp> num_comp_multimap;
+
+typedef QHash<int, QString> num_str_hash;
+typedef QHash<QString, int> str_num_hash;
+typedef QHash<QString, comp> str_comp_hash;
+
+typedef QMultiHash<int, QString> num_str_multihash;
+typedef QMultiHash<QString, int> str_num_multihash;
+typedef QMultiHash<int, comp> num_comp_multihash;
+
+#pragma db value
+struct cont_comp1
+{
+ // This composite value does not have any columns.
+ //
+ num_vector sv; // Have the name "conflict" with the one in the object.
+};
+
+#pragma db value
+struct cont_comp2
+{
+ cont_comp2 (): num (777), str ("ggg") {}
+
+ int num;
+ str_list sl;
+ QString str;
+};
+
+#pragma db object
+struct object
+{
+ object (): nv (comp1_.sv), sl (comp2_.sl) {}
+ object (const QString& id) : id_ (id), nv (comp1_.sv), sl (comp2_.sl) {}
+
+ #pragma db id
+ QString id_;
+
+ int num;
+
+ cont_comp1 comp1_;
+ cont_comp2 comp2_;
+
+ // vector
+ //
+ #pragma db transient
+ num_vector& nv;
+
+ #pragma db table("object_strings") id_column ("obj_id")
+ str_vector sv;
+
+ #pragma db value_column("")
+ comp_vector cv;
+
+ #pragma db unordered
+ num_vector uv;
+
+ // list
+ //
+ #pragma db transient
+ str_list& sl;
+
+ num_list nl;
+ comp_list cl;
+
+ // linked list
+ //
+ str_linked_list sll;
+ num_linked_list nll;
+ comp_linked_list cll;
+
+ // set
+ //
+ num_set ns;
+ str_set ss;
+
+ // map
+ //
+ num_str_map nsm;
+ str_num_map snm;
+ num_comp_map ncm;
+ comp_str_map csm;
+
+ // multimap
+ //
+ num_str_multimap nsmm;
+ str_num_multimap snmm;
+ num_comp_multimap ncmm;
+
+ // hash
+ //
+ num_str_hash nsh;
+ str_num_hash snh;
+ str_comp_hash sch;
+
+ // multihash
+ //
+ num_str_multihash nsmh;
+ str_num_multihash snmh;
+ num_comp_multihash ncmh;
+
+ QString str;
+};
+
+inline bool
+operator== (const object& x, const object& y)
+{
+ if (x.uv.size () != y.uv.size ())
+ return false;
+
+ int xs (0), ys (0);
+
+ for (num_vector::size_type i (0); i < x.uv.size (); ++i)
+ {
+ xs += x.uv[i];
+ ys += y.uv[i];
+ }
+
+ return
+ x.id_ == y.id_ &&
+ x.num == y.num &&
+
+ x.comp2_.num == y.comp2_.num &&
+ x.comp2_.str == y.comp2_.str &&
+
+ x.nv == y.nv &&
+ x.sv == y.sv &&
+ x.cv == y.cv &&
+ xs == ys &&
+
+ x.sl == y.sl &&
+ x.nl == y.nl &&
+ x.cl == y.cl &&
+
+ x.nll == y.nll &&
+ x.sll == y.sll &&
+ x.cll == y.cll &&
+
+ x.ns == y.ns &&
+ x.ss == y.ss &&
+
+ x.nsm == y.nsm &&
+ x.snm == y.snm &&
+ x.ncm == y.ncm &&
+ x.csm == y.csm &&
+
+ x.nsmm.uniqueKeys () == y.nsmm.uniqueKeys () &&
+ x.snmm.uniqueKeys () == y.snmm.uniqueKeys () &&
+ x.ncmm.uniqueKeys () == y.ncmm.uniqueKeys () &&
+
+ x.nsh == y.nsh &&
+ x.snh == y.snh &&
+ x.sch == y.sch &&
+
+ x.nsmh.uniqueKeys () == y.nsmh.uniqueKeys () &&
+ x.snmh.uniqueKeys () == y.snmh.uniqueKeys () &&
+ x.ncmh.uniqueKeys () == y.ncmh.uniqueKeys () &&
+
+ x.str == y.str;
+}
+
+#endif // TEST_HXX
diff --git a/qt/common/containers/basics/test.std b/qt/common/containers/basics/test.std
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/qt/common/containers/basics/test.std