format and apply the sugestion

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2023-08-12 12:54:10 +03:00
parent b3b2e9df35
commit 71890707c0
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318

View File

@ -24,14 +24,11 @@
namespace ModPlatform { namespace ModPlatform {
static const QMap<QString, IndexedVersionType::Enum> s_indexed_version_type_names = { static const QMap<QString, IndexedVersionType::Enum> s_indexed_version_type_names = { { "release", IndexedVersionType::Enum::Release },
{"release", IndexedVersionType::Enum::Release},
{ "beta", IndexedVersionType::Enum::Beta }, { "beta", IndexedVersionType::Enum::Beta },
{"alpha", IndexedVersionType::Enum::Alpha} { "alpha", IndexedVersionType::Enum::Alpha } };
};
IndexedVersionType::IndexedVersionType(const QString& type): IndexedVersionType(enumFromString(type)) IndexedVersionType::IndexedVersionType(const QString& type) : IndexedVersionType(enumFromString(type)) {}
{}
IndexedVersionType::IndexedVersionType(int type) IndexedVersionType::IndexedVersionType(int type)
{ {
@ -78,18 +75,12 @@ const QString IndexedVersionType::toString (const IndexedVersionType::Enum& type
case IndexedVersionType::Enum::UNKNOWN: case IndexedVersionType::Enum::UNKNOWN:
default: default:
return "unknown"; return "unknown";
} }
} }
IndexedVersionType::Enum IndexedVersionType::enumFromString(const QString& type) IndexedVersionType::Enum IndexedVersionType::enumFromString(const QString& type)
{ {
auto found = s_indexed_version_type_names.constFind(type); return s_indexed_version_type_names.value(type, IndexedVersionType::Enum::UNKNOWN);
if (found != s_indexed_version_type_names.constEnd()) {
return *found;
} else {
return IndexedVersionType::Enum::UNKNOWN;
}
} }
auto ProviderCapabilities::name(ResourceProvider p) -> const char* auto ProviderCapabilities::name(ResourceProvider p) -> const char*