diff options
author | Jacques Lucke <jacques@blender.org> | 2020-07-03 15:15:05 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-07-03 15:16:02 +0300 |
commit | d64803f63b4311b0abb93542a907e97b47493e9f (patch) | |
tree | c9c43b768859393d1b4b1d8c0bca84081606b19a /source/blender/blenlib/BLI_map_slots.hh | |
parent | e797c4f28f50f2be9d6d28d4b8e5c080d53ef74f (diff) |
Cleanup: Use trailing underscore for non-public data members
This makes the code conform better with our style guide.
Diffstat (limited to 'source/blender/blenlib/BLI_map_slots.hh')
-rw-r--r-- | source/blender/blenlib/BLI_map_slots.hh | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/source/blender/blenlib/BLI_map_slots.hh b/source/blender/blenlib/BLI_map_slots.hh index f12eefcaf0b..c3d88205e0a 100644 --- a/source/blender/blenlib/BLI_map_slots.hh +++ b/source/blender/blenlib/BLI_map_slots.hh @@ -52,9 +52,9 @@ template<typename Key, typename Value> class SimpleMapSlot { Removed = 2, }; - State m_state; - AlignedBuffer<sizeof(Key), alignof(Key)> m_key_buffer; - AlignedBuffer<sizeof(Value), alignof(Value)> m_value_buffer; + State state_; + AlignedBuffer<sizeof(Key), alignof(Key)> key_buffer_; + AlignedBuffer<sizeof(Value), alignof(Value)> value_buffer_; public: /** @@ -62,7 +62,7 @@ template<typename Key, typename Value> class SimpleMapSlot { */ SimpleMapSlot() { - m_state = Empty; + state_ = Empty; } /** @@ -70,7 +70,7 @@ template<typename Key, typename Value> class SimpleMapSlot { */ ~SimpleMapSlot() { - if (m_state == Occupied) { + if (state_ == Occupied) { this->key()->~Key(); this->value()->~Value(); } @@ -82,8 +82,8 @@ template<typename Key, typename Value> class SimpleMapSlot { */ SimpleMapSlot(const SimpleMapSlot &other) { - m_state = other.m_state; - if (other.m_state == Occupied) { + state_ = other.state_; + if (other.state_ == Occupied) { new ((void *)this->key()) Key(*other.key()); new ((void *)this->value()) Value(*other.value()); } @@ -96,8 +96,8 @@ template<typename Key, typename Value> class SimpleMapSlot { */ SimpleMapSlot(SimpleMapSlot &&other) noexcept { - m_state = other.m_state; - if (other.m_state == Occupied) { + state_ = other.state_; + if (other.state_ == Occupied) { new ((void *)this->key()) Key(std::move(*other.key())); new ((void *)this->value()) Value(std::move(*other.value())); } @@ -108,7 +108,7 @@ template<typename Key, typename Value> class SimpleMapSlot { */ Key *key() { - return (Key *)m_key_buffer.ptr(); + return (Key *)key_buffer_.ptr(); } /** @@ -116,7 +116,7 @@ template<typename Key, typename Value> class SimpleMapSlot { */ const Key *key() const { - return (const Key *)m_key_buffer.ptr(); + return (const Key *)key_buffer_.ptr(); } /** @@ -124,7 +124,7 @@ template<typename Key, typename Value> class SimpleMapSlot { */ Value *value() { - return (Value *)m_value_buffer.ptr(); + return (Value *)value_buffer_.ptr(); } /** @@ -132,7 +132,7 @@ template<typename Key, typename Value> class SimpleMapSlot { */ const Value *value() const { - return (const Value *)m_value_buffer.ptr(); + return (const Value *)value_buffer_.ptr(); } /** @@ -140,7 +140,7 @@ template<typename Key, typename Value> class SimpleMapSlot { */ bool is_occupied() const { - return m_state == Occupied; + return state_ == Occupied; } /** @@ -148,7 +148,7 @@ template<typename Key, typename Value> class SimpleMapSlot { */ bool is_empty() const { - return m_state == Empty; + return state_ == Empty; } /** @@ -169,7 +169,7 @@ template<typename Key, typename Value> class SimpleMapSlot { { BLI_assert(!this->is_occupied()); BLI_assert(other.is_occupied()); - m_state = Occupied; + state_ = Occupied; new ((void *)this->key()) Key(std::move(*other.key())); new ((void *)this->value()) Value(std::move(*other.value())); other.key()->~Key(); @@ -183,7 +183,7 @@ template<typename Key, typename Value> class SimpleMapSlot { template<typename ForwardKey, typename IsEqual> bool contains(const ForwardKey &key, const IsEqual &is_equal, uint32_t UNUSED(hash)) const { - if (m_state == Occupied) { + if (state_ == Occupied) { return is_equal(key, *this->key()); } return false; @@ -208,7 +208,7 @@ template<typename Key, typename Value> class SimpleMapSlot { template<typename ForwardKey> void occupy_without_value(ForwardKey &&key, uint32_t UNUSED(hash)) { BLI_assert(!this->is_occupied()); - m_state = Occupied; + state_ = Occupied; new ((void *)this->key()) Key(std::forward<ForwardKey>(key)); } @@ -219,7 +219,7 @@ template<typename Key, typename Value> class SimpleMapSlot { void remove() { BLI_assert(this->is_occupied()); - m_state = Removed; + state_ = Removed; this->key()->~Key(); this->value()->~Value(); } @@ -235,61 +235,61 @@ template<typename Key, typename Value> class SimpleMapSlot { */ template<typename Key, typename Value, typename KeyInfo> class IntrusiveMapSlot { private: - Key m_key = KeyInfo::get_empty(); - AlignedBuffer<sizeof(Value), alignof(Value)> m_value_buffer; + Key key_ = KeyInfo::get_empty(); + AlignedBuffer<sizeof(Value), alignof(Value)> value_buffer_; public: IntrusiveMapSlot() = default; ~IntrusiveMapSlot() { - if (KeyInfo::is_not_empty_or_removed(m_key)) { + if (KeyInfo::is_not_empty_or_removed(key_)) { this->value()->~Value(); } } - IntrusiveMapSlot(const IntrusiveMapSlot &other) : m_key(other.m_key) + IntrusiveMapSlot(const IntrusiveMapSlot &other) : key_(other.key_) { - if (KeyInfo::is_not_empty_or_removed(m_key)) { + if (KeyInfo::is_not_empty_or_removed(key_)) { new ((void *)this->value()) Value(*other.value()); } } - IntrusiveMapSlot(IntrusiveMapSlot &&other) noexcept : m_key(other.m_key) + IntrusiveMapSlot(IntrusiveMapSlot &&other) noexcept : key_(other.key_) { - if (KeyInfo::is_not_empty_or_removed(m_key)) { + if (KeyInfo::is_not_empty_or_removed(key_)) { new ((void *)this->value()) Value(std::move(*other.value())); } } Key *key() { - return &m_key; + return &key_; } const Key *key() const { - return &m_key; + return &key_; } Value *value() { - return (Value *)m_value_buffer.ptr(); + return (Value *)value_buffer_.ptr(); } const Value *value() const { - return (const Value *)m_value_buffer.ptr(); + return (const Value *)value_buffer_.ptr(); } bool is_occupied() const { - return KeyInfo::is_not_empty_or_removed(m_key); + return KeyInfo::is_not_empty_or_removed(key_); } bool is_empty() const { - return KeyInfo::is_empty(m_key); + return KeyInfo::is_empty(key_); } template<typename Hash> uint32_t get_hash(const Hash &hash) @@ -302,9 +302,9 @@ template<typename Key, typename Value, typename KeyInfo> class IntrusiveMapSlot { BLI_assert(!this->is_occupied()); BLI_assert(other.is_occupied()); - m_key = std::move(other.m_key); + key_ = std::move(other.key_); new ((void *)this->value()) Value(std::move(*other.value())); - other.m_key.~Key(); + other.key_.~Key(); other.value()->~Value(); } @@ -312,7 +312,7 @@ template<typename Key, typename Value, typename KeyInfo> class IntrusiveMapSlot bool contains(const ForwardKey &key, const IsEqual &is_equal, uint32_t UNUSED(hash)) const { BLI_assert(KeyInfo::is_not_empty_or_removed(key)); - return is_equal(key, m_key); + return is_equal(key, key_); } template<typename ForwardKey, typename ForwardValue> @@ -328,13 +328,13 @@ template<typename Key, typename Value, typename KeyInfo> class IntrusiveMapSlot { BLI_assert(!this->is_occupied()); BLI_assert(KeyInfo::is_not_empty_or_removed(key)); - m_key = std::forward<ForwardKey>(key); + key_ = std::forward<ForwardKey>(key); } void remove() { BLI_assert(this->is_occupied()); - KeyInfo::remove(m_key); + KeyInfo::remove(key_); this->value()->~Value(); } }; |