Use C++ iterators for Lists in many situations

This commit is contained in:
Aaron Franke 2021-07-15 23:45:57 -04:00
parent b918c4c3ce
commit 4e6efd1b07
No known key found for this signature in database
GPG key ID: 40A1750B977E56BF
218 changed files with 2755 additions and 3004 deletions

View file

@ -538,11 +538,11 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const
Engine::get_singleton()->get_singletons(&names);
property.hint = PROPERTY_HINT_ENUM;
String sl;
for (List<Engine::Singleton>::Element *E = names.front(); E; E = E->next()) {
for (Engine::Singleton &E : names) {
if (sl != String()) {
sl += ",";
}
sl += E->get().name;
sl += E.name;
}
property.hint_string = sl;
}
@ -683,11 +683,11 @@ void VisualScriptFunctionCall::_bind_methods() {
}
String script_ext_hint;
for (List<String>::Element *E = script_extensions.front(); E; E = E->next()) {
for (String &E : script_extensions) {
if (script_ext_hint != String()) {
script_ext_hint += ",";
}
script_ext_hint += "*." + E->get();
script_ext_hint += "*." + E;
}
ADD_PROPERTY(PropertyInfo(Variant::INT, "call_mode", PROPERTY_HINT_ENUM, "Self,Node Path,Instance,Basic Type,Singleton"), "set_call_mode", "get_call_mode");
@ -1004,13 +1004,13 @@ PropertyInfo VisualScriptPropertySet::get_input_value_port_info(int p_idx) const
List<PropertyInfo> props;
ClassDB::get_property_list(_get_base_type(), &props, false);
for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
if (E->get().name == property) {
for (PropertyInfo &E : props) {
if (E.name == property) {
String detail_prop_name = property;
if (index != StringName()) {
detail_prop_name += "." + String(index);
}
PropertyInfo pinfo = PropertyInfo(E->get().type, detail_prop_name, PROPERTY_HINT_TYPE_STRING, E->get().hint_string);
PropertyInfo pinfo = PropertyInfo(E.type, detail_prop_name, PROPERTY_HINT_TYPE_STRING, E.hint_string);
_adjust_input_index(pinfo);
return pinfo;
}
@ -1135,9 +1135,9 @@ void VisualScriptPropertySet::_update_cache() {
List<PropertyInfo> pinfo;
v.get_property_list(&pinfo);
for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
if (E->get().name == property) {
type_cache = E->get();
for (PropertyInfo &E : pinfo) {
if (E.name == property) {
type_cache = E;
}
}
@ -1186,9 +1186,9 @@ void VisualScriptPropertySet::_update_cache() {
script->get_script_property_list(&pinfo);
}
for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
if (E->get().name == property) {
type_cache = E->get();
for (PropertyInfo &E : pinfo) {
if (E.name == property) {
type_cache = E;
return;
}
}
@ -1354,8 +1354,8 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const {
List<PropertyInfo> plist;
v.get_property_list(&plist);
String options = "";
for (List<PropertyInfo>::Element *E = plist.front(); E; E = E->next()) {
options += "," + E->get().name;
for (PropertyInfo &E : plist) {
options += "," + E.name;
}
property.hint = PROPERTY_HINT_ENUM;
@ -1410,11 +1410,11 @@ void VisualScriptPropertySet::_bind_methods() {
}
String script_ext_hint;
for (List<String>::Element *E = script_extensions.front(); E; E = E->next()) {
for (String &E : script_extensions) {
if (script_ext_hint != String()) {
script_ext_hint += ",";
}
script_ext_hint += "*." + E->get();
script_ext_hint += "*." + E;
}
ADD_PROPERTY(PropertyInfo(Variant::INT, "set_mode", PROPERTY_HINT_ENUM, "Self,Node Path,Instance,Basic Type"), "set_call_mode", "get_call_mode");
@ -1820,9 +1820,9 @@ void VisualScriptPropertyGet::_update_cache() {
List<PropertyInfo> pinfo;
v.get_property_list(&pinfo);
for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
if (E->get().name == property) {
type_cache = E->get().type;
for (PropertyInfo &E : pinfo) {
if (E.name == property) {
type_cache = E.type;
return;
}
}
@ -2059,8 +2059,8 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const {
List<PropertyInfo> plist;
v.get_property_list(&plist);
String options = "";
for (List<PropertyInfo>::Element *E = plist.front(); E; E = E->next()) {
options += "," + E->get().name;
for (PropertyInfo &E : plist) {
options += "," + E.name;
}
property.hint = PROPERTY_HINT_ENUM;
@ -2112,11 +2112,11 @@ void VisualScriptPropertyGet::_bind_methods() {
}
String script_ext_hint;
for (List<String>::Element *E = script_extensions.front(); E; E = E->next()) {
for (String &E : script_extensions) {
if (script_ext_hint != String()) {
script_ext_hint += ",";
}
script_ext_hint += "." + E->get();
script_ext_hint += "." + E;
}
ADD_PROPERTY(PropertyInfo(Variant::INT, "set_mode", PROPERTY_HINT_ENUM, "Self,Node Path,Instance,Basic Type"), "set_call_mode", "get_call_mode");
@ -2323,11 +2323,11 @@ void VisualScriptEmitSignal::_validate_property(PropertyInfo &property) const {
}
String ml;
for (List<StringName>::Element *E = sigs.front(); E; E = E->next()) {
for (StringName &E : sigs) {
if (ml != String()) {
ml += ",";
}
ml += E->get();
ml += E;
}
property.hint_string = ml;
@ -2418,8 +2418,8 @@ void register_visual_script_func_nodes() {
List<MethodInfo> ml;
vt.get_method_list(&ml);
for (List<MethodInfo>::Element *E = ml.front(); E; E = E->next()) {
VisualScriptLanguage::singleton->add_register_func("functions/by_type/" + type_name + "/" + E->get().name, create_basic_type_call_node);
for (MethodInfo &E : ml) {
VisualScriptLanguage::singleton->add_register_func("functions/by_type/" + type_name + "/" + E.name, create_basic_type_call_node);
}
}
}