summaryrefslogtreecommitdiff
path: root/odb/semantics/relational/index.cxx
blob: 0e62f98b7a22da0bda26931bae5d9988190579ec (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
// file      : odb/semantics/relational/index.cxx
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
// license   : GNU GPL v3; see accompanying LICENSE file

#include <cutl/compiler/type-info.hxx>
#include <odb/semantics/relational.hxx>

namespace semantics
{
  namespace relational
  {
    index::
    index (xml::parser& p, uscope& s, graph& g)
        : key (p, s, g),
        type_ (p.attribute ("type", string ())),
        method_ (p.attribute ("method", string ())),
        options_ (p.attribute ("options", string ()))
    {
    }

    void index::
    serialize (xml::serializer& s) const
    {
      s.start_element (xmlns, "index");
      key::serialize_attributes (s);

      if (!type ().empty ())
        s.attribute ("type", type ());

      if (!method ().empty ())
        s.attribute ("method", method ());

      if (!options ().empty ())
        s.attribute ("options", options ());

      key::serialize_content (s);
      s.end_element ();
    }

    // type info
    //
    namespace
    {
      struct init
      {
        init ()
        {
          unameable::parser_map_["index"] = &unameable::parser_impl<index>;

          using compiler::type_info;

          {
            type_info ti (typeid (index));
            ti.add_base (typeid (qnameable));
            ti.add_base (typeid (key));
            insert (ti);
          }
        }
      } init_;
    }
  }
}