aboutsummaryrefslogtreecommitdiff
path: root/gtad/data.h.mustache
blob: 32ea85ee26670d14c897d4e76d630de6d2c25c5e (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
{{>preamble}}
#pragma once

#include "converters.h"
{{#imports}}
#include {{_}}{{/imports}}

namespace Quotient {
{{#models}}
    {{#model}}
{{>docCommentShort}}
struct {{name}}{{#parents?}} : {{#parents}}{{name}}{{>cjoin}}{{/parents}}{{/parents?}}
{       {{#vars}}

    {{>docCommentShort}}
    {{>maybeOmittableType}} {{nameCamelCase}};
        {{/vars}}{{#propertyMap}}

    {{>docCommentShort}}
    {{>maybeOmittableType}} {{nameCamelCase}};
        {{/propertyMap}}
};

template <> struct JsonObjectConverter<{{name}}>
{
        {{#in?}}
    static void dumpTo(QJsonObject& jo, const {{name}}& pod)
    {       {{#propertyMap}}
        fillJson(jo, pod.{{nameCamelCase}});
            {{/propertyMap}}{{#parents}}
        fillJson<{{name}}>(jo, pod);
            {{/parents}}{{#vars}}
        addParam<{{^required?}}IfNotEmpty{{/required?}}>(jo,
                QStringLiteral("{{baseName}}"), pod.{{nameCamelCase}});
            {{/vars}}
        }
        {{/in?}}
        {{#out?}}
    static void fillFrom({{>maybeCrefJsonObject}} jo, {{name}}& pod)
    {       {{#parents}}
        fillFromJson<{{qualifiedName}}>(jo, pod);
            {{/parents}}{{#vars}}
        fromJson(jo.{{>takeOrValue}}("{{baseName}}"_ls), pod.{{nameCamelCase}});
            {{/vars}}{{#propertyMap}}
        fromJson(jo, pod.{{nameCamelCase}});
            {{/propertyMap}}
    }
        {{/out?}}
};

    {{/model}}
{{/models}}
} // namespace Quotient