diff options
Diffstat (limited to 'templates/data.hpp.ede')
-rw-r--r-- | templates/data.hpp.ede | 51 |
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 | |||
13 | typedef int Int; | ||
14 | typedef int Int32; | ||
15 | typedef unsigned int Word; | ||
16 | typedef unsigned int Word32; | ||
17 | typedef float Float; | ||
18 | typedef bool Bool; | ||
19 | typedef std::string String; | ||
20 | |||
21 | using json = nlohmann::json; | ||
22 | |||
23 | template<typename T> | ||
24 | json 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" %} | ||
33 | class {{ 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 | }; | ||
39 | namespace 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" %} | ||
47 | typedef {{ t.value.aliasType | cppType }} {{ t.value.aliasName }}; | ||
48 | |||
49 | {% endcase %} | ||
50 | {% endfor %} | ||
51 | #endif | ||