diff options
Diffstat (limited to 'source/10-common/Enum.hpp')
-rw-r--r-- | source/10-common/Enum.hpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/source/10-common/Enum.hpp b/source/10-common/Enum.hpp index 8ad75ba..5d75955 100644 --- a/source/10-common/Enum.hpp +++ b/source/10-common/Enum.hpp @@ -61,32 +61,32 @@ public: } } - EnumFlags& operator|=(EnumFlags that) { + EnumFlags& operator|=(EnumFlags that) const { mValue |= that.mValue; return *this; } - EnumFlags& operator&=(EnumFlags that) { + EnumFlags& operator&=(EnumFlags that) const { mValue &= that.mValue; return *this; } - EnumFlags& operator^=(EnumFlags that) { + EnumFlags& operator^=(EnumFlags that) const { mValue ^= that.mValue; return *this; } - EnumFlags& operator|=(TEnum e) { + EnumFlags& operator|=(TEnum e) const { mValue |= 1 << static_cast<Underlying>(e); return *this; } - EnumFlags& operator&=(TEnum e) { + EnumFlags& operator&=(TEnum e) const { mValue &= 1 << static_cast<Underlying>(e); return *this; } - EnumFlags& operator^=(TEnum e) { + EnumFlags& operator^=(TEnum e) const { mValue ^= 1 << static_cast<Underlying>(e); return *this; } @@ -101,3 +101,10 @@ public: EnumFlags operator~() const { return EnumFlags(~mValue); } }; + +// Helper class for enumerating enum elements for ImGui::Begin/EndCombo +template <class TEnum> +struct EnumElement { + const char* name; + TEnum value; +}; |