mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 00:13:30 +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:
parent
31ded7e126
commit
49403cbfa0
226 changed files with 1051 additions and 1034 deletions
|
@ -389,7 +389,7 @@ bool GDScript::instance_has(const Object *p_this) const {
|
|||
}
|
||||
|
||||
bool GDScript::has_source_code() const {
|
||||
return source != "";
|
||||
return !source.is_empty();
|
||||
}
|
||||
|
||||
String GDScript::get_source_code() const {
|
||||
|
@ -458,7 +458,7 @@ void GDScript::_update_doc() {
|
|||
doc.is_script_doc = true;
|
||||
|
||||
if (base.is_valid() && base->is_valid()) {
|
||||
if (base->doc.name != String()) {
|
||||
if (!base->doc.name.is_empty()) {
|
||||
doc.inherits = base->doc.name;
|
||||
} else {
|
||||
doc.inherits = base->get_instance_base_type();
|
||||
|
@ -472,7 +472,7 @@ void GDScript::_update_doc() {
|
|||
doc.tutorials = doc_tutorials;
|
||||
|
||||
for (const KeyValue<String, DocData::EnumDoc> &E : doc_enums) {
|
||||
if (E.value.description != "") {
|
||||
if (!E.value.description.is_empty()) {
|
||||
doc.enums[E.key] = E.value.description;
|
||||
}
|
||||
}
|
||||
|
@ -616,11 +616,11 @@ bool GDScript::_update_exports(bool *r_err, bool p_recursive_call, PlaceHolderSc
|
|||
|
||||
String basedir = path;
|
||||
|
||||
if (basedir == "") {
|
||||
if (basedir.is_empty()) {
|
||||
basedir = get_path();
|
||||
}
|
||||
|
||||
if (basedir != "") {
|
||||
if (!basedir.is_empty()) {
|
||||
basedir = basedir.get_base_dir();
|
||||
}
|
||||
|
||||
|
@ -642,7 +642,7 @@ bool GDScript::_update_exports(bool *r_err, bool p_recursive_call, PlaceHolderSc
|
|||
path = c->extends_path;
|
||||
if (path.is_relative_path()) {
|
||||
String base = get_path();
|
||||
if (base == "" || base.is_relative_path()) {
|
||||
if (base.is_empty() || base.is_relative_path()) {
|
||||
ERR_PRINT(("Could not resolve relative path for parent class: " + path).utf8().get_data());
|
||||
} else {
|
||||
path = base.get_base_dir().plus_file(path);
|
||||
|
@ -656,7 +656,7 @@ bool GDScript::_update_exports(bool *r_err, bool p_recursive_call, PlaceHolderSc
|
|||
}
|
||||
}
|
||||
|
||||
if (path != "") {
|
||||
if (!path.is_empty()) {
|
||||
if (path != get_path()) {
|
||||
Ref<GDScript> bf = ResourceLoader::load(path);
|
||||
|
||||
|
@ -809,11 +809,11 @@ Error GDScript::reload(bool p_keep_state) {
|
|||
|
||||
String basedir = path;
|
||||
|
||||
if (basedir == "") {
|
||||
if (basedir.is_empty()) {
|
||||
basedir = get_path();
|
||||
}
|
||||
|
||||
if (basedir != "") {
|
||||
if (!basedir.is_empty()) {
|
||||
basedir = basedir.get_base_dir();
|
||||
}
|
||||
|
||||
|
@ -1122,7 +1122,7 @@ String GDScript::_get_gdscript_reference_class_name(const GDScript *p_gdscript)
|
|||
|
||||
String class_name;
|
||||
while (p_gdscript) {
|
||||
if (class_name == "") {
|
||||
if (class_name.is_empty()) {
|
||||
class_name = p_gdscript->get_script_class_name();
|
||||
} else {
|
||||
class_name = p_gdscript->get_script_class_name() + "." + class_name;
|
||||
|
@ -1433,7 +1433,7 @@ void GDScriptInstance::get_property_list(List<PropertyInfo> *p_properties) const
|
|||
pinfo.type = Variant::Type(d["type"].operator int());
|
||||
ERR_CONTINUE(pinfo.type < 0 || pinfo.type >= Variant::VARIANT_MAX);
|
||||
pinfo.name = d["name"];
|
||||
ERR_CONTINUE(pinfo.name == "");
|
||||
ERR_CONTINUE(pinfo.name.is_empty());
|
||||
if (d.has("hint")) {
|
||||
pinfo.hint = PropertyHint(d["hint"].operator int());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue