1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-12 13:20:55 +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

@@ -389,14 +389,14 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
best = locale;
}
if (best == String() && host_lang.begins_with(locale)) {
if (best.is_empty() && host_lang.begins_with(locale)) {
best = locale;
}
etl++;
}
if (best == String()) {
if (best.is_empty()) {
best = "en";
}
@@ -989,7 +989,7 @@ void EditorSettings::setup_network() {
if (ip == current) {
selected = ip;
}
if (hint != "") {
if (!hint.is_empty()) {
hint += ",";
}
hint += ip;
@@ -1008,7 +1008,7 @@ void EditorSettings::save() {
return;
}
if (singleton->config_file_path == "") {
if (singleton->config_file_path.is_empty()) {
ERR_PRINT("Cannot save EditorSettings config, no valid path");
return;
}
@@ -1218,7 +1218,7 @@ void EditorSettings::load_favorites() {
FileAccess *f = FileAccess::open(get_project_settings_dir().plus_file("favorites"), FileAccess::READ);
if (f) {
String line = f->get_line().strip_edges();
while (line != "") {
while (!line.is_empty()) {
favorites.push_back(line);
line = f->get_line().strip_edges();
}
@@ -1228,7 +1228,7 @@ void EditorSettings::load_favorites() {
f = FileAccess::open(get_project_settings_dir().plus_file("recent_dirs"), FileAccess::READ);
if (f) {
String line = f->get_line().strip_edges();
while (line != "") {
while (!line.is_empty()) {
recent_dirs.push_back(line);
line = f->get_line().strip_edges();
}
@@ -1252,7 +1252,7 @@ void EditorSettings::list_text_editor_themes() {
List<String> custom_themes;
d->list_dir_begin();
String file = d->get_next();
while (file != String()) {
while (!file.is_empty()) {
if (file.get_extension() == "tet" && !_is_default_text_editor_theme(file.get_basename().to_lower())) {
custom_themes.push_back(file.get_basename());
}
@@ -1371,7 +1371,7 @@ Vector<String> EditorSettings::get_script_templates(const String &p_extension, c
if (d) {
d->list_dir_begin();
String file = d->get_next();
while (file != String()) {
while (!file.is_empty()) {
if (file.get_extension() == p_extension) {
templates.push_back(file.get_basename());
}