aboutsummaryrefslogtreecommitdiff
path: root/common/const-object/test.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-10-19 10:58:44 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-10-21 20:05:46 +0200
commite39f1cf9f0c3f520c61e0b832cca78df715d658d (patch)
treed803ed46acfbefbf1ec4d0d8d74f04afc2636c31 /common/const-object/test.hxx
parentbceb06251cdb572850b2e6e4d15cfb2ac32da417 (diff)
Rename common/const test to common/const-object
Diffstat (limited to 'common/const-object/test.hxx')
-rw-r--r--common/const-object/test.hxx52
1 files changed, 52 insertions, 0 deletions
diff --git a/common/const-object/test.hxx b/common/const-object/test.hxx
new file mode 100644
index 0000000..82635f0
--- /dev/null
+++ b/common/const-object/test.hxx
@@ -0,0 +1,52 @@
+// file : common/const-object/test.hxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <memory>
+#include <odb/core.hxx>
+
+#pragma db object pointer (obj1*)
+struct obj1
+{
+ obj1 () {}
+ obj1 (int i): id (i) {}
+
+ #pragma db id
+ int id;
+
+ void f () {}
+ void cf () const {}
+};
+
+#pragma db object pointer (std::auto_ptr<obj2>)
+struct obj2
+{
+ obj2 () {}
+ obj2 (int i): id (i) {}
+
+ #pragma db id
+ int id;
+
+ void f () {}
+ void cf () const {}
+};
+
+#pragma db object
+struct aggr
+{
+ aggr (int i): id (i), o1 (0) {}
+ aggr (): o1 (0) {}
+ ~aggr () {delete o1;}
+
+ #pragma db id
+ int id;
+
+ const obj1* o1;
+ std::auto_ptr<const obj2> o2;
+};
+
+#endif // TEST_HXX