1
0
mirror of https://github.com/godotengine/godot.git synced 2026-01-05 19:31:35 +00:00

Simplify StringName to bool conversions.

Move `mutex` include of `string_name.h` to `string_name.cpp`.
This commit is contained in:
Lukas Tenbrink
2025-04-28 17:41:48 +02:00
parent 32eafc18b4
commit 91362a61da
3 changed files with 4 additions and 11 deletions

View File

@@ -30,6 +30,7 @@
#include "string_name.h"
#include "core/os/mutex.h"
#include "core/os/os.h"
#include "core/string/print_string.h"
@@ -176,14 +177,6 @@ int StringName::length() const {
return 0;
}
bool StringName::is_empty() const {
if (_data) {
return _data->name.is_empty();
}
return true;
}
StringName &StringName::operator=(const StringName &p_name) {
if (this == &p_name) {
return *this;

View File

@@ -30,7 +30,6 @@
#pragma once
#include "core/os/mutex.h"
#include "core/string/ustring.h"
#include "core/templates/safe_refcount.h"
@@ -78,7 +77,7 @@ class StringName {
StringName(_Data *p_data) { _data = p_data; }
public:
explicit operator bool() const { return _data && !_data->name.is_empty(); }
_FORCE_INLINE_ explicit operator bool() const { return _data; }
bool operator==(const String &p_name) const;
bool operator==(const char *p_name) const;
@@ -88,7 +87,7 @@ public:
const char32_t *get_data() const { return _data ? _data->name.ptr() : U""; }
char32_t operator[](int p_index) const;
int length() const;
bool is_empty() const;
_FORCE_INLINE_ bool is_empty() const { return !_data; }
_FORCE_INLINE_ bool is_node_unique_name() const {
if (!_data) {

View File

@@ -30,6 +30,7 @@
#pragma once
#include "core/os/mutex.h"
#include "core/templates/hash_map.h"
#include "core/templates/hash_set.h"
#include "core/templates/hashfuncs.h"