mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2025-09-05 10:12:46 +00:00
Make model code compileable
This disables some application level logic, but I'm going to rewrite that using Lager anyway.
This commit is contained in:
parent
0358418926
commit
b9b08ab384
551 changed files with 8943 additions and 8809 deletions
|
@ -15,27 +15,3 @@ private:
|
|||
};
|
||||
|
||||
typedef {{className}}Class::Value {{className}};
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
||||
using {{className}} = Jellyfin::DTO::{{className}};
|
||||
using {{className}}Class = Jellyfin::DTO::{{className}}Class;
|
||||
|
||||
template <>
|
||||
|
||||
{{className}} fromJsonValue<{{className}}>(const QJsonValue &source) {
|
||||
if (!source.isString()) return {{className}}Class::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
||||
{{#each values as |value|}}
|
||||
if (str == QStringLiteral("{{value}}")) {
|
||||
return {{className}}Class::{{value}};
|
||||
}
|
||||
|
||||
{{/each}}
|
||||
|
||||
return {{className}}Class::EnumNotSet;
|
||||
}
|
||||
|
|
25
core/codegen/enum_implementation.hbs
Normal file
25
core/codegen/enum_implementation.hbs
Normal file
|
@ -0,0 +1,25 @@
|
|||
{{className}}Class::{{className}}Class() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
||||
using {{className}} = Jellyfin::DTO::{{className}};
|
||||
|
||||
template <>
|
||||
|
||||
{{className}} fromJsonValue<{{className}}>(const QJsonValue &source) {
|
||||
if (!source.isString()) return {{className}}::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
||||
{{#each values as |value|}}
|
||||
if (str == QStringLiteral("{{value}}")) {
|
||||
return {{className}}::{{value}};
|
||||
}
|
||||
|
||||
{{/each}}
|
||||
|
||||
return {{className}}::EnumNotSet;
|
||||
}
|
|
@ -50,16 +50,3 @@ protected:
|
|||
|
||||
{{/each}}
|
||||
};
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
||||
using {{className}} = Jellyfin::DTO::{{className}};
|
||||
|
||||
template <>
|
||||
|
||||
{{className}} fromJsonValue<{{className}}>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
return {{className}}::fromJson(source.toObject());
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
{{className}}::{{className}}(QObject *parent) {}
|
||||
{{className}}::{{className}}() {}
|
||||
|
||||
|
||||
{{className}} {{className}}::fromJson(QJsonObject source) {
|
||||
|
||||
{{className}} instance;
|
||||
instance->setFromJson(source, false);
|
||||
instance.setFromJson(source);
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
@ -11,7 +12,7 @@
|
|||
void {{className}}::setFromJson(QJsonObject source) {
|
||||
|
||||
{{#each properties as |property|}}
|
||||
{{property.memberName}} = fromJsonValue<{{property.typeNameWithQualifiers}}>(source["{{property.originalName}}"]);
|
||||
{{property.memberName}} = {{supportNamespace}}::fromJsonValue<{{property.typeNameWithQualifiers}}>(source["{{property.originalName}}"]);
|
||||
|
||||
{{/each}}
|
||||
|
||||
|
@ -21,7 +22,7 @@ QJsonObject {{className}}::toJson() {
|
|||
QJsonObject result;
|
||||
|
||||
{{#each properties as |property|}}
|
||||
result["{{property.originalName}}"] = toJsonValue<{{property.typeNameWithQualifiers}}>({{property.memberName}});
|
||||
result["{{property.originalName}}"] = {{supportNamespace}}::toJsonValue<{{property.typeNameWithQualifiers}}>({{property.memberName}});
|
||||
|
||||
{{/each}}
|
||||
|
||||
|
@ -46,3 +47,16 @@ void {{className}}::setNull() {
|
|||
{{property.nullableSetter}};
|
||||
}
|
||||
{{/each}}
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
||||
using {{className}} = Jellyfin::DTO::{{className}};
|
||||
|
||||
template <>
|
||||
|
||||
{{className}} fromJsonValue<{{className}}>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
return {{className}}::fromJson(source.toObject());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue