mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2024-11-05 09:35:18 +00:00
49 lines
1.2 KiB
Handlebars
49 lines
1.2 KiB
Handlebars
{{className}}::{{className}}(QObject *parent) {}
|
|
|
|
|
|
{{className}} {{className}}::fromJson(QJsonObject source) {
|
|
{{className}} instance;
|
|
instance->setFromJson(source, false);
|
|
return instance;
|
|
}
|
|
|
|
|
|
void {{className}}::setFromJson(QJsonObject source) {
|
|
|
|
{{#each properties as |property|}}
|
|
{{property.memberName}} = fromJsonValue<{{property.typeNameWithQualifiers}}>(source["{{property.originalName}}"]);
|
|
|
|
{{/each}}
|
|
|
|
}
|
|
|
|
QJsonObject {{className}}::toJson() {
|
|
QJsonObject result;
|
|
|
|
{{#each properties as |property|}}
|
|
result["{{property.originalName}}"] = toJsonValue<{{property.typeNameWithQualifiers}}>({{property.memberName}});
|
|
|
|
{{/each}}
|
|
|
|
return result;
|
|
}
|
|
|
|
|
|
{{#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}};
|
|
}
|
|
|
|
{{#if property.isNullable}}
|
|
bool {{className}}::is{{property.writeName}}Null() const {
|
|
return {{property.nullableCheck}};
|
|
}
|
|
|
|
void {{className}}::setNull() {
|
|
{{property.nullableSetter}};
|
|
}
|
|
{{/each}}
|