summaryrefslogtreecommitdiff
path: root/libcult/cult/rtti/type-info.ixx
blob: f96ad6cc3ebdc7b454a5ae86a6e5a39a9a08d3c3 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// file      : cult/rtti/type-info.ixx
// author    : Boris Kolpackov <boris@kolpackov.net>
// copyright : Copyright (c) 2005-2010 Boris Kolpackov
// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file

namespace Cult
{
  namespace RTTI
  {
    // BaseInfo
    //

    inline
    BaseInfo::
    BaseInfo (Access access, Boolean virtual_, TypeId const& type_id)
        : access_ (access),
          virtual__ (virtual_),
          type_id_ (type_id),
          type_info_ (0)
    {
    }

    inline
    TypeInfo const& BaseInfo::
    type_info () const
    {
      if (type_info_ == 0) type_info_ = &(lookup (type_id_));

      return *type_info_;
    }


    inline
    Access BaseInfo::
    access () const
    {
      return access_;
    }

    inline
    Boolean BaseInfo::
    virtual_ () const
    {
      return virtual__;
    }


    // TypeInfo
    //

    inline
    TypeInfo::
    TypeInfo (TypeId const& type_id)
        : type_id_ (type_id)
    {
    }

    inline
    TypeId TypeInfo::
    type_id () const
    {
      return type_id_;
    }

    inline
    TypeInfo::BaseIterator TypeInfo::
    begin_base () const
    {
      return base_list_.begin ();
    }


    inline
    TypeInfo::BaseIterator TypeInfo::
    end_base () const
    {
      return base_list_.end ();
    }

    inline
    Void TypeInfo::
    add_base (Access access, Boolean virtual_, TypeId const& type_id)
    {
      base_list_.push_back (BaseInfo (access, virtual_, type_id));
    }
  }
}