1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-16 14:00:40 +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

@@ -161,7 +161,7 @@ void EditorHelpSearch::popup_dialog(const String &p_term) {
popup_centered_ratio(0.5F);
}
if (p_term == "") {
if (p_term.is_empty()) {
search_box->clear();
} else {
if (old_term == p_term) {
@@ -331,7 +331,7 @@ bool EditorHelpSearch::Runner::_phase_match_classes() {
// Match class name.
if (search_flags & SEARCH_CLASSES) {
match.name = term == "" || _match_string(term, class_doc.name);
match.name = term.is_empty() || _match_string(term, class_doc.name);
}
// Match members if the term is long enough.
@@ -513,7 +513,7 @@ TreeItem *EditorHelpSearch::Runner::_create_class_hierarchy(const ClassMatch &p_
// Ensure parent nodes are created first.
TreeItem *parent = root_item;
if (p_match.doc->inherits != "") {
if (!p_match.doc->inherits.is_empty()) {
if (class_items.has(p_match.doc->inherits)) {
parent = class_items[p_match.doc->inherits];
} else {
@@ -558,7 +558,7 @@ TreeItem *EditorHelpSearch::Runner::_create_method_item(TreeItem *p_parent, cons
for (int i = 0; i < p_doc->arguments.size(); i++) {
const DocData::ArgumentDoc &arg = p_doc->arguments[i];
tooltip += arg.type + " " + arg.name;
if (arg.default_value != "") {
if (!arg.default_value.is_empty()) {
tooltip += " = " + arg.default_value;
}
if (i < p_doc->arguments.size() - 1) {
@@ -574,7 +574,7 @@ TreeItem *EditorHelpSearch::Runner::_create_signal_item(TreeItem *p_parent, cons
for (int i = 0; i < p_doc->arguments.size(); i++) {
const DocData::ArgumentDoc &arg = p_doc->arguments[i];
tooltip += arg.type + " " + arg.name;
if (arg.default_value != "") {
if (!arg.default_value.is_empty()) {
tooltip += " = " + arg.default_value;
}
if (i < p_doc->arguments.size() - 1) {