1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Replace String comparisons with "", String() to is_empty()

Also:
- Adds two stress tests to test_string.h
- Changes to .empty() on std::strings
This commit is contained in:
Nathan Franke
2021-12-09 03:42:46 -06:00
parent 31ded7e126
commit 49403cbfa0
226 changed files with 1051 additions and 1034 deletions

View File

@@ -340,22 +340,22 @@ void EditorAutoloadSettings::_autoload_file_callback(const String &p_path) {
}
void EditorAutoloadSettings::_autoload_text_submitted(const String p_name) {
if (autoload_add_path->get_text() != "" && _autoload_name_is_valid(p_name, nullptr)) {
if (!autoload_add_path->get_text().is_empty() && _autoload_name_is_valid(p_name, nullptr)) {
_autoload_add();
}
}
void EditorAutoloadSettings::_autoload_path_text_changed(const String p_path) {
add_autoload->set_disabled(
p_path == "" || !_autoload_name_is_valid(autoload_add_name->get_text(), nullptr));
p_path.is_empty() || !_autoload_name_is_valid(autoload_add_name->get_text(), nullptr));
}
void EditorAutoloadSettings::_autoload_text_changed(const String p_name) {
String error_string;
bool is_name_valid = _autoload_name_is_valid(p_name, &error_string);
add_autoload->set_disabled(autoload_add_path->get_text() == "" || !is_name_valid);
add_autoload->set_disabled(autoload_add_path->get_text().is_empty() || !is_name_valid);
error_message->set_text(error_string);
error_message->set_visible(autoload_add_name->get_text() != "" && !is_name_valid);
error_message->set_visible(!autoload_add_name->get_text().is_empty() && !is_name_valid);
}
Node *EditorAutoloadSettings::_create_autoload(const String &p_path) {