diff options
| author | 2023-06-21 21:41:06 -0400 | |
|---|---|---|
| committer | 2023-07-21 10:56:55 -0400 | |
| commit | e7f01128f181a7b754f6d5f94122cde059c7ed1a (patch) | |
| tree | f41e233577fbb839e39f91a86d3f5177aa0fa861 /src/common/settings_setting.h | |
| parent | cmake: Use standard preprocessor on MSVC (diff) | |
| download | yuzu-e7f01128f181a7b754f6d5f94122cde059c7ed1a.tar.gz yuzu-e7f01128f181a7b754f6d5f94122cde059c7ed1a.tar.xz yuzu-e7f01128f181a7b754f6d5f94122cde059c7ed1a.zip | |
settings: Give indices to enums
Diffstat (limited to 'src/common/settings_setting.h')
| -rw-r--r-- | src/common/settings_setting.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/common/settings_setting.h b/src/common/settings_setting.h index eb46b2b6d..2e708fa0d 100644 --- a/src/common/settings_setting.h +++ b/src/common/settings_setting.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include <limits> | ||
| 6 | #include <map> | 7 | #include <map> |
| 7 | #include <optional> | 8 | #include <optional> |
| 8 | #include <stdexcept> | 9 | #include <stdexcept> |
| @@ -197,6 +198,14 @@ public: | |||
| 197 | return std::type_index(typeid(Type)); | 198 | return std::type_index(typeid(Type)); |
| 198 | } | 199 | } |
| 199 | 200 | ||
| 201 | constexpr u32 EnumIndex() const override { | ||
| 202 | if constexpr (std::is_enum<Type>()) { | ||
| 203 | return EnumMetadata<Type>::Index(); | ||
| 204 | } else { | ||
| 205 | return std::numeric_limits<u32>::max(); | ||
| 206 | } | ||
| 207 | } | ||
| 208 | |||
| 200 | virtual std::string MinVal() const override { | 209 | virtual std::string MinVal() const override { |
| 201 | return this->ToString(minimum); | 210 | return this->ToString(minimum); |
| 202 | } | 211 | } |