mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
Add a new HashMap implementation
Adds a new, cleaned up, HashMap implementation. * Uses Robin Hood Hashing (https://en.wikipedia.org/wiki/Hash_table#Robin_Hood_hashing). * Keeps elements in a double linked list for simpler, ordered, iteration. * Allows keeping iterators for later use in removal (Unlike Map<>, it does not do much for performance vs keeping the key, but helps replace old code). * Uses a more modern C++ iterator API, deprecates the old one. * Supports custom allocator (in case there is a wish to use a paged one). This class aims to unify all the associative template usage and replace it by this one: * Map<> (whereas key order does not matter, which is 99% of cases) * HashMap<> * OrderedHashMap<> * OAHashMap<>
This commit is contained in:
@@ -39,7 +39,7 @@ POTGenerator *POTGenerator::singleton = nullptr;
|
||||
|
||||
#ifdef DEBUG_POT
|
||||
void POTGenerator::_print_all_translation_strings() {
|
||||
for (OrderedHashMap<String, Vector<POTGenerator::MsgidData>>::Element E = all_translation_strings.front(); E; E = E.next()) {
|
||||
for (HashMap<String, Vector<POTGenerator::MsgidData>>::Element E = all_translation_strings.front(); E; E = E.next()) {
|
||||
Vector<MsgidData> v_md = all_translation_strings[E.key()];
|
||||
for (int i = 0; i < v_md.size(); i++) {
|
||||
print_line("++++++");
|
||||
@@ -121,9 +121,9 @@ void POTGenerator::_write_to_pot(const String &p_file) {
|
||||
|
||||
file->store_string(header);
|
||||
|
||||
for (OrderedHashMap<String, Vector<MsgidData>>::Element E_pair = all_translation_strings.front(); E_pair; E_pair = E_pair.next()) {
|
||||
String msgid = E_pair.key();
|
||||
Vector<MsgidData> v_msgid_data = E_pair.value();
|
||||
for (const KeyValue<String, Vector<MsgidData>> &E_pair : all_translation_strings) {
|
||||
String msgid = E_pair.key;
|
||||
const Vector<MsgidData> &v_msgid_data = E_pair.value;
|
||||
for (int i = 0; i < v_msgid_data.size(); i++) {
|
||||
String context = v_msgid_data[i].ctx;
|
||||
String plural = v_msgid_data[i].plural;
|
||||
|
||||
Reference in New Issue
Block a user