summaryrefslogtreecommitdiff
path: root/ddl/templates/data.hpp.ede
blob: dab478cf744941d0117fda20a6fcf94a37502e61 (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
// generated file, do not modify!
// {{ dateTime }}

#ifndef HEADER_{{ moduleName }}_H
#define HEADER_{{ moduleName }}_H

#include "RT.hpp"

{% for m in imports %}
#include "{{ m.value }}.hpp"
{% endfor %}

{% for t in dataAndType %}
{% case t.value | constType %}
{% when "DataDef" %}
class {{ t.value.dataName }} {
  public:
    enum class tag { {% for c in t.value.constructors %}
      {{ c.value.name }}{% if !c.last %},{% endif %}{% endfor %}
    } tag;
};
namespace data { {% for c in t.value.constructors %}{% if !(c.value.fields | empty) %}
  class {{ c.value.name }} : public ::{{ t.value.dataName }} {
    public:{% for f in c.value.fields %}{% if c.value.fields | hasFieldNames %}
      {{ f.value.fieldType | cppType }} {{ f.value.fieldName }};{% else %}
      {{ f.value.fieldType | cppType | parens }} _{{ f.index0 }};{% endif %}{% endfor %}
      {{ c.value.name }}() { tag = tag::{{ c.value.name }}; }
  };{% endif %}{% endfor %}
}
{% when "TypeAlias" %}
{% case t.value.aliasType.tag %}
{% when "Data" %}
typedef {{ t.value.aliasType.contents }} {{ t.value.aliasName }};
{% else %}
typedef {{ t.value.aliasType | cppType }} {{ t.value.aliasName }};
{% endcase %}

{% endcase %}
{% endfor %}
#endif