You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
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:
@@ -99,7 +99,7 @@ void EditorHelp::_class_desc_select(const String &p_select) {
|
||||
String link = p_select.substr(tag_end + 1, p_select.length()).lstrip(" ");
|
||||
|
||||
String topic;
|
||||
Map<String, int> *table = nullptr;
|
||||
HashMap<String, int> *table = nullptr;
|
||||
|
||||
if (tag == "method") {
|
||||
topic = "class_method";
|
||||
@@ -648,7 +648,7 @@ void EditorHelp::_update_doc() {
|
||||
}
|
||||
|
||||
// Properties overview
|
||||
Set<String> skip_methods;
|
||||
RBSet<String> skip_methods;
|
||||
bool property_descr = false;
|
||||
|
||||
bool has_properties = cd.properties.size() != 0;
|
||||
@@ -873,7 +873,7 @@ void EditorHelp::_update_doc() {
|
||||
class_desc->push_indent(1);
|
||||
|
||||
String theme_data_type;
|
||||
Map<String, String> data_type_names;
|
||||
HashMap<String, String> data_type_names;
|
||||
data_type_names["color"] = TTR("Colors");
|
||||
data_type_names["constant"] = TTR("Constants");
|
||||
data_type_names["font"] = TTR("Fonts");
|
||||
@@ -1019,7 +1019,7 @@ void EditorHelp::_update_doc() {
|
||||
|
||||
// Constants and enums
|
||||
if (!cd.constants.is_empty()) {
|
||||
Map<String, Vector<DocData::ConstantDoc>> enums;
|
||||
HashMap<String, Vector<DocData::ConstantDoc>> enums;
|
||||
Vector<DocData::ConstantDoc> constants;
|
||||
|
||||
for (int i = 0; i < cd.constants.size(); i++) {
|
||||
@@ -1089,7 +1089,7 @@ void EditorHelp::_update_doc() {
|
||||
class_desc->push_indent(1);
|
||||
Vector<DocData::ConstantDoc> enum_list = E.value;
|
||||
|
||||
Map<String, int> enumValuesContainer;
|
||||
HashMap<String, int> enumValuesContainer;
|
||||
int enumStartingLine = enum_line[E.key];
|
||||
|
||||
for (int i = 0; i < enum_list.size(); i++) {
|
||||
@@ -1285,7 +1285,7 @@ void EditorHelp::_update_doc() {
|
||||
|
||||
// Script doc doesn't have setter, getter.
|
||||
if (!cd.is_script_doc) {
|
||||
Map<String, DocData::MethodDoc> method_map;
|
||||
HashMap<String, DocData::MethodDoc> method_map;
|
||||
for (int j = 0; j < methods.size(); j++) {
|
||||
method_map[methods[j].name] = methods[j];
|
||||
}
|
||||
@@ -1450,15 +1450,15 @@ void EditorHelp::_help_callback(const String &p_topic) {
|
||||
} else if (method_line.has(name)) {
|
||||
line = method_line[name];
|
||||
} else {
|
||||
Map<String, Map<String, int>>::Element *iter = enum_values_line.front();
|
||||
HashMap<String, HashMap<String, int>>::Iterator iter = enum_values_line.begin();
|
||||
while (true) {
|
||||
if (iter->value().has(name)) {
|
||||
line = iter->value()[name];
|
||||
if (iter->value.has(name)) {
|
||||
line = iter->value[name];
|
||||
break;
|
||||
} else if (iter == enum_values_line.back()) {
|
||||
} else if (iter == enum_values_line.last()) {
|
||||
break;
|
||||
} else {
|
||||
iter = iter->next();
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user