summaryrefslogtreecommitdiff
path: root/ddl/templates/data.hpp2.ede
blob: 7ae1b130dcd2549a925c1c5188355a4ca099ca06 (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
// 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" %}
namespace data { {% for c in t.value.constructors %}{% if !(c.value.fields | empty) %}
  class {{ c.value.name }} {
  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 %}
  };{% endif %}{% endfor %}
}
class {{ t.value.dataName }} {
public:
  enum class tag { {% for c in t.value.constructors %}
    {{ c.value.name }}{% if !c.last %},{% endif %}{% endfor %}
  } tag;
  {% for c in t.value.constructors %}
  {% if !(c.value.fields | empty) %}
  std::shared_ptr<data::{{ c.value.name }}> {{ c.value.name }};
  {% endif %}
  {% endfor %}
};
{% when "TypeAlias" %}
{% case t.value.aliasType.tag %}
{% when "Data" %}
typedef {{ t.value.aliasType.name_ }} {{ t.value.aliasName }};
{% else %}
typedef {{ t.value.aliasType | cppType }} {{ t.value.aliasName }};
{% endcase %}

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