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
No known key found for this signature in database
GPG key ID: 92164DCCF3B1F723
226 changed files with 1051 additions and 1034 deletions

View file

@ -1307,7 +1307,7 @@ void VisualScriptVariableGet::_validate_property(PropertyInfo &property) const {
String vhint;
for (const StringName &E : vars) {
if (vhint != String()) {
if (!vhint.is_empty()) {
vhint += ",";
}
@ -1417,7 +1417,7 @@ void VisualScriptVariableSet::_validate_property(PropertyInfo &property) const {
String vhint;
for (const StringName &E : vars) {
if (vhint != String()) {
if (!vhint.is_empty()) {
vhint += ",";
}
@ -1615,7 +1615,7 @@ PropertyInfo VisualScriptPreload::get_output_value_port_info(int p_idx) const {
pinfo.hint_string = preload->get_class();
if (preload->get_path().is_resource_file()) {
pinfo.name = preload->get_path();
} else if (preload->get_name() != String()) {
} else if (!preload->get_name().is_empty()) {
pinfo.name = preload->get_name();
} else {
pinfo.name = preload->get_class();
@ -1994,7 +1994,7 @@ void VisualScriptClassConstant::_validate_property(PropertyInfo &property) const
property.hint_string = "";
for (const String &E : constants) {
if (property.hint_string != String()) {
if (!property.hint_string.is_empty()) {
property.hint_string += ",";
}
property.hint_string += E;
@ -2132,7 +2132,7 @@ void VisualScriptBasicTypeConstant::_validate_property(PropertyInfo &property) c
}
property.hint_string = "";
for (const StringName &E : constants) {
if (property.hint_string != String()) {
if (!property.hint_string.is_empty()) {
property.hint_string += ",";
}
property.hint_string += String(E);
@ -2363,7 +2363,7 @@ void VisualScriptEngineSingleton::_validate_property(PropertyInfo &property) con
continue; //skip these, too simple named
}
if (cc != String()) {
if (!cc.is_empty()) {
cc += ",";
}
cc += E.name;
@ -3147,7 +3147,7 @@ String VisualScriptSubCall::get_caption() const {
String VisualScriptSubCall::get_text() const {
Ref<Script> script = get_script();
if (script.is_valid()) {
if (script->get_name() != String()) {
if (!script->get_name().is_empty()) {
return script->get_name();
}
if (script->get_path().is_resource_file()) {
@ -3786,7 +3786,7 @@ void VisualScriptInputAction::_validate_property(PropertyInfo &property) const {
al.sort();
for (int i = 0; i < al.size(); i++) {
if (actions != String()) {
if (!actions.is_empty()) {
actions += ",";
}
actions += al[i];