summaryrefslogtreecommitdiff
path: root/core/config
diff options
context:
space:
mode:
authorAaron Franke <arnfranke@yahoo.com>2021-07-15 23:45:57 -0400
committerAaron Franke <arnfranke@yahoo.com>2021-07-23 17:38:28 -0400
commit4e6efd1b07f1c6d53d226977ddc729333b74306a (patch)
treea52f672e7f622bb65e3b65f2a2edc9d19b1ecdcf /core/config
parentb918c4c3ce84af1f8af2d06ef31784f48a15551a (diff)
Use C++ iterators for Lists in many situations
Diffstat (limited to 'core/config')
-rw-r--r--core/config/engine.cpp4
-rw-r--r--core/config/project_settings.cpp19
2 files changed, 10 insertions, 13 deletions
diff --git a/core/config/engine.cpp b/core/config/engine.cpp
index ad31966a65..c03c872f17 100644
--- a/core/config/engine.cpp
+++ b/core/config/engine.cpp
@@ -214,8 +214,8 @@ bool Engine::has_singleton(const String &p_name) const {
}
void Engine::get_singletons(List<Singleton> *p_singletons) {
- for (List<Singleton>::Element *E = singletons.front(); E; E = E->next()) {
- p_singletons->push_back(E->get());
+ for (Singleton &E : singletons) {
+ p_singletons->push_back(E);
}
}
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp
index 84860b648d..22acb23bce 100644
--- a/core/config/project_settings.cpp
+++ b/core/config/project_settings.cpp
@@ -700,9 +700,7 @@ Error ProjectSettings::_save_settings_binary(const String &p_file, const Map<Str
int count = 0;
for (Map<String, List<String>>::Element *E = props.front(); E; E = E->next()) {
- for (List<String>::Element *F = E->get().front(); F; F = F->next()) {
- count++;
- }
+ count += E->get().size();
}
if (p_custom_features != String()) {
@@ -734,8 +732,7 @@ Error ProjectSettings::_save_settings_binary(const String &p_file, const Map<Str
}
for (Map<String, List<String>>::Element *E = props.front(); E; E = E->next()) {
- for (List<String>::Element *F = E->get().front(); F; F = F->next()) {
- String key = F->get();
+ for (String &key : E->get()) {
if (E->key() != "") {
key = E->key() + "/" + key;
}
@@ -803,8 +800,8 @@ Error ProjectSettings::_save_settings_text(const String &p_file, const Map<Strin
if (E->key() != "") {
file->store_string("[" + E->key() + "]\n\n");
}
- for (List<String>::Element *F = E->get().front(); F; F = F->next()) {
- String key = F->get();
+ for (String &F : E->get()) {
+ String key = F;
if (E->key() != "") {
key = E->key() + "/" + key;
}
@@ -817,7 +814,7 @@ Error ProjectSettings::_save_settings_text(const String &p_file, const Map<Strin
String vstr;
VariantWriter::write_to_string(value, vstr);
- file->store_string(F->get().property_name_encode() + "=" + vstr + "\n");
+ file->store_string(F.property_name_encode() + "=" + vstr + "\n");
}
}
@@ -931,11 +928,11 @@ Vector<String> ProjectSettings::get_optimizer_presets() const {
ProjectSettings::get_singleton()->get_property_list(&pi);
Vector<String> names;
- for (List<PropertyInfo>::Element *E = pi.front(); E; E = E->next()) {
- if (!E->get().name.begins_with("optimizer_presets/")) {
+ for (PropertyInfo &E : pi) {
+ if (!E.name.begins_with("optimizer_presets/")) {
continue;
}
- names.push_back(E->get().name.get_slicec('/', 1));
+ names.push_back(E.name.get_slicec('/', 1));
}
names.sort();