From 3c461a4660fff9d757a4b38698b95d29f82eeded Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 15 Jan 2023 23:46:53 +0100 Subject: [PATCH] Added more getters to the new HshMap, for more backwards compatibility. --- core/containers/hash_map.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/core/containers/hash_map.h b/core/containers/hash_map.h index 98bcd2d1f..692991e76 100644 --- a/core/containers/hash_map.h +++ b/core/containers/hash_map.h @@ -63,6 +63,26 @@ public: Element *next = nullptr; Element *prev = nullptr; KeyValue data; + + const TKey &key() const { + return data.key; + } + + TValue &value() { + return data.value; + } + + const TValue &value() const { + return data.value; + } + + TValue &get() { + return data.value; + }; + const TValue &get() const { + return data.value; + }; + Element() {} Element(const TKey &p_key, const TValue &p_value) : data(p_key, p_value) {} @@ -154,6 +174,14 @@ public: return NULL; } + _FORCE_INLINE_ const Element *find(const TKey &p_key) const { + return get_element(p_key); + } + + _FORCE_INLINE_ Element *find(const TKey &p_key) { + return get_element(p_key); + } + /** * Same as get, except it can return NULL when item was not found. * This version is custom, will take a hash and a custom key (that should support operator==()