summaryrefslogtreecommitdiff
path: root/odb-tests/common/object/test.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'odb-tests/common/object/test.hxx')
-rw-r--r--odb-tests/common/object/test.hxx49
1 files changed, 49 insertions, 0 deletions
diff --git a/odb-tests/common/object/test.hxx b/odb-tests/common/object/test.hxx
new file mode 100644
index 0000000..87bac91
--- /dev/null
+++ b/odb-tests/common/object/test.hxx
@@ -0,0 +1,49 @@
+// file : common/object/test.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <string>
+#include <utility> // std::pair
+
+#include <odb/core.hxx>
+
+// Test persistent class template instantiation.
+//
+#pragma db namespace table("t1_")
+namespace test1
+{
+ typedef std::pair<unsigned long, std::string> pair_object;
+ #pragma db object(pair_object)
+ #pragma db member(pair_object::first) id auto
+
+ #pragma db object abstract
+ struct base_data
+ {
+ #pragma db id auto
+ unsigned long id;
+ };
+
+ template <typename T>
+ struct base: base_data
+ {
+ T x;
+ };
+
+ typedef base<std::string> base_derived;
+ #pragma db object(base_derived) abstract
+
+ #pragma db object
+ struct derived: base_derived
+ {
+ int n;
+ };
+
+ // Test instantiation in order to "see" id, etc.
+ //
+ typedef base<int> int_base;
+ #pragma db object(int_base)
+}
+
+#endif // TEST_HXX