diff options
Diffstat (limited to 'common/inheritance/transient/test.hxx')
-rw-r--r-- | common/inheritance/transient/test.hxx | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/common/inheritance/transient/test.hxx b/common/inheritance/transient/test.hxx new file mode 100644 index 0000000..df5d0c1 --- /dev/null +++ b/common/inheritance/transient/test.hxx @@ -0,0 +1,61 @@ +// file : common/inheritance/transient/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 <string> +#include <vector> + +#include <odb/core.hxx> + +struct object; + +struct base +{ + int n; + std::vector<std::string> v; + object* p; +}; + +#pragma db value +struct comp: base +{ + unsigned int num; + std::string str; + std::vector<unsigned int> nums; + + bool + operator== (const comp& y) const + { + return num == y.num && str == y.str && nums == y.nums; + } +}; + +#pragma db object +struct object: base +{ + #pragma db id auto + unsigned int id_; + + unsigned int num; + std::string str; + std::vector<std::string> strs; + comp c; + + bool + operator== (const object& y) const + { + return num == y.num && str == y.str && strs == y.strs && c == y.c; + } +}; + +#pragma db view object(object) +struct view: base +{ + unsigned int num; + std::string str; +}; + +#endif // TEST_HXX |