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

@ -111,7 +111,7 @@ public:
void ConnectDialog::ok_pressed() {
String method_name = dst_method->get_text();
if (method_name == "") {
if (method_name.is_empty()) {
error->set_text(TTR("Method in target node must be specified."));
error->popup_centered();
return;
@ -234,7 +234,7 @@ void ConnectDialog::_add_bind() {
*/
void ConnectDialog::_remove_bind() {
String st = bind_editor->get_selected_path();
if (st == "") {
if (st.is_empty()) {
return;
}
int idx = st.get_slice("/", 1).to_int() - 1;
@ -969,7 +969,7 @@ void ConnectionsDock::update_tree() {
} else if (pi.type != Variant::NIL) {
tname = Variant::get_type_name(pi.type);
}
signaldesc += (pi.name == "" ? String("arg " + itos(i)) : pi.name) + ": " + tname;
signaldesc += (pi.name.is_empty() ? String("arg " + itos(i)) : pi.name) + ": " + tname;
argnames.push_back(pi.name + ":" + tname);
}
}
@ -1001,7 +1001,7 @@ void ConnectionsDock::update_tree() {
if (!found) {
DocTools *dd = EditorHelp::get_doc_data();
Map<String, DocData::ClassDoc>::Element *F = dd->class_list.find(base);
while (F && descr == String()) {
while (F && descr.is_empty()) {
for (int i = 0; i < F->get().signals.size(); i++) {
if (F->get().signals[i].name == signal_name.operator String()) {
descr = DTR(F->get().signals[i].description);