2021-03-20 02:30:50 +00:00
|
|
|
{{className}}::{{className}}(QObject *parent) {}
|
2021-03-19 22:01:29 +00:00
|
|
|
|
|
|
|
|
2021-03-20 02:30:50 +00:00
|
|
|
{{className}} {{className}}::fromJson(QJsonObject source) {
|
|
|
|
{{className}} instance;
|
|
|
|
instance->setFromJson(source, false);
|
2021-03-19 22:01:29 +00:00
|
|
|
return instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-03-20 02:30:50 +00:00
|
|
|
void {{className}}::setFromJson(QJsonObject source) {
|
2021-03-19 22:01:29 +00:00
|
|
|
|
|
|
|
{{#each properties as |property|}}
|
|
|
|
{{property.memberName}} = fromJsonValue<{{property.typeNameWithQualifiers}}>(source["{{property.originalName}}"]);
|
|
|
|
|
|
|
|
{{/each}}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-03-20 02:30:50 +00:00
|
|
|
QJsonObject {{className}}::toJson() {
|
2021-03-19 22:01:29 +00:00
|
|
|
QJsonObject result;
|
|
|
|
|
|
|
|
{{#each properties as |property|}}
|
|
|
|
result["{{property.originalName}}"] = toJsonValue<{{property.typeNameWithQualifiers}}>({{property.memberName}});
|
|
|
|
|
|
|
|
{{/each}}
|
|
|
|
|
|
|
|
return result;
|
2021-03-20 02:30:50 +00:00
|
|
|
}
|
2021-03-19 22:01:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
{{#each properties as |property|}}
|
|
|
|
{{property.typeNameWithQualifiers}} {{className}}::{{property.name}}() const { return {{property.memberName}}; }
|
|
|
|
|
|
|
|
void {{className}}::set{{property.writeName}}({{property.typeNameWithQualifiers}} new{{property.writeName}}) {
|
|
|
|
|
|
|
|
{{property.memberName}} = new{{property.writeName}};
|
|
|
|
}
|
|
|
|
|
2021-03-20 02:30:50 +00:00
|
|
|
{{#if property.isNullable}}
|
|
|
|
bool {{className}}::is{{property.writeName}}Null() const {
|
|
|
|
return {{property.nullableCheck}};
|
|
|
|
}
|
2021-03-19 22:01:29 +00:00
|
|
|
|
2021-03-20 02:30:50 +00:00
|
|
|
void {{className}}::setNull() {
|
|
|
|
{{property.nullableSetter}};
|
|
|
|
}
|
2021-03-19 22:01:29 +00:00
|
|
|
{{/each}}
|