From 5d124c4a8f86176e8adafab3d3703f28e597cb12 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sun, 25 Apr 2021 16:40:58 +0200 Subject: Remove uses of `auto` for better readability and online code reviews The current code style guidelines forbid the use of `auto`. Some uses of `auto` are still present, such as in UWP code (which can't be currently tested) and macros (where removing `auto` isn't easy). --- core/string/translation.cpp | 2 +- core/string/translation_po.cpp | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'core') diff --git a/core/string/translation.cpp b/core/string/translation.cpp index ade5f7b4d8..153f0190fd 100644 --- a/core/string/translation.cpp +++ b/core/string/translation.cpp @@ -835,7 +835,7 @@ Vector Translation::_get_message_list() const { void Translation::_set_messages(const Dictionary &p_messages) { List keys; p_messages.get_key_list(&keys); - for (auto E = keys.front(); E; E = E->next()) { + for (List::Element *E = keys.front(); E; E = E->next()) { translation_map[E->get()] = p_messages[E->get()]; } } diff --git a/core/string/translation_po.cpp b/core/string/translation_po.cpp index 2efadaa9b7..ad768f7140 100644 --- a/core/string/translation_po.cpp +++ b/core/string/translation_po.cpp @@ -47,14 +47,14 @@ void TranslationPO::print_translation_map() { List context_l; translation_map.get_key_list(&context_l); - for (auto E = context_l.front(); E; E = E->next()) { + for (List::Element *E = context_l.front(); E; E = E->next()) { StringName ctx = E->get(); file->store_line(" ===== Context: " + String::utf8(String(ctx).utf8()) + " ===== "); const HashMap> &inner_map = translation_map[ctx]; List id_l; inner_map.get_key_list(&id_l); - for (auto E2 = id_l.front(); E2; E2 = E2->next()) { + for (List::Element *E2 = id_l.front(); E2; E2 = E2->next()) { StringName id = E2->get(); file->store_line("msgid: " + String::utf8(String(id).utf8())); for (int i = 0; i < inner_map[id].size(); i++) { @@ -74,7 +74,7 @@ Dictionary TranslationPO::_get_messages() const { List context_l; translation_map.get_key_list(&context_l); - for (auto E = context_l.front(); E; E = E->next()) { + for (List::Element *E = context_l.front(); E; E = E->next()) { StringName ctx = E->get(); const HashMap> &id_str_map = translation_map[ctx]; @@ -82,7 +82,7 @@ Dictionary TranslationPO::_get_messages() const { List id_l; id_str_map.get_key_list(&id_l); // Save list of id and strs associated with a context in a temporary dictionary. - for (auto E2 = id_l.front(); E2; E2 = E2->next()) { + for (List::Element *E2 = id_l.front(); E2; E2 = E2->next()) { StringName id = E2->get(); d2[id] = id_str_map[id]; } @@ -98,14 +98,14 @@ void TranslationPO::_set_messages(const Dictionary &p_messages) { List context_l; p_messages.get_key_list(&context_l); - for (auto E = context_l.front(); E; E = E->next()) { + for (List::Element *E = context_l.front(); E; E = E->next()) { StringName ctx = E->get(); const Dictionary &id_str_map = p_messages[ctx]; HashMap> temp_map; List id_l; id_str_map.get_key_list(&id_l); - for (auto E2 = id_l.front(); E2; E2 = E2->next()) { + for (List::Element *E2 = id_l.front(); E2; E2 = E2->next()) { StringName id = E2->get(); temp_map[id] = id_str_map[id]; } @@ -121,7 +121,7 @@ Vector TranslationPO::_get_message_list() const { get_message_list(&msgs); Vector v; - for (auto E = msgs.front(); E; E = E->next()) { + for (List::Element *E = msgs.front(); E; E = E->next()) { v.push_back(E->get()); } @@ -281,7 +281,7 @@ void TranslationPO::get_message_list(List *r_messages) const { List context_l; translation_map.get_key_list(&context_l); - for (auto E = context_l.front(); E; E = E->next()) { + for (List::Element *E = context_l.front(); E; E = E->next()) { if (String(E->get()) != "") { continue; } @@ -289,7 +289,7 @@ void TranslationPO::get_message_list(List *r_messages) const { List msgid_l; translation_map[E->get()].get_key_list(&msgid_l); - for (auto E2 = msgid_l.front(); E2; E2 = E2->next()) { + for (List::Element *E2 = msgid_l.front(); E2; E2 = E2->next()) { r_messages->push_back(E2->get()); } } @@ -300,7 +300,7 @@ int TranslationPO::get_message_count() const { translation_map.get_key_list(&context_l); int count = 0; - for (auto E = context_l.front(); E; E = E->next()) { + for (List::Element *E = context_l.front(); E; E = E->next()) { count += translation_map[E->get()].size(); } return count; -- cgit v1.2.3