settings: Give indices to enums

This commit is contained in:
lat9nq
2023-06-21 21:41:06 -04:00
parent ecc1feff64
commit e7f01128f1
3 changed files with 36 additions and 6 deletions

View File

@ -3,6 +3,7 @@
#pragma once
#include <limits>
#include <map>
#include <optional>
#include <stdexcept>
@ -197,6 +198,14 @@ public:
return std::type_index(typeid(Type));
}
constexpr u32 EnumIndex() const override {
if constexpr (std::is_enum<Type>()) {
return EnumMetadata<Type>::Index();
} else {
return std::numeric_limits<u32>::max();
}
}
virtual std::string MinVal() const override {
return this->ToString(minimum);
}