You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +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:
@@ -181,7 +181,7 @@ void PropertySelector::_update_search() {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (search_box->get_text() != String() && E.name.findn(search_text) == -1) {
|
||||
if (!search_box->get_text().is_empty() && E.name.findn(search_text) == -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ void PropertySelector::_update_search() {
|
||||
item->set_metadata(0, E.name);
|
||||
item->set_icon(0, type_icons[E.type]);
|
||||
|
||||
if (!found && search_box->get_text() != String() && E.name.findn(search_text) != -1) {
|
||||
if (!found && !search_box->get_text().is_empty() && E.name.findn(search_text) != -1) {
|
||||
item->select(0);
|
||||
found = true;
|
||||
}
|
||||
@@ -269,7 +269,7 @@ void PropertySelector::_update_search() {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (search_box->get_text() != String() && name.findn(search_text) == -1) {
|
||||
if (!search_box->get_text().is_empty() && name.findn(search_text) == -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ void PropertySelector::_update_search() {
|
||||
item->set_metadata(0, name);
|
||||
item->set_selectable(0, true);
|
||||
|
||||
if (!found && search_box->get_text() != String() && name.findn(search_text) != -1) {
|
||||
if (!found && !search_box->get_text().is_empty() && name.findn(search_text) != -1) {
|
||||
item->select(0);
|
||||
found = true;
|
||||
}
|
||||
@@ -353,7 +353,7 @@ void PropertySelector::_item_selected() {
|
||||
String class_type;
|
||||
if (type != Variant::NIL) {
|
||||
class_type = Variant::get_type_name(type);
|
||||
} else if (base_type != String()) {
|
||||
} else if (!base_type.is_empty()) {
|
||||
class_type = base_type;
|
||||
} else if (instance) {
|
||||
class_type = instance->get_class();
|
||||
@@ -362,7 +362,7 @@ void PropertySelector::_item_selected() {
|
||||
DocTools *dd = EditorHelp::get_doc_data();
|
||||
String text;
|
||||
if (properties) {
|
||||
while (class_type != String()) {
|
||||
while (!class_type.is_empty()) {
|
||||
Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(class_type);
|
||||
if (E) {
|
||||
for (int i = 0; i < E->get().properties.size(); i++) {
|
||||
@@ -373,7 +373,7 @@ void PropertySelector::_item_selected() {
|
||||
}
|
||||
}
|
||||
|
||||
if (text != String()) {
|
||||
if (!text.is_empty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -381,7 +381,7 @@ void PropertySelector::_item_selected() {
|
||||
class_type = ClassDB::get_parent_class(class_type);
|
||||
}
|
||||
} else {
|
||||
while (class_type != String()) {
|
||||
while (!class_type.is_empty()) {
|
||||
Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(class_type);
|
||||
if (E) {
|
||||
for (int i = 0; i < E->get().methods.size(); i++) {
|
||||
@@ -392,7 +392,7 @@ void PropertySelector::_item_selected() {
|
||||
}
|
||||
}
|
||||
|
||||
if (text != String()) {
|
||||
if (!text.is_empty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -401,7 +401,7 @@ void PropertySelector::_item_selected() {
|
||||
}
|
||||
}
|
||||
|
||||
if (text != String()) {
|
||||
if (!text.is_empty()) {
|
||||
// Display both property name and description, since the help bit may be displayed
|
||||
// far away from the location (especially if the dialog was resized to be taller).
|
||||
help_bit->set_text(vformat("[b]%s[/b]: %s", name, text));
|
||||
|
||||
Reference in New Issue
Block a user