summaryrefslogtreecommitdiff
path: root/templates/data.hpp.ede
diff options
context:
space:
mode:
Diffstat (limited to 'templates/data.hpp.ede')
-rw-r--r--templates/data.hpp.ede51
1 files changed, 51 insertions, 0 deletions
diff --git a/templates/data.hpp.ede b/templates/data.hpp.ede
new file mode 100644
index 0000000..10e1ff4
--- /dev/null
+++ b/templates/data.hpp.ede
@@ -0,0 +1,51 @@
1// generated file, do not modify!
2// {{ dateTime }}
3
4#ifndef HEADER_{{ moduleName }}_H
5#define HEADER_{{ moduleName }}_H
6
7#include <vector>
8#include <map>
9#include <string>
10
11#include "json.hpp"
12
13typedef int Int;
14typedef int Int32;
15typedef unsigned int Word;
16typedef unsigned int Word32;
17typedef float Float;
18typedef bool Bool;
19typedef std::string String;
20
21using json = nlohmann::json;
22
23template<typename T>
24json toJSON(T &v);
25
26{% for m in imports %}
27#include "{{ m.value }}.hpp"
28{% endfor %}
29
30{% for t in dataAndType %}
31{% case t.value | constType %}
32{% when "DataDef" %}
33class {{ t.value.dataName }} {
34 public:
35 enum class tag { {% for c in t.value.constructors %}
36 {{ c.value.name }}{% if !c.last %},{% endif %}{% endfor %}
37 } tag;
38};
39namespace data { {% for c in t.value.constructors %}{% if !(c.value.fields | empty) %}
40 class {{ c.value.name }} : public ::{{ t.value.dataName }} {
41 public:{% for f in c.value.fields %}{% if c.value.fields | hasFieldNames %}
42 {{ f.value.fieldType | cppType }} {{ f.value.fieldName }};{% else %}
43 {{ f.value.fieldType | cppType | parens }} _{{ f.index0 }};{% endif %}{% endfor %}
44 };{% endif %}{% endfor %}
45}
46{% when "TypeAlias" %}
47typedef {{ t.value.aliasType | cppType }} {{ t.value.aliasName }};
48
49{% endcase %}
50{% endfor %}
51#endif