summaryrefslogtreecommitdiffstats
path: root/include/godot_cpp/variant
diff options
context:
space:
mode:
Diffstat (limited to 'include/godot_cpp/variant')
-rw-r--r--include/godot_cpp/variant/variant.hpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/include/godot_cpp/variant/variant.hpp b/include/godot_cpp/variant/variant.hpp
index 1e87d6b..34811aa 100644
--- a/include/godot_cpp/variant/variant.hpp
+++ b/include/godot_cpp/variant/variant.hpp
@@ -102,14 +102,14 @@ public:
};
enum Operator {
- //comparison
+ // comparison
OP_EQUAL,
OP_NOT_EQUAL,
OP_LESS,
OP_LESS_EQUAL,
OP_GREATER,
OP_GREATER_EQUAL,
- //mathematic
+ // mathematic
OP_ADD,
OP_SUBTRACT,
OP_MULTIPLY,
@@ -117,19 +117,19 @@ public:
OP_NEGATE,
OP_POSITIVE,
OP_MODULE,
- //bitwise
+ // bitwise
OP_SHIFT_LEFT,
OP_SHIFT_RIGHT,
OP_BIT_AND,
OP_BIT_OR,
OP_BIT_XOR,
OP_BIT_NEGATE,
- //logic
+ // logic
OP_AND,
OP_OR,
OP_XOR,
OP_NOT,
- //containment
+ // containment
OP_IN,
OP_MAX
};
@@ -285,6 +285,8 @@ public:
bool has_key(const Variant &key, bool *r_valid = nullptr) const;
static bool has_member(Variant::Type type, const StringName &member);
+ uint32_t hash() const;
+ uint32_t recursive_hash(int recursion_count) const;
bool hash_compare(const Variant &variant) const;
bool booleanize() const;
String stringify() const;
@@ -299,6 +301,14 @@ public:
void clear();
};
+struct VariantHasher {
+ static _FORCE_INLINE_ uint32_t hash(const Variant &p_variant) { return p_variant.hash(); }
+};
+
+struct VariantComparator {
+ static _FORCE_INLINE_ bool compare(const Variant &p_lhs, const Variant &p_rhs) { return p_lhs.hash_compare(p_rhs); }
+};
+
} // namespace godot
#endif // ! GODOT_CPP_VARIANT_HPP