diff options
author | rtk0c <[email protected]> | 2022-06-09 23:20:33 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2022-06-09 23:20:33 -0700 |
commit | ab81521707d6ffa3f5d01ad315c0070b54bf468a (patch) | |
tree | e9d19a27a9266962b87ae73576bfa5232ed705b6 /source/10-common/Enum.hpp | |
parent | 3acd929a28c268a52f7799ea3db1ad4a01790fec (diff) | |
parent | e3e848ac4da1c2ae59d93e62da8ef6f87b3452cd (diff) |
Changeset: 68
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; +}; |