mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2024-11-15 22:15:18 +00:00
41 lines
797 B
Handlebars
41 lines
797 B
Handlebars
{{className}}Class::{{className}}Class() {}
|
|
|
|
} // NS DTO
|
|
|
|
namespace Support {
|
|
|
|
using {{className}} = Jellyfin::DTO::{{className}};
|
|
|
|
template <>
|
|
|
|
{{className}} fromJsonValue(const QJsonValue &source, convertType<{{className}}>) {
|
|
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;
|
|
}
|
|
|
|
template <>
|
|
QJsonValue toJsonValue(const {{className}} &source, convertType<{{className}}>) {
|
|
switch(source) {
|
|
|
|
{{#each values as |value|}}
|
|
case {{className}}::{{value}}:
|
|
return QStringLiteral("{{value}}");
|
|
|
|
{{/each}}
|
|
|
|
case {{className}}::EnumNotSet: // Fallthrough
|
|
default:
|
|
return QJsonValue();
|
|
}
|
|
}
|