StringName: operator== compares in-place

This commit is contained in:
rune-scape
2024-05-30 13:24:48 -07:00
parent 40b378e9e2
commit 6abd17265b
2 changed files with 92 additions and 19 deletions

View File

@@ -60,6 +60,11 @@ class StringName {
uint32_t debug_references = 0;
#endif
String get_name() const { return cname ? String(cname) : name; }
bool operator==(const String &p_name) const;
bool operator!=(const String &p_name) const;
bool operator==(const char *p_name) const;
bool operator!=(const char *p_name) const;
int idx = 0;
uint32_t hash = 0;
_Data *prev = nullptr;
@@ -99,6 +104,10 @@ public:
bool operator!=(const String &p_name) const;
bool operator!=(const char *p_name) const;
char32_t operator[](int p_index) const;
int length() const;
bool is_empty() const;
_FORCE_INLINE_ bool is_node_unique_name() const {
if (!_data) {
return false;
@@ -175,7 +184,7 @@ public:
}
};
void operator=(const StringName &p_name);
StringName &operator=(const StringName &p_name);
StringName(const char *p_name, bool p_static = false);
StringName(const StringName &p_name);
StringName(const String &p_name, bool p_static = false);