2021-03-19 22:01:29 +00:00
|
|
|
class {{className}}Class {
|
|
|
|
Q_GADGET
|
|
|
|
public:
|
|
|
|
enum Value {
|
|
|
|
EnumNotSet,
|
|
|
|
|
|
|
|
{{#each values as |value|}}
|
|
|
|
{{value}},
|
|
|
|
|
|
|
|
{{/each}}
|
|
|
|
};
|
|
|
|
Q_ENUM(Value)
|
|
|
|
private:
|
|
|
|
explicit {{className}}Class();
|
|
|
|
};
|
|
|
|
|
2021-03-20 02:30:50 +00:00
|
|
|
typedef {{className}}Class::Value {{className}};
|
|
|
|
|
|
|
|
} // NS DTO
|
|
|
|
|
|
|
|
namespace Support {
|
|
|
|
|
|
|
|
using {{className}} = Jellyfin::DTO::{{className}};
|
|
|
|
using {{className}}Class = Jellyfin::DTO::{{className}}Class;
|
2021-03-19 22:01:29 +00:00
|
|
|
|
|
|
|
template <>
|
|
|
|
|
2021-03-20 02:30:50 +00:00
|
|
|
{{className}} fromJsonValue<{{className}}>(const QJsonValue &source) {
|
2021-03-19 22:01:29 +00:00
|
|
|
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;
|
|
|
|
}
|