refactor: cleanup ModLoaderType
This commit is contained in:
@ -15,7 +15,7 @@ class ModAPI {
|
||||
virtual ~ModAPI() = default;
|
||||
|
||||
// https://docs.curseforge.com/?http#tocS_ModLoaderType
|
||||
enum ModLoaderType { Any = 0, Forge = 1, Cauldron = 2, LiteLoader = 3, Fabric = 4, Quilt = 5 };
|
||||
enum ModLoaderType { Unspecified = 0, Forge = 1, Cauldron = 2, LiteLoader = 3, Fabric = 4, Quilt = 5 };
|
||||
|
||||
struct SearchArgs {
|
||||
int offset;
|
||||
@ -35,4 +35,22 @@ class ModAPI {
|
||||
};
|
||||
|
||||
virtual void getVersions(CallerType* caller, VersionSearchArgs&& args) const = 0;
|
||||
|
||||
static auto getModLoaderString(ModLoaderType type) -> const QString {
|
||||
switch (type) {
|
||||
case Unspecified:
|
||||
break;
|
||||
case Forge:
|
||||
return "forge";
|
||||
case Cauldron:
|
||||
return "cauldron";
|
||||
case LiteLoader:
|
||||
return "liteloader";
|
||||
case Fabric:
|
||||
return "fabric";
|
||||
case Quilt:
|
||||
return "quilt";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
};
|
||||
|
@ -51,25 +51,16 @@ class ModrinthAPI : public NetworkModAPI {
|
||||
return s;
|
||||
}
|
||||
|
||||
inline auto getModLoaderString(ModLoaderType modLoader) const -> QString
|
||||
static auto getModLoaderString(ModLoaderType type) -> const QString
|
||||
{
|
||||
switch (modLoader) {
|
||||
case Any:
|
||||
return "fabric, forge, quilt";
|
||||
case Forge:
|
||||
return "forge";
|
||||
case Fabric:
|
||||
return "fabric";
|
||||
case Quilt:
|
||||
return "quilt";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
if (type == Unspecified)
|
||||
return "fabric, forge, quilt";
|
||||
return ModAPI::getModLoaderString(type);
|
||||
}
|
||||
|
||||
inline auto validateModLoader(ModLoaderType modLoader) const -> bool
|
||||
{
|
||||
return modLoader == Any || modLoader == Forge || modLoader == Fabric || modLoader == Quilt;
|
||||
return modLoader == Unspecified || modLoader == Forge || modLoader == Fabric || modLoader == Quilt;
|
||||
}
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user