Replace most uses of Map by HashMap

* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
  (order matters) but use is discouraged.

There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
This commit is contained in:
reduz 2022-05-13 15:04:37 +02:00 committed by Rémi Verschelde
parent 396def9b66
commit 746dddc067
587 changed files with 3707 additions and 3538 deletions

View file

@ -101,7 +101,7 @@ bool EditorFeatureProfile::is_class_editor_disabled(const StringName &p_class) c
void EditorFeatureProfile::set_disable_class_property(const StringName &p_class, const StringName &p_property, bool p_disabled) {
if (p_disabled) {
if (!disabled_properties.has(p_class)) {
disabled_properties[p_class] = Set<StringName>();
disabled_properties[p_class] = RBSet<StringName>();
}
disabled_properties[p_class].insert(p_property);
@ -166,14 +166,14 @@ Error EditorFeatureProfile::save_to_file(const String &p_path) {
Dictionary data;
data["type"] = "feature_profile";
Array dis_classes;
for (Set<StringName>::Element *E = disabled_classes.front(); E; E = E->next()) {
for (RBSet<StringName>::Element *E = disabled_classes.front(); E; E = E->next()) {
dis_classes.push_back(String(E->get()));
}
dis_classes.sort();
data["disabled_classes"] = dis_classes;
Array dis_editors;
for (Set<StringName>::Element *E = disabled_editors.front(); E; E = E->next()) {
for (RBSet<StringName>::Element *E = disabled_editors.front(); E; E = E->next()) {
dis_editors.push_back(String(E->get()));
}
dis_editors.sort();
@ -181,8 +181,8 @@ Error EditorFeatureProfile::save_to_file(const String &p_path) {
Array dis_props;
for (KeyValue<StringName, Set<StringName>> &E : disabled_properties) {
for (Set<StringName>::Element *F = E.value.front(); F; F = F->next()) {
for (KeyValue<StringName, RBSet<StringName>> &E : disabled_properties) {
for (RBSet<StringName>::Element *F = E.value.front(); F; F = F->next()) {
dis_props.push_back(String(E.key) + ":" + String(F->get()));
}
}
@ -556,9 +556,9 @@ void EditorFeatureProfileManager::_class_list_item_selected() {
String class_description;
DocTools *dd = EditorHelp::get_doc_data();
Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(class_name);
HashMap<String, DocData::ClassDoc>::Iterator E = dd->class_list.find(class_name);
if (E) {
class_description = DTR(E->get().brief_description);
class_description = DTR(E->value.brief_description);
}
description_bit->set_text(class_description);