summaryrefslogtreecommitdiff
path: root/common/inheritance/transient/test.hxx
blob: 02967ab012956b3a0c836ac8f0b979c7af397b48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// file      : common/inheritance/transient/test.hxx
// copyright : Copyright (c) 2009-2015 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