diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-11-22 12:16:22 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-11-22 12:16:22 +0200 |
commit | ececaecd27d0a9f3d52a5886f68bc8eac4fc5227 (patch) | |
tree | 42c7110259174d6133fe9112c2ff20bd4df63c85 /common/const/test.hxx | |
parent | 7175c721318723fdcbdda97045c0defa51571f17 (diff) |
Test const object operations
Diffstat (limited to 'common/const/test.hxx')
-rw-r--r-- | common/const/test.hxx | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/common/const/test.hxx b/common/const/test.hxx new file mode 100644 index 0000000..7e8a718 --- /dev/null +++ b/common/const/test.hxx @@ -0,0 +1,61 @@ +// file : common/const/test.hxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef TEST_HXX +#define TEST_HXX + +#include <memory> +#include <odb/core.hxx> + +struct obj1; +struct obj2; + +typedef obj1* obj1_ptr; +typedef const obj1* obj1_cptr; + +typedef std::auto_ptr<obj2> obj2_ptr; +typedef std::auto_ptr<const obj2> obj2_cptr; + +#pragma db object pointer (obj1_ptr) +struct obj1 +{ + obj1 () {} + obj1 (int i): id (i) {} + + #pragma db id + int id; + + void f () {} + void cf () const {} +}; + +#pragma db object pointer (obj2_ptr) +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; + + obj1_cptr o1; + obj2_cptr o2; +}; + +#endif // TEST_HXX |