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 | |
parent | 3acd929a28c268a52f7799ea3db1ad4a01790fec (diff) | |
parent | e3e848ac4da1c2ae59d93e62da8ef6f87b3452cd (diff) |
Changeset: 68
Diffstat (limited to 'source/10-common')
-rw-r--r-- | source/10-common/Enum.hpp | 19 | ||||
-rw-r--r-- | source/10-common/Uid.cpp | 4 | ||||
-rw-r--r-- | source/10-common/Uid.hpp | 4 |
3 files changed, 17 insertions, 10 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; +}; diff --git a/source/10-common/Uid.cpp b/source/10-common/Uid.cpp index 1930cd8..7f8fd9d 100644 --- a/source/10-common/Uid.cpp +++ b/source/10-common/Uid.cpp @@ -45,13 +45,13 @@ void Uid::Read(const rapidjson::Value& value) { this->lower = lower.GetUint64(); } -void Uid::WriteInto(rapidjson::Value& value, rapidjson::Document& root) { +void Uid::WriteInto(rapidjson::Value& value, rapidjson::Document& root) const { value.Reserve(2, root.GetAllocator()); value.PushBack((uint64_t)upper, root.GetAllocator()); value.PushBack((uint64_t)lower, root.GetAllocator()); } -rapidjson::Value Uid::Write(rapidjson::Document& root) { +rapidjson::Value Uid::Write(rapidjson::Document& root) const { rapidjson::Value result(rapidjson::kArrayType); WriteInto(result, root); return result; diff --git a/source/10-common/Uid.hpp b/source/10-common/Uid.hpp index f58129c..539de03 100644 --- a/source/10-common/Uid.hpp +++ b/source/10-common/Uid.hpp @@ -25,8 +25,8 @@ struct Uid { std::string WriteString(); void Read(const rapidjson::Value& value); - void WriteInto(rapidjson::Value& value, rapidjson::Document& root); - rapidjson::Value Write(rapidjson::Document& root); + void WriteInto(rapidjson::Value& value, rapidjson::Document& root) const; + rapidjson::Value Write(rapidjson::Document& root) const; auto operator<=>(const Uid&) const = default; }; |