mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2024-11-05 09:35:18 +00:00
42 lines
748 B
Handlebars
42 lines
748 B
Handlebars
class {{className}}Class {
|
|
Q_GADGET
|
|
public:
|
|
enum Value {
|
|
EnumNotSet,
|
|
|
|
{{#each values as |value|}}
|
|
{{value}},
|
|
|
|
{{/each}}
|
|
};
|
|
Q_ENUM(Value)
|
|
private:
|
|
explicit {{className}}Class();
|
|
};
|
|
|
|
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;
|
|
}
|