1
0
Fork 0
mirror of https://github.com/HenkKalkwater/harbour-sailfin.git synced 2024-11-05 09:35:18 +00:00
harbour-sailfin/core/codegen/object_header.hbs

77 lines
1.4 KiB
Handlebars
Raw Normal View History

{{#each userImports as |userClass|}}
{{#if userClass != className}}
class {{className}};
{{/if}}
{{/each}}
class {{className}} {
public:
2021-03-24 19:04:03 +00:00
{{className}}();
{{className}}(const {{className}} &other);
/**
* Replaces the data being hold by this class with that of the other.
*/
void replaceData({{className}} &other);
static {{className}} fromJson(QJsonObject source);
void setFromJson(QJsonObject source);
QJsonObject toJson() const;
// Properties
{{#each properties as |p|}}
{{#if p.description.length > 0}}
/**
* @brief {{p.description}}
*/
{{/if}}
{{p.typeNameWithQualifiers}} {{p.name}}() const;
{{#if p.description.length > 0}}
/**
* @brief {{p.description}}
*/
{{/if}}
void set{{p.writeName}}({{p.typeNameWithQualifiers}} new{{p.writeName}});
{{#if p.isNullable}}
2021-03-24 19:04:03 +00:00
bool {{p.name}}Null() const;
void set{{p.writeName}}Null();
2021-03-24 19:04:03 +00:00
{{/if}}
2021-03-24 19:04:03 +00:00
{{/each}}
protected:
{{#each properties as |p|}}
{{#if p.defaultInitializer.length > 0}}
{{p.typeNameWithQualifiers}} {{p.memberName}} = {{p.defaultInitializer}};
{{else}}
{{p.typeNameWithQualifiers}} {{p.memberName}};
{{/if}}
{{/each}}
};
} // NS DTO
namespace Support {
using {{className}} = Jellyfin::DTO::{{className}};
template <>
{{className}} fromJsonValue(const QJsonValue &source, convertType<{{className}}>);
template<>
QJsonValue toJsonValue(const {{className}} &source, convertType<{{className}}>);