Renamed Map to RBMap.

This commit is contained in:
Relintai 2023-01-15 19:12:50 +01:00
parent 389052c51a
commit 1b0aac6028
369 changed files with 1866 additions and 2626 deletions

View File

@ -1067,7 +1067,7 @@ void _OS::print_resources_by_type(const Vector<String> &p_types) {
print_line(vformat("Resources currently in use for the following types: %s", p_types));
Map<String, int> type_count;
RBMap<String, int> type_count;
List<Ref<Resource>> resources;
ResourceCache::get_cached_resources(&resources);
@ -1100,7 +1100,7 @@ void _OS::print_resources_by_type(const Vector<String> &p_types) {
}
}
for (Map<String, int>::Element *E = type_count.front(); E; E = E->next()) {
for (RBMap<String, int>::Element *E = type_count.front(); E; E = E->next()) {
print_line(vformat("%s count: %d", E->key(), E->get()));
}
}

View File

@ -234,7 +234,7 @@ void Engine::add_singleton(const Singleton &p_singleton) {
}
Object *Engine::get_singleton_object(const String &p_name) const {
const Map<StringName, Object *>::Element *E = singleton_ptrs.find(p_name);
const RBMap<StringName, Object *>::Element *E = singleton_ptrs.find(p_name);
ERR_FAIL_COND_V_MSG(!E, nullptr, "Failed to retrieve non-existent singleton '" + p_name + "'.");
return E->get();
};

View File

@ -137,7 +137,7 @@ private:
bool _in_physics;
List<Singleton> singletons;
Map<StringName, Object *> singleton_ptrs;
RBMap<StringName, Object *> singleton_ptrs;
bool editor_hint;

View File

@ -235,7 +235,7 @@ void ProjectSettings::_get_property_list(List<PropertyInfo> *p_list) const {
Set<_VCSort> vclist;
for (Map<StringName, VariantContainer>::Element *E = props.front(); E; E = E->next()) {
for (RBMap<StringName, VariantContainer>::Element *E = props.front(); E; E = E->next()) {
const VariantContainer *v = &E->get();
if (v->hide_from_editor) {
@ -297,7 +297,7 @@ bool ProjectSettings::_load_resource_pack(const String &p_pack, bool p_replace_f
void ProjectSettings::_convert_to_last_version(int p_from_version) {
if (p_from_version <= 3) {
// Converts the actions from array to dictionary (array of events to dictionary with deadzone + events)
for (Map<StringName, ProjectSettings::VariantContainer>::Element *E = props.front(); E; E = E->next()) {
for (RBMap<StringName, ProjectSettings::VariantContainer>::Element *E = props.front(); E; E = E->next()) {
Variant value = E->get().variant;
if (String(E->key()).begins_with("input/") && value.get_type() == Variant::ARRAY) {
Array array = value;
@ -670,7 +670,7 @@ Error ProjectSettings::save() {
return error;
}
Error ProjectSettings::_save_settings_binary(const String &p_file, const Map<String, List<String>> &props, const CustomMap &p_custom, const String &p_custom_features) {
Error ProjectSettings::_save_settings_binary(const String &p_file, const RBMap<String, List<String>> &props, const CustomMap &p_custom, const String &p_custom_features) {
Error err;
FileAccess *file = FileAccess::open(p_file, FileAccess::WRITE, &err);
ERR_FAIL_COND_V_MSG(err != OK, err, "Couldn't save project.binary at " + p_file + ".");
@ -680,7 +680,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 (RBMap<String, List<String>>::Element *E = props.front(); E; E = E->next()) {
for (List<String>::Element *F = E->get().front(); F; F = F->next()) {
count++;
}
@ -714,7 +714,7 @@ Error ProjectSettings::_save_settings_binary(const String &p_file, const Map<Str
file->store_32(count); //store how many properties are saved
}
for (Map<String, List<String>>::Element *E = props.front(); E; E = E->next()) {
for (RBMap<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();
if (E->key() != "") {
@ -755,7 +755,7 @@ Error ProjectSettings::_save_settings_binary(const String &p_file, const Map<Str
return OK;
}
Error ProjectSettings::_save_settings_text(const String &p_file, const Map<String, List<String>> &props, const CustomMap &p_custom, const String &p_custom_features) {
Error ProjectSettings::_save_settings_text(const String &p_file, const RBMap<String, List<String>> &props, const CustomMap &p_custom, const String &p_custom_features) {
Error err;
FileAccess *file = FileAccess::open(p_file, FileAccess::WRITE, &err);
@ -776,7 +776,7 @@ Error ProjectSettings::_save_settings_text(const String &p_file, const Map<Strin
}
file->store_string("\n");
for (Map<String, List<String>>::Element *E = props.front(); E; E = E->next()) {
for (RBMap<String, List<String>>::Element *E = props.front(); E; E = E->next()) {
if (E != props.front()) {
file->store_string("\n");
}
@ -819,7 +819,7 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust
Set<_VCSort> vclist;
if (p_merge_with_current) {
for (Map<StringName, VariantContainer>::Element *G = props.front(); G; G = G->next()) {
for (RBMap<StringName, VariantContainer>::Element *G = props.front(); G; G = G->next()) {
const VariantContainer *v = &G->get();
if (v->hide_from_editor) {
@ -843,9 +843,9 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust
}
}
for (const Map<String, Variant>::Element *E = p_custom.front(); E; E = E->next()) {
for (const RBMap<String, Variant>::Element *E = p_custom.front(); E; E = E->next()) {
// Lookup global prop to store in the same order
Map<StringName, VariantContainer>::Element *global_prop = props.find(E->key());
RBMap<StringName, VariantContainer>::Element *global_prop = props.find(E->key());
_VCSort vc;
vc.name = E->key();
@ -855,7 +855,7 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust
vclist.insert(vc);
}
Map<String, List<String>> props;
RBMap<String, List<String>> props;
for (Set<_VCSort>::Element *E = vclist.front(); E; E = E->next()) {
String category = E->get().name;
@ -962,7 +962,7 @@ void ProjectSettings::set_custom_property_info(const String &p_prop, const Prope
custom_prop_info[p_prop].name = p_prop;
}
const Map<StringName, PropertyInfo> &ProjectSettings::get_custom_property_info() const {
const RBMap<StringName, PropertyInfo> &ProjectSettings::get_custom_property_info() const {
return custom_prop_info;
}

View File

@ -66,7 +66,7 @@ class ProjectSettings : public Object {
int _dirty_this_frame = 2;
public:
typedef Map<String, Variant> CustomMap;
typedef RBMap<String, Variant> CustomMap;
static const String PROJECT_DATA_DIR_NAME_SUFFIX;
enum {
@ -108,9 +108,9 @@ protected:
int last_order;
int last_builtin_order;
uint64_t last_save_time = 0;
Map<StringName, VariantContainer> props;
RBMap<StringName, VariantContainer> props;
String resource_path;
Map<StringName, PropertyInfo> custom_prop_info;
RBMap<StringName, PropertyInfo> custom_prop_info;
bool using_datapack;
List<String> input_presets;
@ -128,8 +128,8 @@ protected:
Error _load_settings_binary(const String &p_path);
Error _load_settings_text_or_binary(const String &p_text_path, const String &p_bin_path);
Error _save_settings_text(const String &p_file, const Map<String, List<String>> &props, const CustomMap &p_custom = CustomMap(), const String &p_custom_features = String());
Error _save_settings_binary(const String &p_file, const Map<String, List<String>> &props, const CustomMap &p_custom = CustomMap(), const String &p_custom_features = String());
Error _save_settings_text(const String &p_file, const RBMap<String, List<String>> &props, const CustomMap &p_custom = CustomMap(), const String &p_custom_features = String());
Error _save_settings_binary(const String &p_file, const RBMap<String, List<String>> &props, const CustomMap &p_custom = CustomMap(), const String &p_custom_features = String());
Error _save_custom_bnd(const String &p_file);
@ -177,7 +177,7 @@ public:
Error save_custom(const String &p_path = "", const CustomMap &p_custom = CustomMap(), const Vector<String> &p_custom_features = Vector<String>(), bool p_merge_with_current = true);
Error save();
void set_custom_property_info(const String &p_prop, const PropertyInfo &p_info);
const Map<StringName, PropertyInfo> &get_custom_property_info() const;
const RBMap<StringName, PropertyInfo> &get_custom_property_info() const;
uint64_t get_last_saved_time() { return last_save_time; }
Vector<String> get_optimizer_presets() const;

View File

@ -1,677 +0,0 @@
#ifndef MAP_H
#define MAP_H
/*************************************************************************/
/* map.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "core/error/error_macros.h"
#include "core/os/memory.h"
// based on the very nice implementation of rb-trees by:
// https://web.archive.org/web/20120507164830/http://web.mit.edu/~emin/www/source_code/red_black_tree/index.html
template <class K, class V, class C = Comparator<K>, class A = DefaultAllocator>
class Map {
enum Color {
RED,
BLACK
};
struct _Data;
public:
class Element {
private:
friend class Map<K, V, C, A>;
int color;
Element *right;
Element *left;
Element *parent;
Element *_next;
Element *_prev;
K _key;
V _value;
//_Data *data;
public:
const Element *next() const {
return _next;
}
Element *next() {
return _next;
}
const Element *prev() const {
return _prev;
}
Element *prev() {
return _prev;
}
const K &key() const {
return _key;
};
V &value() {
return _value;
};
const V &value() const {
return _value;
};
V &get() {
return _value;
};
const V &get() const {
return _value;
};
Element() {
color = RED;
right = nullptr;
left = nullptr;
parent = nullptr;
_next = nullptr;
_prev = nullptr;
};
};
private:
struct _Data {
Element *_root;
Element *_nil;
int size_cache;
_FORCE_INLINE_ _Data() {
#ifdef GLOBALNIL_DISABLED
_nil = memnew_allocator(Element, A);
_nil->parent = _nil->left = _nil->right = _nil;
_nil->color = BLACK;
#else
_nil = (Element *)&_GlobalNilClass::_nil;
#endif
_root = nullptr;
size_cache = 0;
}
void _create_root() {
_root = memnew_allocator(Element, A);
_root->parent = _root->left = _root->right = _nil;
_root->color = BLACK;
}
void _free_root() {
if (_root) {
memdelete_allocator<Element, A>(_root);
_root = nullptr;
}
}
~_Data() {
_free_root();
#ifdef GLOBALNIL_DISABLED
memdelete_allocator<Element, A>(_nil);
#endif
}
};
_Data _data;
inline void _set_color(Element *p_node, int p_color) {
ERR_FAIL_COND(p_node == _data._nil && p_color == RED);
p_node->color = p_color;
}
inline void _rotate_left(Element *p_node) {
Element *r = p_node->right;
p_node->right = r->left;
if (r->left != _data._nil) {
r->left->parent = p_node;
}
r->parent = p_node->parent;
if (p_node == p_node->parent->left) {
p_node->parent->left = r;
} else {
p_node->parent->right = r;
}
r->left = p_node;
p_node->parent = r;
}
inline void _rotate_right(Element *p_node) {
Element *l = p_node->left;
p_node->left = l->right;
if (l->right != _data._nil) {
l->right->parent = p_node;
}
l->parent = p_node->parent;
if (p_node == p_node->parent->right) {
p_node->parent->right = l;
} else {
p_node->parent->left = l;
}
l->right = p_node;
p_node->parent = l;
}
inline Element *_successor(Element *p_node) const {
Element *node = p_node;
if (node->right != _data._nil) {
node = node->right;
while (node->left != _data._nil) { /* returns the minimum of the right subtree of node */
node = node->left;
}
return node;
} else {
while (node == node->parent->right) {
node = node->parent;
}
if (node->parent == _data._root) {
return nullptr; // No successor, as p_node = last node
}
return node->parent;
}
}
inline Element *_predecessor(Element *p_node) const {
Element *node = p_node;
if (node->left != _data._nil) {
node = node->left;
while (node->right != _data._nil) { /* returns the minimum of the left subtree of node */
node = node->right;
}
return node;
} else {
while (node == node->parent->left) {
node = node->parent;
}
if (node == _data._root) {
return nullptr; // No predecessor, as p_node = first node
}
return node->parent;
}
}
Element *_find(const K &p_key) const {
Element *node = _data._root->left;
C less;
while (node != _data._nil) {
if (less(p_key, node->_key)) {
node = node->left;
} else if (less(node->_key, p_key)) {
node = node->right;
} else {
return node; // found
}
}
return nullptr;
}
Element *_find_closest(const K &p_key) const {
Element *node = _data._root->left;
Element *prev = nullptr;
C less;
while (node != _data._nil) {
prev = node;
if (less(p_key, node->_key)) {
node = node->left;
} else if (less(node->_key, p_key)) {
node = node->right;
} else {
return node; // found
}
}
if (prev == nullptr) {
return nullptr; // tree empty
}
if (less(p_key, prev->_key)) {
prev = prev->_prev;
}
return prev;
}
void _insert_rb_fix(Element *p_new_node) {
Element *node = p_new_node;
Element *nparent = node->parent;
Element *ngrand_parent;
while (nparent->color == RED) {
ngrand_parent = nparent->parent;
if (nparent == ngrand_parent->left) {
if (ngrand_parent->right->color == RED) {
_set_color(nparent, BLACK);
_set_color(ngrand_parent->right, BLACK);
_set_color(ngrand_parent, RED);
node = ngrand_parent;
nparent = node->parent;
} else {
if (node == nparent->right) {
_rotate_left(nparent);
node = nparent;
nparent = node->parent;
}
_set_color(nparent, BLACK);
_set_color(ngrand_parent, RED);
_rotate_right(ngrand_parent);
}
} else {
if (ngrand_parent->left->color == RED) {
_set_color(nparent, BLACK);
_set_color(ngrand_parent->left, BLACK);
_set_color(ngrand_parent, RED);
node = ngrand_parent;
nparent = node->parent;
} else {
if (node == nparent->left) {
_rotate_right(nparent);
node = nparent;
nparent = node->parent;
}
_set_color(nparent, BLACK);
_set_color(ngrand_parent, RED);
_rotate_left(ngrand_parent);
}
}
}
_set_color(_data._root->left, BLACK);
}
Element *_insert(const K &p_key, const V &p_value) {
Element *new_parent = _data._root;
Element *node = _data._root->left;
C less;
while (node != _data._nil) {
new_parent = node;
if (less(p_key, node->_key)) {
node = node->left;
} else if (less(node->_key, p_key)) {
node = node->right;
} else {
node->_value = p_value;
return node; // Return existing node with new value
}
}
Element *new_node = memnew_allocator(Element, A);
new_node->parent = new_parent;
new_node->right = _data._nil;
new_node->left = _data._nil;
new_node->_key = p_key;
new_node->_value = p_value;
//new_node->data=_data;
if (new_parent == _data._root || less(p_key, new_parent->_key)) {
new_parent->left = new_node;
} else {
new_parent->right = new_node;
}
new_node->_next = _successor(new_node);
new_node->_prev = _predecessor(new_node);
if (new_node->_next) {
new_node->_next->_prev = new_node;
}
if (new_node->_prev) {
new_node->_prev->_next = new_node;
}
_data.size_cache++;
_insert_rb_fix(new_node);
return new_node;
}
void _erase_fix_rb(Element *p_node) {
Element *root = _data._root->left;
Element *node = _data._nil;
Element *sibling = p_node;
Element *parent = sibling->parent;
while (node != root) { // If red node found, will exit at a break
if (sibling->color == RED) {
_set_color(sibling, BLACK);
_set_color(parent, RED);
if (sibling == parent->right) {
sibling = sibling->left;
_rotate_left(parent);
} else {
sibling = sibling->right;
_rotate_right(parent);
}
}
if ((sibling->left->color == BLACK) && (sibling->right->color == BLACK)) {
_set_color(sibling, RED);
if (parent->color == RED) {
_set_color(parent, BLACK);
break;
} else { // loop: haven't found any red nodes yet
node = parent;
parent = node->parent;
sibling = (node == parent->left) ? parent->right : parent->left;
}
} else {
if (sibling == parent->right) {
if (sibling->right->color == BLACK) {
_set_color(sibling->left, BLACK);
_set_color(sibling, RED);
_rotate_right(sibling);
sibling = sibling->parent;
}
_set_color(sibling, parent->color);
_set_color(parent, BLACK);
_set_color(sibling->right, BLACK);
_rotate_left(parent);
break;
} else {
if (sibling->left->color == BLACK) {
_set_color(sibling->right, BLACK);
_set_color(sibling, RED);
_rotate_left(sibling);
sibling = sibling->parent;
}
_set_color(sibling, parent->color);
_set_color(parent, BLACK);
_set_color(sibling->left, BLACK);
_rotate_right(parent);
break;
}
}
}
ERR_FAIL_COND(_data._nil->color != BLACK);
}
void _erase(Element *p_node) {
Element *rp = ((p_node->left == _data._nil) || (p_node->right == _data._nil)) ? p_node : p_node->_next;
Element *node = (rp->left == _data._nil) ? rp->right : rp->left;
Element *sibling;
if (rp == rp->parent->left) {
rp->parent->left = node;
sibling = rp->parent->right;
} else {
rp->parent->right = node;
sibling = rp->parent->left;
}
if (node->color == RED) {
node->parent = rp->parent;
_set_color(node, BLACK);
} else if (rp->color == BLACK && rp->parent != _data._root) {
_erase_fix_rb(sibling);
}
if (rp != p_node) {
ERR_FAIL_COND(rp == _data._nil);
rp->left = p_node->left;
rp->right = p_node->right;
rp->parent = p_node->parent;
rp->color = p_node->color;
if (p_node->left != _data._nil) {
p_node->left->parent = rp;
}
if (p_node->right != _data._nil) {
p_node->right->parent = rp;
}
if (p_node == p_node->parent->left) {
p_node->parent->left = rp;
} else {
p_node->parent->right = rp;
}
}
if (p_node->_next) {
p_node->_next->_prev = p_node->_prev;
}
if (p_node->_prev) {
p_node->_prev->_next = p_node->_next;
}
memdelete_allocator<Element, A>(p_node);
_data.size_cache--;
ERR_FAIL_COND(_data._nil->color == RED);
}
void _calculate_depth(Element *p_element, int &max_d, int d) const {
if (p_element == _data._nil) {
return;
}
_calculate_depth(p_element->left, max_d, d + 1);
_calculate_depth(p_element->right, max_d, d + 1);
if (d > max_d) {
max_d = d;
}
}
void _cleanup_tree(Element *p_element) {
if (p_element == _data._nil) {
return;
}
_cleanup_tree(p_element->left);
_cleanup_tree(p_element->right);
memdelete_allocator<Element, A>(p_element);
}
void _copy_from(const Map &p_map) {
clear();
// not the fastest way, but safeset to write.
for (Element *I = p_map.front(); I; I = I->next()) {
insert(I->key(), I->value());
}
}
public:
const Element *find(const K &p_key) const {
if (!_data._root) {
return nullptr;
}
const Element *res = _find(p_key);
return res;
}
Element *find(const K &p_key) {
if (!_data._root) {
return nullptr;
}
Element *res = _find(p_key);
return res;
}
const Element *find_closest(const K &p_key) const {
if (!_data._root) {
return NULL;
}
const Element *res = _find_closest(p_key);
return res;
}
Element *find_closest(const K &p_key) {
if (!_data._root) {
return nullptr;
}
Element *res = _find_closest(p_key);
return res;
}
bool has(const K &p_key) const {
return find(p_key) != nullptr;
}
Element *insert(const K &p_key, const V &p_value) {
if (!_data._root) {
_data._create_root();
}
return _insert(p_key, p_value);
}
void erase(Element *p_element) {
if (!_data._root || !p_element) {
return;
}
_erase(p_element);
if (_data.size_cache == 0 && _data._root) {
_data._free_root();
}
}
bool erase(const K &p_key) {
if (!_data._root) {
return false;
}
Element *e = find(p_key);
if (!e) {
return false;
}
_erase(e);
if (_data.size_cache == 0 && _data._root) {
_data._free_root();
}
return true;
}
const V &operator[](const K &p_key) const {
CRASH_COND(!_data._root);
const Element *e = find(p_key);
CRASH_COND(!e);
return e->_value;
}
V &operator[](const K &p_key) {
if (!_data._root) {
_data._create_root();
}
Element *e = find(p_key);
if (!e) {
e = insert(p_key, V());
}
return e->_value;
}
Element *front() const {
if (!_data._root) {
return nullptr;
}
Element *e = _data._root->left;
if (e == _data._nil) {
return nullptr;
}
while (e->left != _data._nil) {
e = e->left;
}
return e;
}
Element *back() const {
if (!_data._root) {
return nullptr;
}
Element *e = _data._root->left;
if (e == _data._nil) {
return nullptr;
}
while (e->right != _data._nil) {
e = e->right;
}
return e;
}
inline bool empty() const { return _data.size_cache == 0; }
inline int size() const { return _data.size_cache; }
int calculate_depth() const {
// used for debug mostly
if (!_data._root) {
return 0;
}
int max_d = 0;
_calculate_depth(_data._root->left, max_d, 0);
return max_d;
}
void clear() {
if (!_data._root) {
return;
}
_cleanup_tree(_data._root->left);
_data._root->left = _data._nil;
_data.size_cache = 0;
_data._free_root();
}
void operator=(const Map &p_map) {
_copy_from(p_map);
}
Map(const Map &p_map) {
_copy_from(p_map);
}
_FORCE_INLINE_ Map() {
}
~Map() {
clear();
}
};
#endif

View File

@ -207,7 +207,7 @@ Variant PackedDataContainer::_key_at_ofs(uint32_t p_ofs, const Variant &p_key, b
}
}
uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector<uint8_t> &tmpdata, Map<String, uint32_t> &string_cache) {
uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector<uint8_t> &tmpdata, RBMap<String, uint32_t> &string_cache) {
switch (p_data.get_type()) {
case Variant::STRING: {
String s = p_data;
@ -316,7 +316,7 @@ uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector<uint8_t> &tmpd
Error PackedDataContainer::pack(const Variant &p_data) {
Vector<uint8_t> tmpdata;
Map<String, uint32_t> string_cache;
RBMap<String, uint32_t> string_cache;
_pack(p_data, tmpdata, string_cache);
datalen = tmpdata.size();
data.resize(tmpdata.size());

View File

@ -49,7 +49,7 @@ class PackedDataContainer : public Resource {
PoolVector<uint8_t> data;
int datalen;
uint32_t _pack(const Variant &p_data, Vector<uint8_t> &tmpdata, Map<String, uint32_t> &string_cache);
uint32_t _pack(const Variant &p_data, Vector<uint8_t> &tmpdata, RBMap<String, uint32_t> &string_cache);
Variant _iter_init_ofs(const Array &p_iter, uint32_t p_offset);
Variant _iter_next_ofs(const Array &p_iter, uint32_t p_offset);

View File

@ -1,5 +1,8 @@
#ifndef RB_MAP_H
#define RB_MAP_H
/*************************************************************************/
/* rb_map.h */
/* map.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@ -28,15 +31,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef RB_MAP_H
#define RB_MAP_H
#include "core/error/error_macros.h"
#include "core/os/memory.h"
#include "core/containers/pair.h"
// based on the very nice implementation of rb-trees by:
// https://web.archive.org/web/20120507164830/https://web.mit.edu/~emin/www/source_code/red_black_tree/index.html
// https://web.archive.org/web/20120507164830/http://web.mit.edu/~emin/www/source_code/red_black_tree/index.html
template <class K, class V, class C = Comparator<K>, class A = DefaultAllocator>
class RBMap {
@ -50,18 +49,17 @@ public:
class Element {
private:
friend class RBMap<K, V, C, A>;
int color = RED;
Element *right = nullptr;
Element *left = nullptr;
Element *parent = nullptr;
Element *_next = nullptr;
Element *_prev = nullptr;
KeyValue<K, V> _data;
int color;
Element *right;
Element *left;
Element *parent;
Element *_next;
Element *_prev;
K _key;
V _value;
//_Data *data;
public:
KeyValue<K, V> &key_value() { return _data; }
const KeyValue<K, V> &key_value() const { return _data; }
const Element *next() const {
return _next;
}
@ -75,115 +73,35 @@ public:
return _prev;
}
const K &key() const {
return _data.key;
}
return _key;
};
V &value() {
return _data.value;
}
return _value;
};
const V &value() const {
return _data.value;
}
return _value;
};
V &get() {
return _data.value;
}
return _value;
};
const V &get() const {
return _data.value;
}
Element(const KeyValue<K, V> &p_data) :
_data(p_data) {}
return _value;
};
Element() {
color = RED;
right = nullptr;
left = nullptr;
parent = nullptr;
_next = nullptr;
_prev = nullptr;
};
};
typedef KeyValue<K, V> ValueType;
struct Iterator {
_FORCE_INLINE_ KeyValue<K, V> &operator*() const {
return E->key_value();
}
_FORCE_INLINE_ KeyValue<K, V> *operator->() const { return &E->key_value(); }
_FORCE_INLINE_ Iterator &operator++() {
E = E->next();
return *this;
}
_FORCE_INLINE_ Iterator &operator--() {
E = E->prev();
return *this;
}
_FORCE_INLINE_ bool operator==(const Iterator &b) const { return E == b.E; }
_FORCE_INLINE_ bool operator!=(const Iterator &b) const { return E != b.E; }
explicit operator bool() const {
return E != nullptr;
}
Iterator(Element *p_E) { E = p_E; }
Iterator() {}
Iterator(const Iterator &p_it) { E = p_it.E; }
private:
Element *E = nullptr;
};
struct ConstIterator {
_FORCE_INLINE_ const KeyValue<K, V> &operator*() const {
return E->key_value();
}
_FORCE_INLINE_ const KeyValue<K, V> *operator->() const { return &E->key_value(); }
_FORCE_INLINE_ ConstIterator &operator++() {
E = E->next();
return *this;
}
_FORCE_INLINE_ ConstIterator &operator--() {
E = E->prev();
return *this;
}
_FORCE_INLINE_ bool operator==(const ConstIterator &b) const { return E == b.E; }
_FORCE_INLINE_ bool operator!=(const ConstIterator &b) const { return E != b.E; }
explicit operator bool() const {
return E != nullptr;
}
ConstIterator(const Element *p_E) { E = p_E; }
ConstIterator() {}
ConstIterator(const ConstIterator &p_it) { E = p_it.E; }
private:
const Element *E = nullptr;
};
_FORCE_INLINE_ Iterator begin() {
return Iterator(front());
}
_FORCE_INLINE_ Iterator end() {
return Iterator(nullptr);
}
#if 0
//to use when replacing find()
_FORCE_INLINE_ Iterator find(const K &p_key) {
return Iterator(find(p_key));
}
#endif
_FORCE_INLINE_ void remove(const Iterator &p_iter) {
return erase(p_iter.E);
}
_FORCE_INLINE_ ConstIterator begin() const {
return ConstIterator(front());
}
_FORCE_INLINE_ ConstIterator end() const {
return ConstIterator(nullptr);
}
#if 0
//to use when replacing find()
_FORCE_INLINE_ ConstIterator find(const K &p_key) const {
return ConstIterator(find(p_key));
}
#endif
private:
struct _Data {
Element *_root = nullptr;
Element *_nil = nullptr;
int size_cache = 0;
Element *_root;
Element *_nil;
int size_cache;
_FORCE_INLINE_ _Data() {
#ifdef GLOBALNIL_DISABLED
@ -193,10 +111,12 @@ private:
#else
_nil = (Element *)&_GlobalNilClass::_nil;
#endif
_root = nullptr;
size_cache = 0;
}
void _create_root() {
_root = memnew_allocator(Element(KeyValue<K, V>(K(), V())), A);
_root = memnew_allocator(Element, A);
_root->parent = _root->left = _root->right = _nil;
_root->color = BLACK;
}
@ -305,9 +225,9 @@ private:
C less;
while (node != _data._nil) {
if (less(p_key, node->_data.key)) {
if (less(p_key, node->_key)) {
node = node->left;
} else if (less(node->_data.key, p_key)) {
} else if (less(node->_key, p_key)) {
node = node->right;
} else {
return node; // found
@ -325,9 +245,9 @@ private:
while (node != _data._nil) {
prev = node;
if (less(p_key, node->_data.key)) {
if (less(p_key, node->_key)) {
node = node->left;
} else if (less(node->_data.key, p_key)) {
} else if (less(node->_key, p_key)) {
node = node->right;
} else {
return node; // found
@ -338,7 +258,7 @@ private:
return nullptr; // tree empty
}
if (less(p_key, prev->_data.key)) {
if (less(p_key, prev->_key)) {
prev = prev->_prev;
}
@ -348,7 +268,7 @@ private:
void _insert_rb_fix(Element *p_new_node) {
Element *node = p_new_node;
Element *nparent = node->parent;
Element *ngrand_parent = nullptr;
Element *ngrand_parent;
while (nparent->color == RED) {
ngrand_parent = nparent->parent;
@ -401,25 +321,25 @@ private:
while (node != _data._nil) {
new_parent = node;
if (less(p_key, node->_data.key)) {
if (less(p_key, node->_key)) {
node = node->left;
} else if (less(node->_data.key, p_key)) {
} else if (less(node->_key, p_key)) {
node = node->right;
} else {
node->_data.value = p_value;
node->_value = p_value;
return node; // Return existing node with new value
}
}
typedef KeyValue<K, V> KV;
Element *new_node = memnew_allocator(Element(KV(p_key, p_value)), A);
Element *new_node = memnew_allocator(Element, A);
new_node->parent = new_parent;
new_node->right = _data._nil;
new_node->left = _data._nil;
new_node->_key = p_key;
new_node->_value = p_value;
//new_node->data=_data;
if (new_parent == _data._root || less(p_key, new_parent->_data.key)) {
if (new_parent == _data._root || less(p_key, new_parent->_key)) {
new_parent->left = new_node;
} else {
new_parent->right = new_node;
@ -504,7 +424,7 @@ private:
Element *rp = ((p_node->left == _data._nil) || (p_node->right == _data._nil)) ? p_node : p_node->_next;
Element *node = (rp->left == _data._nil) ? rp->right : rp->left;
Element *sibling = nullptr;
Element *sibling;
if (rp == rp->parent->left) {
rp->parent->left = node;
sibling = rp->parent->right;
@ -605,7 +525,7 @@ public:
const Element *find_closest(const K &p_key) const {
if (!_data._root) {
return nullptr;
return NULL;
}
const Element *res = _find_closest(p_key);
@ -664,7 +584,7 @@ public:
CRASH_COND(!_data._root);
const Element *e = find(p_key);
CRASH_COND(!e);
return e->_data.value;
return e->_value;
}
V &operator[](const K &p_key) {
@ -677,7 +597,7 @@ public:
e = insert(p_key, V());
}
return e->_data.value;
return e->_value;
}
Element *front() const {
@ -714,12 +634,8 @@ public:
return e;
}
inline bool is_empty() const {
return _data.size_cache == 0;
}
inline int size() const {
return _data.size_cache;
}
inline bool empty() const { return _data.size_cache == 0; }
inline int size() const { return _data.size_cache; }
int calculate_depth() const {
// used for debug mostly
@ -751,11 +667,12 @@ public:
_copy_from(p_map);
}
_FORCE_INLINE_ RBMap() {}
_FORCE_INLINE_ RBMap() {
}
~RBMap() {
clear();
}
};
#endif // RB_MAP_H
#endif

View File

@ -118,7 +118,7 @@ List<StringName> InputMap::get_actions() const {
return actions;
}
for (Map<StringName, Action>::Element *E = input_map.front(); E; E = E->next()) {
for (RBMap<StringName, Action>::Element *E = input_map.front(); E; E = E->next()) {
actions.push_back(E->key());
}
@ -209,7 +209,7 @@ Array InputMap::_get_action_list(const StringName &p_action) {
}
const List<Ref<InputEvent>> *InputMap::get_action_list(const StringName &p_action) {
const Map<StringName, Action>::Element *E = input_map.find(p_action);
const RBMap<StringName, Action>::Element *E = input_map.find(p_action);
if (!E) {
return nullptr;
}
@ -222,7 +222,7 @@ bool InputMap::event_is_action(const Ref<InputEvent> &p_event, const StringName
}
bool InputMap::event_get_action_status(const Ref<InputEvent> &p_event, const StringName &p_action, bool p_exact_match, bool *p_pressed, float *p_strength, float *p_raw_strength) const {
Map<StringName, Action>::Element *E = input_map.find(p_action);
RBMap<StringName, Action>::Element *E = input_map.find(p_action);
ERR_FAIL_COND_V_MSG(!E, false, suggest_actions(p_action));
Ref<InputEventAction> input_event_action = p_event;
@ -257,7 +257,7 @@ bool InputMap::event_get_action_status(const Ref<InputEvent> &p_event, const Str
}
}
const Map<StringName, InputMap::Action> &InputMap::get_action_map() const {
const RBMap<StringName, InputMap::Action> &InputMap::get_action_map() const {
return input_map;
}

View File

@ -51,7 +51,7 @@ public:
private:
static InputMap *singleton;
mutable Map<StringName, Action> input_map;
mutable RBMap<StringName, Action> input_map;
List<Ref<InputEvent>>::Element *_find_event(Action &p_action, const Ref<InputEvent> &p_event, bool p_exact_match = false, bool *p_pressed = nullptr, float *p_strength = nullptr, float *p_raw_strength = nullptr) const;
@ -80,7 +80,7 @@ public:
bool event_is_action(const Ref<InputEvent> &p_event, const StringName &p_action, bool p_exact_match = false) const;
bool event_get_action_status(const Ref<InputEvent> &p_event, const StringName &p_action, bool p_exact_match = false, bool *p_pressed = nullptr, float *p_strength = nullptr, float *p_raw_strength = nullptr) const;
const Map<StringName, Action> &get_action_map() const;
const RBMap<StringName, Action> &get_action_map() const;
void load_from_globals();
void load_default();

View File

@ -30,15 +30,15 @@
#include "file_access_memory.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/os/dir_access.h"
#include "core/config/project_settings.h"
static Map<String, Vector<uint8_t>> *files = nullptr;
static RBMap<String, Vector<uint8_t>> *files = nullptr;
void FileAccessMemory::register_file(String p_name, Vector<uint8_t> p_data) {
if (!files) {
files = memnew((Map<String, Vector<uint8_t>>));
files = memnew((RBMap<String, Vector<uint8_t>>));
}
String name;
@ -84,7 +84,7 @@ Error FileAccessMemory::_open(const String &p_path, int p_mode_flags) {
String name = fix_path(p_path);
//name = DirAccess::normalize_path(name);
Map<String, Vector<uint8_t>>::Element *E = files->find(name);
RBMap<String, Vector<uint8_t>>::Element *E = files->find(name);
ERR_FAIL_COND_V_MSG(!E, ERR_FILE_NOT_FOUND, "Can't find file '" + p_path + "'.");
data = E->get().ptrw();

View File

@ -51,7 +51,7 @@ class FileAccessNetworkClient {
bool quit;
Mutex mutex;
Mutex blockrequest_mutex;
Map<int, FileAccessNetwork *> accesses;
RBMap<int, FileAccessNetwork *> accesses;
Ref<StreamPeerTCP> client;
int32_t last_id;

View File

@ -110,7 +110,7 @@ PackedData::PackedData() {
}
void PackedData::_free_packed_dirs(PackedDir *p_dir) {
for (Map<String, PackedDir *>::Element *E = p_dir->subdirs.front(); E; E = E->next()) {
for (RBMap<String, PackedDir *>::Element *E = p_dir->subdirs.front(); E; E = E->next()) {
_free_packed_dirs(E->get());
}
memdelete(p_dir);
@ -378,7 +378,7 @@ Error DirAccessPack::list_dir_begin() {
list_dirs.clear();
list_files.clear();
for (Map<String, PackedData::PackedDir *>::Element *E = current->subdirs.front(); E; E = E->next()) {
for (RBMap<String, PackedData::PackedDir *>::Element *E = current->subdirs.front(); E; E = E->next()) {
list_dirs.push_back(E->key());
}

View File

@ -31,7 +31,7 @@
/*************************************************************************/
#include "core/containers/list.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/os/dir_access.h"
#include "core/os/file_access.h"
#include "core/string/print_string.h"
@ -63,7 +63,7 @@ private:
struct PackedDir {
PackedDir *parent;
String name;
Map<String, PackedDir *> subdirs;
RBMap<String, PackedDir *> subdirs;
Set<String> files;
};
@ -97,7 +97,7 @@ private:
};
};
Map<PathMD5, PackedFile> files;
RBMap<PathMD5, PackedFile> files;
Vector<PackSource *> sources;
@ -185,7 +185,7 @@ public:
FileAccess *PackedData::try_open_path(const String &p_path) {
PathMD5 pmd5(p_path.md5_buffer());
Map<PathMD5, PackedFile>::Element *E = files.find(pmd5);
RBMap<PathMD5, PackedFile>::Element *E = files.find(pmd5);
if (!E) {
return nullptr; //not found
}

View File

@ -33,7 +33,7 @@
#ifdef MINIZIP_ENABLED
#include "core/io/file_access_pack.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "thirdparty/minizip/unzip.h"
@ -56,7 +56,7 @@ private:
};
Vector<Package> packages;
Map<String, File> files;
RBMap<String, File> files;
static ZipArchive *instance;

View File

@ -267,9 +267,9 @@ Array IP::_get_local_addresses() const {
Array IP::_get_local_interfaces() const {
Array results;
Map<String, Interface_Info> interfaces;
RBMap<String, Interface_Info> interfaces;
get_local_interfaces(&interfaces);
for (Map<String, Interface_Info>::Element *E = interfaces.front(); E; E = E->next()) {
for (RBMap<String, Interface_Info>::Element *E = interfaces.front(); E; E = E->next()) {
Interface_Info &c = E->get();
Dictionary rc;
rc["name"] = c.name;
@ -289,9 +289,9 @@ Array IP::_get_local_interfaces() const {
}
void IP::get_local_addresses(List<IP_Address> *r_addresses) const {
Map<String, Interface_Info> interfaces;
RBMap<String, Interface_Info> interfaces;
get_local_interfaces(&interfaces);
for (Map<String, Interface_Info>::Element *E = interfaces.front(); E; E = E->next()) {
for (RBMap<String, Interface_Info>::Element *E = interfaces.front(); E; E = E->next()) {
for (const List<IP_Address>::Element *F = E->get().ip_addresses.front(); F; F = F->next()) {
r_addresses->push_front(F->get());
}

View File

@ -93,7 +93,7 @@ public:
virtual void _resolve_hostname(List<IP_Address> &r_addresses, const String &p_hostname, Type p_type = TYPE_ANY) const = 0;
Array get_resolve_item_addresses(ResolverID p_id) const;
virtual void get_local_interfaces(Map<String, Interface_Info> *r_interfaces) const = 0;
virtual void get_local_interfaces(RBMap<String, Interface_Info> *r_interfaces) const = 0;
void erase_resolve_item(ResolverID p_id);
void clear_cache(const String &p_hostname = "");

View File

@ -246,10 +246,10 @@ Node *MultiplayerAPI::_process_get_node(int p_from, const uint8_t *p_packet, int
// Use cached path.
int id = target;
Map<int, PathGetCache>::Element *E = path_get_cache.find(p_from);
RBMap<int, PathGetCache>::Element *E = path_get_cache.find(p_from);
ERR_FAIL_COND_V_MSG(!E, nullptr, "Invalid packet received. Requests invalid peer cache.");
Map<int, PathGetCache::NodeInfo>::Element *F = E->get().nodes.find(id);
RBMap<int, PathGetCache::NodeInfo>::Element *F = E->get().nodes.find(id);
ERR_FAIL_COND_V_MSG(!F, nullptr, "Invalid packet received. Unabled to find requested cached node.");
PathGetCache::NodeInfo *ni = &F->get();
@ -267,7 +267,7 @@ void MultiplayerAPI::_process_rpc(Node *p_node, const StringName &p_name, int p_
// Check that remote can call the RPC on this node.
RPCMode rpc_mode = RPC_MODE_DISABLED;
const Map<StringName, RPCMode>::Element *E = p_node->get_node_rpc_mode(p_name);
const RBMap<StringName, RPCMode>::Element *E = p_node->get_node_rpc_mode(p_name);
if (E) {
rpc_mode = E->get();
}
@ -357,7 +357,7 @@ void MultiplayerAPI::_process_confirm_path(int p_from, const uint8_t *p_packet,
PathSentCache *psc = path_send_cache.getptr(path);
ERR_FAIL_COND_MSG(!psc, "Invalid packet received. Tries to confirm a path which was not found in cache.");
Map<int, bool>::Element *E = psc->confirmed_peers.find(p_from);
RBMap<int, bool>::Element *E = psc->confirmed_peers.find(p_from);
ERR_FAIL_COND_MSG(!E, "Invalid packet received. Source peer was not found in cache for the given path.");
E->get() = true;
}
@ -375,7 +375,7 @@ bool MultiplayerAPI::_send_confirm_path(NodePath p_path, PathSentCache *psc, int
continue; // Continue, not for this peer.
}
Map<int, bool>::Element *F = psc->confirmed_peers.find(E->get());
RBMap<int, bool>::Element *F = psc->confirmed_peers.find(E->get());
if (!F || !F->get()) {
// Path was not cached, or was cached but is unconfirmed.
@ -512,7 +512,7 @@ void MultiplayerAPI::_send_rpc(Node *p_from, int p_to, bool p_unreliable, const
continue; // Continue, not for this peer.
}
Map<int, bool>::Element *F = psc->confirmed_peers.find(E->get());
RBMap<int, bool>::Element *F = psc->confirmed_peers.find(E->get());
ERR_CONTINUE(!F); // Should never happen.
network_peer->set_target_peer(E->get()); // To this one specifically.
@ -576,7 +576,7 @@ void MultiplayerAPI::rpcp(Node *p_node, int p_peer_id, bool p_unreliable, const
if (p_peer_id == 0 || p_peer_id == node_id || (p_peer_id < 0 && p_peer_id != -node_id)) {
// Check that send mode can use local call.
const Map<StringName, RPCMode>::Element *E = p_node->get_node_rpc_mode(p_method);
const RBMap<StringName, RPCMode>::Element *E = p_node->get_node_rpc_mode(p_method);
if (E) {
call_local = _should_call_local(E->get(), is_master, skip_rpc);
}
@ -708,7 +708,7 @@ void MultiplayerAPI::profiling_end() {
int MultiplayerAPI::get_profiling_frame(ProfilingInfo *r_info) {
int i = 0;
#ifdef DEBUG_ENABLED
for (Map<ObjectID, ProfilingInfo>::Element *E = profiler_frame_data.front(); E; E = E->next()) {
for (RBMap<ObjectID, ProfilingInfo>::Element *E = profiler_frame_data.front(); E; E = E->next()) {
r_info[i] = E->get();
++i;
}

View File

@ -49,7 +49,7 @@ public:
private:
//path sent caches
struct PathSentCache {
Map<int, bool> confirmed_peers;
RBMap<int, bool> confirmed_peers;
int id;
};
@ -60,7 +60,7 @@ private:
ObjectID instance;
};
Map<int, NodeInfo> nodes;
RBMap<int, NodeInfo> nodes;
};
#ifdef DEBUG_ENABLED
@ -73,7 +73,7 @@ private:
Vector<BandwidthFrame> bandwidth_incoming_data;
int bandwidth_outgoing_pointer;
Vector<BandwidthFrame> bandwidth_outgoing_data;
Map<ObjectID, ProfilingInfo> profiler_frame_data;
RBMap<ObjectID, ProfilingInfo> profiler_frame_data;
bool profiling;
void _init_node_profile(ObjectID p_node);
@ -84,7 +84,7 @@ private:
int rpc_sender_id;
Set<int> connected_peers;
HashMap<NodePath, PathSentCache> path_send_cache;
Map<int, PathGetCache> path_get_cache;
RBMap<int, PathGetCache> path_get_cache;
int last_send_cache_id;
Vector<uint8_t> packet_cache;
Node *root_node;

View File

@ -1093,7 +1093,7 @@ void ResourceFormatLoaderBinary::get_dependencies(const String &p_path, List<Str
ria->get_dependencies(f, p_dependencies, p_add_types);
}
Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, const Map<String, String> &p_map) {
Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, const RBMap<String, String> &p_map) {
//Error error=OK;
FileAccess *f = FileAccess::open(p_path, FileAccess::READ);
@ -1325,7 +1325,7 @@ void ResourceFormatSaverBinaryInstance::_write_variant(const Variant &p_property
write_variant(f, p_property, resource_set, external_resources, string_map, p_hint);
}
void ResourceFormatSaverBinaryInstance::write_variant(FileAccess *f, const Variant &p_property, Set<RES> &resource_set, Map<RES, int> &external_resources, Map<StringName, int> &string_map, const PropertyInfo &p_hint) {
void ResourceFormatSaverBinaryInstance::write_variant(FileAccess *f, const Variant &p_property, Set<RES> &resource_set, RBMap<RES, int> &external_resources, RBMap<StringName, int> &string_map, const PropertyInfo &p_hint) {
switch (p_property.get_type()) {
case Variant::NIL: {
f->store_32(VARIANT_NIL);
@ -1986,7 +1986,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const RES &p
Vector<RES> save_order;
save_order.resize(external_resources.size());
for (Map<RES, int>::Element *E = external_resources.front(); E; E = E->next()) {
for (RBMap<RES, int>::Element *E = external_resources.front(); E; E = E->next()) {
save_order.write[E->get()] = E->key();
}

View File

@ -49,7 +49,7 @@ class ResourceInteractiveLoaderBinary : public ResourceInteractiveLoader {
Vector<char> str_buf;
List<RES> resource_cache;
//Map<int,StringName> string_map;
//RBMap<int,StringName> string_map;
Vector<StringName> string_map;
StringName _get_string();
@ -71,7 +71,7 @@ class ResourceInteractiveLoaderBinary : public ResourceInteractiveLoader {
String get_unicode_string();
void _advance_padding(uint32_t p_len);
Map<String, String> remaps;
RBMap<String, String> remaps;
Error error;
int stage;
@ -88,7 +88,7 @@ public:
virtual int get_stage_count() const;
virtual void set_translation_remapped(bool p_remapped);
void set_remaps(const Map<String, String> &p_remaps) { remaps = p_remaps; }
void set_remaps(const RBMap<String, String> &p_remaps) { remaps = p_remaps; }
void open(FileAccess *p_f);
String recognize(FileAccess *p_f);
void get_dependencies(FileAccess *p_f, List<String> *p_dependencies, bool p_add_types);
@ -105,7 +105,7 @@ public:
virtual bool handles_type(const String &p_type) const;
virtual String get_resource_type(const String &p_path) const;
virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false);
virtual Error rename_dependencies(const String &p_path, const Map<String, String> &p_map);
virtual Error rename_dependencies(const String &p_path, const RBMap<String, String> &p_map);
};
class ResourceFormatSaverBinaryInstance {
@ -127,11 +127,11 @@ class ResourceFormatSaverBinaryInstance {
bool operator<(const NonPersistentKey &p_key) const { return base == p_key.base ? property < p_key.property : base < p_key.base; }
};
Map<NonPersistentKey, RES> non_persistent_map;
Map<StringName, int> string_map;
RBMap<NonPersistentKey, RES> non_persistent_map;
RBMap<StringName, int> string_map;
Vector<StringName> strings;
Map<RES, int> external_resources;
RBMap<RES, int> external_resources;
List<RES> saved_resources;
struct Property {
@ -153,7 +153,7 @@ class ResourceFormatSaverBinaryInstance {
public:
Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0);
static void write_variant(FileAccess *f, const Variant &p_property, Set<RES> &resource_set, Map<RES, int> &external_resources, Map<StringName, int> &string_map, const PropertyInfo &p_hint = PropertyInfo());
static void write_variant(FileAccess *f, const Variant &p_property, Set<RES> &resource_set, RBMap<RES, int> &external_resources, RBMap<StringName, int> &string_map, const PropertyInfo &p_hint = PropertyInfo());
};
class ResourceFormatSaverBinary : public ResourceFormatSaver {

View File

@ -126,12 +126,12 @@ public:
virtual String get_preset_name(int p_idx) const { return String(); }
virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const = 0;
virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const = 0;
virtual bool get_option_visibility(const String &p_option, const RBMap<StringName, Variant> &p_options) const = 0;
virtual String get_option_group_file() const { return String(); }
virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr) = 0;
virtual Error import(const String &p_source_file, const String &p_save_path, const RBMap<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr) = 0;
virtual Error import_group_file(const String &p_group_file, const Map<String, Map<StringName, Variant>> &p_source_file_options, const Map<String, String> &p_base_paths) { return ERR_UNAVAILABLE; }
virtual Error import_group_file(const String &p_group_file, const RBMap<String, RBMap<StringName, Variant>> &p_source_file_options, const RBMap<String, String> &p_base_paths) { return ERR_UNAVAILABLE; }
virtual bool are_import_settings_valid(const String &p_path) const { return true; }
virtual String get_import_settings_string() const { return String(); }
};

View File

@ -219,10 +219,10 @@ void ResourceFormatLoader::get_dependencies(const String &p_path, List<String> *
}
}
Error ResourceFormatLoader::rename_dependencies(const String &p_path, const Map<String, String> &p_map) {
Error ResourceFormatLoader::rename_dependencies(const String &p_path, const RBMap<String, String> &p_map) {
if (get_script_instance() && get_script_instance()->has_method("rename_dependencies")) {
Dictionary deps_dict;
for (Map<String, String>::Element *E = p_map.front(); E; E = E->next()) {
for (RBMap<String, String>::Element *E = p_map.front(); E; E = E->next()) {
deps_dict[E->key()] = E->value();
}
@ -668,7 +668,7 @@ void ResourceLoader::get_dependencies(const String &p_path, List<String> *p_depe
}
}
Error ResourceLoader::rename_dependencies(const String &p_path, const Map<String, String> &p_map) {
Error ResourceLoader::rename_dependencies(const String &p_path, const RBMap<String, String> &p_map) {
String path = _path_remap(p_path);
String local_path;

View File

@ -71,7 +71,7 @@ public:
virtual bool handles_type(const String &p_type) const;
virtual String get_resource_type(const String &p_path) const;
virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false);
virtual Error rename_dependencies(const String &p_path, const Map<String, String> &p_map);
virtual Error rename_dependencies(const String &p_path, const RBMap<String, String> &p_map);
virtual bool is_import_valid(const String &p_path) const { return true; }
virtual bool is_imported(const String &p_path) const { return false; }
virtual int get_import_order(const String &p_path) const { return 0; }
@ -146,7 +146,7 @@ public:
static void remove_resource_format_loader(Ref<ResourceFormatLoader> p_format_loader);
static String get_resource_type(const String &p_path);
static void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false);
static Error rename_dependencies(const String &p_path, const Map<String, String> &p_map);
static Error rename_dependencies(const String &p_path, const RBMap<String, String> &p_map);
static bool is_import_valid(const String &p_path);
static String get_import_group_file(const String &p_path);
static bool is_imported(const String &p_path);

View File

@ -31,7 +31,7 @@
#include "color.h"
#include "core/math/color_names.inc"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/math/math_funcs.h"
#include "core/string/print_string.h"
@ -412,7 +412,7 @@ Color Color::named(const String &p_name) {
name = name.replace(".", "");
name = name.to_lower();
const Map<String, Color>::Element *color = _named_colors.find(name);
const RBMap<String, Color>::Element *color = _named_colors.find(name);
ERR_FAIL_NULL_V_MSG(color, Color(), "Invalid color name: " + p_name + ".");
return color->value();
}

View File

@ -1,7 +1,7 @@
// Names from https://en.wikipedia.org/wiki/X11_color_names
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
static Map<String, Color> _named_colors;
static RBMap<String, Color> _named_colors;
static void _populate_named_colors() {
if (!_named_colors.empty()) {
return;

View File

@ -30,7 +30,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/containers/vector.h"
/**
@ -46,7 +46,7 @@ class DisjointSet {
int rank = 0;
};
typedef Map<T, Element *, C, AL> MapT;
typedef RBMap<T, Element *, C, AL> MapT;
MapT elements;

View File

@ -157,7 +157,7 @@ void Geometry::MeshData::clear() {
}
void Geometry::MeshData::optimize_vertices() {
Map<int, int> vtx_remap;
RBMap<int, int> vtx_remap;
for (int i = 0; i < faces.size(); i++) {
for (int j = 0; j < faces[i].indices.size(); j++) {

View File

@ -33,7 +33,7 @@
#include "core/containers/list.h"
#include "core/containers/local_vector.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/math/aabb.h"
#include "core/math/geometry.h"
#include "core/math/vector3.h"
@ -258,8 +258,8 @@ private:
typename List<PairData *, AL>::Element *eA, *eB;
};
typedef Map<OctreeElementID, Element, Comparator<OctreeElementID>, AL> ElementMap;
typedef Map<PairKey, PairData, Comparator<PairKey>, AL> PairMap;
typedef RBMap<OctreeElementID, Element, Comparator<OctreeElementID>, AL> ElementMap;
typedef RBMap<PairKey, PairData, Comparator<PairKey>, AL> PairMap;
ElementMap element_map;
PairMap pair_map;

View File

@ -30,7 +30,7 @@
#include "quick_hull.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
uint32_t QuickHull::debug_stop_after = 0xFFFFFFFF;
bool QuickHull::_flag_warnings = true;
@ -232,7 +232,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me
//find lit faces and lit edges
List<List<Face>::Element *> lit_faces; //lit face is a death sentence
Map<Edge, FaceConnect> lit_edges; //create this on the flight, should not be that bad for performance and simplifies code a lot
RBMap<Edge, FaceConnect> lit_edges; //create this on the flight, should not be that bad for performance and simplifies code a lot
for (List<Face>::Element *E = faces.front(); E; E = E->next()) {
if (E->get().plane.distance_to(v) > 0) {
@ -243,7 +243,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me
uint32_t b = E->get().vertices[(i + 1) % 3];
Edge e(a, b);
Map<Edge, FaceConnect>::Element *F = lit_edges.find(e);
RBMap<Edge, FaceConnect>::Element *F = lit_edges.find(e);
if (!F) {
F = lit_edges.insert(e, FaceConnect());
}
@ -260,7 +260,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me
//create new faces from horizon edges
List<List<Face>::Element *> new_faces; //new faces
for (Map<Edge, FaceConnect>::Element *E = lit_edges.front(); E; E = E->next()) {
for (RBMap<Edge, FaceConnect>::Element *E = lit_edges.front(); E; E = E->next()) {
FaceConnect &fc = E->get();
if (fc.left && fc.right) {
continue; //edge is uninteresting, not on horizont
@ -328,7 +328,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me
/* CREATE MESHDATA */
//make a map of edges again
Map<Edge, RetFaceConnect> ret_edges;
RBMap<Edge, RetFaceConnect> ret_edges;
List<Geometry::MeshData::Face> ret_faces;
for (List<Face>::Element *E = faces.front(); E; E = E->next()) {
@ -346,7 +346,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me
uint32_t b = E->get().vertices[(i + 1) % 3];
Edge e(a, b);
Map<Edge, RetFaceConnect>::Element *G = ret_edges.find(e);
RBMap<Edge, RetFaceConnect>::Element *G = ret_edges.find(e);
if (!G) {
G = ret_edges.insert(e, RetFaceConnect());
}
@ -374,7 +374,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me
int b = E->get().indices[(i + 1) % f.indices.size()];
Edge e(a, b);
Map<Edge, RetFaceConnect>::Element *F = ret_edges.find(e);
RBMap<Edge, RetFaceConnect>::Element *F = ret_edges.find(e);
if (unlikely(!F)) {
warning_f = true;
@ -411,7 +411,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me
}
Edge e2(idx, idxn);
Map<Edge, RetFaceConnect>::Element *F2 = ret_edges.find(e2);
RBMap<Edge, RetFaceConnect>::Element *F2 = ret_edges.find(e2);
if (unlikely(!F2)) {
warning_not_f2 = true;
@ -431,7 +431,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me
}
// remove all edge connections to this face
for (Map<Edge, RetFaceConnect>::Element *G = ret_edges.front(); G; G = G->next()) {
for (RBMap<Edge, RetFaceConnect>::Element *G = ret_edges.front(); G; G = G->next()) {
if (G->get().left == O) {
G->get().left = nullptr;
}
@ -472,7 +472,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me
}
r_mesh.edges.resize(ret_edges.size());
idx = 0;
for (Map<Edge, RetFaceConnect>::Element *E = ret_edges.front(); E; E = E->next()) {
for (RBMap<Edge, RetFaceConnect>::Element *E = ret_edges.front(); E; E = E->next()) {
Geometry::MeshData::Edge e;
e.a = E->key().vertices[0];
e.b = E->key().vertices[1];

View File

@ -122,7 +122,7 @@ void TriangleMesh::create(const PoolVector<Vector3> &p_faces) {
PoolVector<Vector3>::Read r = p_faces.read();
PoolVector<Triangle>::Write w = triangles.write();
Map<Vector3, int> db;
RBMap<Vector3, int> db;
for (int i = 0; i < fc; i++) {
Triangle &f = w[i];
@ -131,7 +131,7 @@ void TriangleMesh::create(const PoolVector<Vector3> &p_faces) {
for (int j = 0; j < 3; j++) {
int vidx = -1;
Vector3 vs = v[j].snapped(Vector3(0.0001, 0.0001, 0.0001));
Map<Vector3, int>::Element *E = db.find(vs);
RBMap<Vector3, int>::Element *E = db.find(vs);
if (E) {
vidx = E->get();
} else {
@ -157,7 +157,7 @@ void TriangleMesh::create(const PoolVector<Vector3> &p_faces) {
vertices.resize(db.size());
PoolVector<Vector3>::Write vw = vertices.write();
for (Map<Vector3, int>::Element *E = db.front(); E; E = E->next()) {
for (RBMap<Vector3, int>::Element *E = db.front(); E; E = E->next()) {
vw[E->get()] = E->key();
}
}

View File

@ -156,9 +156,9 @@ Error MessageQueue::push_set(Object *p_object, const StringName &p_prop, const V
}
void MessageQueue::statistics() {
Map<StringName, int> set_count;
Map<int, int> notify_count;
Map<StringName, int> call_count;
RBMap<StringName, int> set_count;
RBMap<int, int> notify_count;
RBMap<StringName, int> call_count;
int null_count = 0;
uint32_t read_pos = 0;
@ -211,15 +211,15 @@ void MessageQueue::statistics() {
print_line("TOTAL BYTES: " + itos(buffer_end));
print_line("NULL count: " + itos(null_count));
for (Map<StringName, int>::Element *E = set_count.front(); E; E = E->next()) {
for (RBMap<StringName, int>::Element *E = set_count.front(); E; E = E->next()) {
print_line("SET " + E->key() + ": " + itos(E->get()));
}
for (Map<StringName, int>::Element *E = call_count.front(); E; E = E->next()) {
for (RBMap<StringName, int>::Element *E = call_count.front(); E; E = E->next()) {
print_line("CALL " + E->key() + ": " + itos(E->get()));
}
for (Map<int, int>::Element *E = notify_count.front(); E; E = E->next()) {
for (RBMap<int, int>::Element *E = notify_count.front(); E; E = E->next()) {
print_line("NOTIFY " + itos(E->key()) + ": " + itos(E->get()));
}
}

View File

@ -1518,7 +1518,7 @@ bool Object::is_connected(const StringName &p_signal, Object *p_to_object, const
Signal::Target target(p_to_object->get_instance_id(), p_to_method);
return s->slot_map.has(target);
//const Map<Signal::Target,Signal::Slot>::Element *E = s->slot_map.find(target);
//const RBMap<Signal::Target,Signal::Slot>::Element *E = s->slot_map.find(target);
//return (E!=NULL);
}

View File

@ -32,7 +32,7 @@
#include "core/containers/hash_map.h"
#include "core/containers/list.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/object/object_id.h"
#include "core/os/rw_lock.h"
#include "core/os/safe_refcount.h"

View File

@ -142,7 +142,7 @@ void Resource::reload_from_file() {
}
}
Ref<Resource> Resource::duplicate_for_local_scene(Node *p_for_scene, Map<Ref<Resource>, Ref<Resource>> &remap_cache) {
Ref<Resource> Resource::duplicate_for_local_scene(Node *p_for_scene, RBMap<Ref<Resource>, Ref<Resource>> &remap_cache) {
List<PropertyInfo> plist;
get_property_list(&plist);
@ -177,7 +177,7 @@ Ref<Resource> Resource::duplicate_for_local_scene(Node *p_for_scene, Map<Ref<Res
return r;
}
void Resource::configure_for_local_scene(Node *p_for_scene, Map<Ref<Resource>, Ref<Resource>> &remap_cache) {
void Resource::configure_for_local_scene(Node *p_for_scene, RBMap<Ref<Resource>, Ref<Resource>> &remap_cache) {
List<PropertyInfo> plist;
get_property_list(&plist);
@ -473,7 +473,7 @@ void ResourceCache::dump(const char *p_file, bool p_short) {
#ifdef DEBUG_ENABLED
lock.read_lock();
Map<String, int> type_count;
RBMap<String, int> type_count;
FileAccess *f = nullptr;
if (p_file) {
@ -498,7 +498,7 @@ void ResourceCache::dump(const char *p_file, bool p_short) {
}
}
for (Map<String, int>::Element *E = type_count.front(); E; E = E->next()) {
for (RBMap<String, int>::Element *E = type_count.front(); E; E = E->next()) {
if (f) {
f->store_line(E->key() + " count: " + itos(E->get()));
}

View File

@ -100,8 +100,8 @@ public:
int get_subindex() const;
virtual Ref<Resource> duplicate(bool p_subresources = false) const;
Ref<Resource> duplicate_for_local_scene(Node *p_for_scene, Map<Ref<Resource>, Ref<Resource>> &remap_cache);
void configure_for_local_scene(Node *p_for_scene, Map<Ref<Resource>, Ref<Resource>> &remap_cache);
Ref<Resource> duplicate_for_local_scene(Node *p_for_scene, RBMap<Ref<Resource>, Ref<Resource>> &remap_cache);
void configure_for_local_scene(Node *p_for_scene, RBMap<Ref<Resource>, Ref<Resource>> &remap_cache);
void set_local_to_scene(bool p_enable);
bool is_local_to_scene() const;

View File

@ -83,7 +83,7 @@ void ScriptDebuggerLocal::debug(ScriptLanguage *p_script, bool p_can_continue, b
} else if (line.begins_with("set")) {
if (line.get_slice_count(" ") == 1) {
for (Map<String, String>::Element *E = options.front(); E; E = E->next()) {
for (RBMap<String, String>::Element *E = options.front(); E; E = E->next()) {
print_line("\t" + E->key() + "=" + E->value());
}
@ -159,14 +159,14 @@ void ScriptDebuggerLocal::debug(ScriptLanguage *p_script, bool p_can_continue, b
} else if (line.begins_with("br") || line.begins_with("break")) {
if (line.get_slice_count(" ") <= 1) {
const Map<int, Set<StringName>> &breakpoints = get_breakpoints();
const RBMap<int, Set<StringName>> &breakpoints = get_breakpoints();
if (breakpoints.size() == 0) {
print_line("No Breakpoints.");
continue;
}
print_line("Breakpoint(s): " + itos(breakpoints.size()));
for (Map<int, Set<StringName>>::Element *E = breakpoints.front(); E; E = E->next()) {
for (RBMap<int, Set<StringName>>::Element *E = breakpoints.front(); E; E = E->next()) {
print_line("\t" + String(E->value().front()->get()) + ":" + itos(E->key()));
}

View File

@ -38,7 +38,7 @@ class ScriptDebuggerLocal : public ScriptDebugger {
float frame_time, process_time, physics_time, physics_frame_time;
uint64_t idle_accum;
String target_function;
Map<String, String> options;
RBMap<String, String> options;
Vector<ScriptLanguage::ProfilingInfo> pinfo;

View File

@ -87,9 +87,9 @@ Array Script::_get_script_signal_list() {
Dictionary Script::_get_script_constant_map() {
Dictionary ret;
Map<StringName, Variant> map;
RBMap<StringName, Variant> map;
get_constants(&map);
for (Map<StringName, Variant>::Element *E = map.front(); E; E = E->next()) {
for (RBMap<StringName, Variant>::Element *E = map.front(); E; E = E->next()) {
ret[E->key()] = E->value();
}
return ret;
@ -538,7 +538,7 @@ bool PlaceHolderScriptInstance::has_method(const StringName &p_method) const {
return false;
}
void PlaceHolderScriptInstance::update(const List<PropertyInfo> &p_properties, const Map<StringName, Variant> &p_values) {
void PlaceHolderScriptInstance::update(const List<PropertyInfo> &p_properties, const RBMap<StringName, Variant> &p_values) {
Set<StringName> new_values;
for (const List<PropertyInfo>::Element *E = p_properties.front(); E; E = E->next()) {
StringName n = E->get().name;
@ -554,7 +554,7 @@ void PlaceHolderScriptInstance::update(const List<PropertyInfo> &p_properties, c
properties = p_properties;
List<StringName> to_remove;
for (Map<StringName, Variant>::Element *E = values.front(); E; E = E->next()) {
for (RBMap<StringName, Variant>::Element *E = values.front(); E; E = E->next()) {
if (!new_values.has(E->key())) {
to_remove.push_back(E->key());
}
@ -584,7 +584,7 @@ void PlaceHolderScriptInstance::update(const List<PropertyInfo> &p_properties, c
void PlaceHolderScriptInstance::property_set_fallback(const StringName &p_name, const Variant &p_value, bool *r_valid) {
if (script->is_placeholder_fallback_enabled()) {
Map<StringName, Variant>::Element *E = values.find(p_name);
RBMap<StringName, Variant>::Element *E = values.find(p_name);
if (E) {
E->value() = p_value;
@ -611,7 +611,7 @@ void PlaceHolderScriptInstance::property_set_fallback(const StringName &p_name,
Variant PlaceHolderScriptInstance::property_get_fallback(const StringName &p_name, bool *r_valid) {
if (script->is_placeholder_fallback_enabled()) {
const Map<StringName, Variant>::Element *E = values.find(p_name);
const RBMap<StringName, Variant>::Element *E = values.find(p_name);
if (E) {
if (r_valid) {

View File

@ -31,7 +31,7 @@
/*************************************************************************/
#include "core/io/multiplayer_api.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/containers/pair.h"
#include "core/object/resource.h"
@ -149,7 +149,7 @@ public:
virtual int get_member_line(const StringName &p_member) const { return -1; }
virtual void get_constants(Map<StringName, Variant> *p_constants) {}
virtual void get_constants(RBMap<StringName, Variant> *p_constants) {}
virtual void get_members(Set<StringName> *p_constants) {}
virtual bool is_placeholder_fallback_enabled() const { return false; }
@ -372,8 +372,8 @@ extern uint8_t script_encryption_key[32];
class PlaceHolderScriptInstance : public ScriptInstance {
Object *owner;
List<PropertyInfo> properties;
Map<StringName, Variant> values;
Map<StringName, Variant> constants;
RBMap<StringName, Variant> values;
RBMap<StringName, Variant> constants;
ScriptLanguage *language;
Ref<Script> script;
@ -400,7 +400,7 @@ public:
Object *get_owner() { return owner; }
void update(const List<PropertyInfo> &p_properties, const Map<StringName, Variant> &p_values); //likely changed in editor
void update(const List<PropertyInfo> &p_properties, const RBMap<StringName, Variant> &p_values); //likely changed in editor
virtual bool is_placeholder() const { return true; }
@ -416,7 +416,7 @@ class ScriptDebugger {
int depth;
static ScriptDebugger *singleton;
Map<int, Set<StringName>> breakpoints;
RBMap<int, Set<StringName>> breakpoints;
ScriptLanguage *break_lang;
@ -434,7 +434,7 @@ public:
bool is_breakpoint(int p_line, const StringName &p_source) const;
bool is_breakpoint_line(int p_line) const;
void clear_breakpoints();
const Map<int, Set<StringName>> &get_breakpoints() const { return breakpoints; }
const RBMap<int, Set<StringName>> &get_breakpoints() const { return breakpoints; }
virtual void debug(ScriptLanguage *p_script, bool p_can_continue = true, bool p_is_error_breakpoint = false) = 0;
virtual void idle_poll();

View File

@ -51,7 +51,7 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) {
int size = Math::larger_prime(keys.size());
Vector<Vector<Pair<int, CharString>>> buckets;
Vector<Map<uint32_t, int>> table;
Vector<RBMap<uint32_t, int>> table;
Vector<uint32_t> hfunc_table;
Vector<_PHashTranslationCmp> compressed;
@ -106,7 +106,7 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) {
for (int i = 0; i < size; i++) {
const Vector<Pair<int, CharString>> &b = buckets[i];
Map<uint32_t, int> &t = table.write[i];
RBMap<uint32_t, int> &t = table.write[i];
if (b.size() == 0) {
continue;
@ -145,7 +145,7 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) {
int btindex = 0;
for (int i = 0; i < size; i++) {
const Map<uint32_t, int> &t = table[i];
const RBMap<uint32_t, int> &t = table[i];
if (t.size() == 0) {
htw[i] = 0xFFFFFFFF; //nothing
continue;
@ -155,7 +155,7 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) {
btw[btindex++] = t.size();
btw[btindex++] = hfunc_table[i];
for (Map<uint32_t, int>::Element *E = t.front(); E; E = E->next()) {
for (RBMap<uint32_t, int>::Element *E = t.front(); E; E = E->next()) {
btw[btindex++] = E->key();
btw[btindex++] = compressed[E->get()].offset;
btw[btindex++] = compressed[E->get()].compressed.size();

View File

@ -820,7 +820,7 @@ PoolVector<String> Translation::_get_messages() const {
PoolVector<String> msgs;
msgs.resize(translation_map.size() * 2);
int idx = 0;
for (const Map<StringName, StringName>::Element *E = translation_map.front(); E; E = E->next()) {
for (const RBMap<StringName, StringName>::Element *E = translation_map.front(); E; E = E->next()) {
msgs.set(idx + 0, E->key());
msgs.set(idx + 1, E->get());
idx += 2;
@ -833,7 +833,7 @@ PoolVector<String> Translation::_get_message_list() const {
PoolVector<String> msgs;
msgs.resize(translation_map.size());
int idx = 0;
for (const Map<StringName, StringName>::Element *E = translation_map.front(); E; E = E->next()) {
for (const RBMap<StringName, StringName>::Element *E = translation_map.front(); E; E = E->next()) {
msgs.set(idx, E->key());
idx += 1;
}
@ -878,7 +878,7 @@ StringName Translation::get_message(const StringName &p_src_text) const {
return get_script_instance()->call("_get_message", p_src_text);
}
const Map<StringName, StringName>::Element *E = translation_map.find(p_src_text);
const RBMap<StringName, StringName>::Element *E = translation_map.find(p_src_text);
if (!E) {
return StringName();
}
@ -891,7 +891,7 @@ void Translation::erase_message(const StringName &p_src_text) {
}
void Translation::get_message_list(List<StringName> *r_messages) const {
for (const Map<StringName, StringName>::Element *E = translation_map.front(); E; E = E->next()) {
for (const RBMap<StringName, StringName>::Element *E = translation_map.front(); E; E = E->next()) {
r_messages->push_back(E->key());
}
}

View File

@ -38,7 +38,7 @@ class Translation : public Resource {
RES_BASE_EXTENSION("translation");
String locale;
Map<StringName, StringName> translation_map;
RBMap<StringName, StringName> translation_map;
PoolVector<String> _get_message_list() const;
@ -72,7 +72,7 @@ class TranslationServer : public Object {
Ref<Translation> tool_translation;
Ref<Translation> doc_translation;
Map<String, String> locale_name_map;
RBMap<String, String> locale_name_map;
bool enabled;

View File

@ -126,7 +126,7 @@ struct _VariantCall {
};
struct TypeFunc {
Map<StringName, FuncData> functions;
RBMap<StringName, FuncData> functions;
};
static TypeFunc *type_funcs;
@ -1879,11 +1879,11 @@ struct _VariantCall {
}
struct ConstantData {
Map<StringName, int> value;
RBMap<StringName, int> value;
#ifdef DEBUG_ENABLED
List<StringName> value_ordered;
#endif
Map<StringName, Variant> variant_value;
RBMap<StringName, Variant> variant_value;
#ifdef DEBUG_ENABLED
List<StringName> variant_value_ordered;
#endif
@ -1939,7 +1939,7 @@ void Variant::call_ptr(const StringName &p_method, const Variant **p_args, int p
} else {
r_error.error = Variant::CallError::CALL_OK;
Map<StringName, _VariantCall::FuncData>::Element *E = _VariantCall::type_funcs[type].functions.find(p_method);
RBMap<StringName, _VariantCall::FuncData>::Element *E = _VariantCall::type_funcs[type].functions.find(p_method);
#ifdef DEBUG_ENABLED
if (!E) {
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
@ -2201,7 +2201,7 @@ Vector<Variant::Type> Variant::get_method_argument_types(Variant::Type p_type, c
ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, Vector<Variant::Type>());
const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[p_type];
const Map<StringName, _VariantCall::FuncData>::Element *E = tf.functions.find(p_method);
const RBMap<StringName, _VariantCall::FuncData>::Element *E = tf.functions.find(p_method);
if (!E) {
return Vector<Variant::Type>();
}
@ -2213,7 +2213,7 @@ bool Variant::is_method_const(Variant::Type p_type, const StringName &p_method)
ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, false);
const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[p_type];
const Map<StringName, _VariantCall::FuncData>::Element *E = tf.functions.find(p_method);
const RBMap<StringName, _VariantCall::FuncData>::Element *E = tf.functions.find(p_method);
if (!E) {
return false;
}
@ -2225,7 +2225,7 @@ Vector<StringName> Variant::get_method_argument_names(Variant::Type p_type, cons
ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, Vector<StringName>());
const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[p_type];
const Map<StringName, _VariantCall::FuncData>::Element *E = tf.functions.find(p_method);
const RBMap<StringName, _VariantCall::FuncData>::Element *E = tf.functions.find(p_method);
if (!E) {
return Vector<StringName>();
}
@ -2237,7 +2237,7 @@ Variant::Type Variant::get_method_return_type(Variant::Type p_type, const String
ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, Variant::NIL);
const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[p_type];
const Map<StringName, _VariantCall::FuncData>::Element *E = tf.functions.find(p_method);
const RBMap<StringName, _VariantCall::FuncData>::Element *E = tf.functions.find(p_method);
if (!E) {
return Variant::NIL;
}
@ -2253,7 +2253,7 @@ Vector<Variant> Variant::get_method_default_arguments(Variant::Type p_type, cons
ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, Vector<Variant>());
const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[p_type];
const Map<StringName, _VariantCall::FuncData>::Element *E = tf.functions.find(p_method);
const RBMap<StringName, _VariantCall::FuncData>::Element *E = tf.functions.find(p_method);
ERR_FAIL_COND_V(!E, Vector<Variant>());
return E->get().default_args;
@ -2262,7 +2262,7 @@ Vector<Variant> Variant::get_method_default_arguments(Variant::Type p_type, cons
void Variant::get_method_list(List<MethodInfo> *p_list) const {
const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[type];
for (const Map<StringName, _VariantCall::FuncData>::Element *E = tf.functions.front(); E; E = E->next()) {
for (const RBMap<StringName, _VariantCall::FuncData>::Element *E = tf.functions.front(); E; E = E->next()) {
const _VariantCall::FuncData &fd = E->get();
MethodInfo mi;
@ -2341,7 +2341,7 @@ void Variant::get_constants_for_type(Variant::Type p_type, List<StringName> *p_c
for (List<StringName>::Element *E = cd.value_ordered.front(); E; E = E->next()) {
p_constants->push_back(E->get());
#else
for (Map<StringName, int>::Element *E = cd.value.front(); E; E = E->next()) {
for (RBMap<StringName, int>::Element *E = cd.value.front(); E; E = E->next()) {
p_constants->push_back(E->key());
#endif
}
@ -2350,7 +2350,7 @@ void Variant::get_constants_for_type(Variant::Type p_type, List<StringName> *p_c
for (List<StringName>::Element *E = cd.variant_value_ordered.front(); E; E = E->next()) {
p_constants->push_back(E->get());
#else
for (Map<StringName, Variant>::Element *E = cd.variant_value.front(); E; E = E->next()) {
for (RBMap<StringName, Variant>::Element *E = cd.variant_value.front(); E; E = E->next()) {
p_constants->push_back(E->key());
#endif
}
@ -2370,9 +2370,9 @@ Variant Variant::get_constant_value(Variant::Type p_type, const StringName &p_va
ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, 0);
_VariantCall::ConstantData &cd = _VariantCall::constant_data[p_type];
Map<StringName, int>::Element *E = cd.value.find(p_value);
RBMap<StringName, int>::Element *E = cd.value.find(p_value);
if (!E) {
Map<StringName, Variant>::Element *F = cd.variant_value.find(p_value);
RBMap<StringName, Variant>::Element *F = cd.variant_value.find(p_value);
if (F) {
if (r_valid) {
*r_valid = true;
@ -3463,7 +3463,7 @@ void register_variant_methods() {
/* REGISTER CONSTANTS */
_populate_named_colors();
for (Map<String, Color>::Element *color = _named_colors.front(); color; color = color->next()) {
for (RBMap<String, Color>::Element *color = _named_colors.front(); color; color = color->next()) {
_VariantCall::add_variant_constant(Variant::COLOR, color->key(), color->value());
}

View File

@ -139,7 +139,7 @@ public:
struct Tag {
String name;
Map<String, Variant> fields;
RBMap<String, Variant> fields;
};
private:

View File

@ -167,7 +167,7 @@ void RasterizerSceneGLES2::shadow_atlas_set_size(RID p_atlas, int p_size) {
}
// erase shadow atlast references from lights
for (Map<RID, uint32_t>::Element *E = shadow_atlas->shadow_owners.front(); E; E = E->next()) {
for (RBMap<RID, uint32_t>::Element *E = shadow_atlas->shadow_owners.front(); E; E = E->next()) {
LightInstance *li = light_instance_owner.getornull(E->key());
ERR_CONTINUE(!li);
li->shadow_atlases.erase(p_atlas);

View File

@ -264,7 +264,7 @@ public:
GLuint depth;
GLuint color;
Map<RID, uint32_t> shadow_owners;
RBMap<RID, uint32_t> shadow_owners;
};
struct ShadowCubeMap {

View File

@ -1557,9 +1557,9 @@ void RasterizerStorageGLES2::shader_get_param_list(RID p_shader, List<PropertyIn
_update_shader(shader);
}
Map<int, StringName> order;
RBMap<int, StringName> order;
for (Map<StringName, ShaderLanguage::ShaderNode::Uniform>::Element *E = shader->uniforms.front(); E; E = E->next()) {
for (RBMap<StringName, ShaderLanguage::ShaderNode::Uniform>::Element *E = shader->uniforms.front(); E; E = E->next()) {
if (E->get().texture_order >= 0) {
order[E->get().texture_order + 100000] = E->key();
} else {
@ -1567,7 +1567,7 @@ void RasterizerStorageGLES2::shader_get_param_list(RID p_shader, List<PropertyIn
}
}
for (Map<int, StringName>::Element *E = order.front(); E; E = E->next()) {
for (RBMap<int, StringName>::Element *E = order.front(); E; E = E->next()) {
PropertyInfo pi;
ShaderLanguage::ShaderNode::Uniform &u = shader->uniforms[E->get()];
@ -1707,7 +1707,7 @@ RID RasterizerStorageGLES2::shader_get_default_texture_param(RID p_shader, const
const Shader *shader = shader_owner.get(p_shader);
ERR_FAIL_COND_V(!shader, RID());
const Map<StringName, RID>::Element *E = shader->default_textures.find(p_name);
const RBMap<StringName, RID>::Element *E = shader->default_textures.find(p_name);
if (!E) {
return RID();
@ -1904,7 +1904,7 @@ void RasterizerStorageGLES2::material_add_instance_owner(RID p_material, Rasteri
Material *material = material_owner.getornull(p_material);
ERR_FAIL_COND(!material);
Map<RasterizerScene::InstanceBase *, int>::Element *E = material->instance_owners.find(p_instance);
RBMap<RasterizerScene::InstanceBase *, int>::Element *E = material->instance_owners.find(p_instance);
if (E) {
E->get()++;
} else {
@ -1916,7 +1916,7 @@ void RasterizerStorageGLES2::material_remove_instance_owner(RID p_material, Rast
Material *material = material_owner.getornull(p_material);
ERR_FAIL_COND(!material);
Map<RasterizerScene::InstanceBase *, int>::Element *E = material->instance_owners.find(p_instance);
RBMap<RasterizerScene::InstanceBase *, int>::Element *E = material->instance_owners.find(p_instance);
ERR_FAIL_COND(!E);
E->get()--;
@ -1971,11 +1971,11 @@ void RasterizerStorageGLES2::_update_material(Material *p_material) {
p_material->can_cast_shadow_cache = can_cast_shadow;
p_material->is_animated_cache = is_animated;
for (Map<Geometry *, int>::Element *E = p_material->geometry_owners.front(); E; E = E->next()) {
for (RBMap<Geometry *, int>::Element *E = p_material->geometry_owners.front(); E; E = E->next()) {
E->key()->material_changed_notify();
}
for (Map<RasterizerScene::InstanceBase *, int>::Element *E = p_material->instance_owners.front(); E; E = E->next()) {
for (RBMap<RasterizerScene::InstanceBase *, int>::Element *E = p_material->instance_owners.front(); E; E = E->next()) {
E->key()->base_changed(false, true);
}
}
@ -1987,21 +1987,21 @@ void RasterizerStorageGLES2::_update_material(Material *p_material) {
if (p_material->shader && p_material->shader->texture_count > 0) {
p_material->textures.resize(p_material->shader->texture_count);
for (Map<StringName, ShaderLanguage::ShaderNode::Uniform>::Element *E = p_material->shader->uniforms.front(); E; E = E->next()) {
for (RBMap<StringName, ShaderLanguage::ShaderNode::Uniform>::Element *E = p_material->shader->uniforms.front(); E; E = E->next()) {
if (E->get().texture_order < 0) {
continue; // not a texture, does not go here
}
RID texture;
Map<StringName, Variant>::Element *V = p_material->params.find(E->key());
RBMap<StringName, Variant>::Element *V = p_material->params.find(E->key());
if (V) {
texture = V->get();
}
if (!texture.is_valid()) {
Map<StringName, RID>::Element *W = p_material->shader->default_textures.find(E->key());
RBMap<StringName, RID>::Element *W = p_material->shader->default_textures.find(E->key());
if (W) {
texture = W->get();
@ -2019,7 +2019,7 @@ void RasterizerStorageGLES2::_material_add_geometry(RID p_material, Geometry *p_
Material *material = material_owner.getornull(p_material);
ERR_FAIL_COND(!material);
Map<Geometry *, int>::Element *I = material->geometry_owners.find(p_geometry);
RBMap<Geometry *, int>::Element *I = material->geometry_owners.find(p_geometry);
if (I) {
I->get()++;
@ -2032,7 +2032,7 @@ void RasterizerStorageGLES2::_material_remove_geometry(RID p_material, Geometry
Material *material = material_owner.getornull(p_material);
ERR_FAIL_COND(!material);
Map<Geometry *, int>::Element *I = material->geometry_owners.find(p_geometry);
RBMap<Geometry *, int>::Element *I = material->geometry_owners.find(p_geometry);
ERR_FAIL_COND(!I);
I->get()--;
@ -5587,12 +5587,12 @@ bool RasterizerStorageGLES2::free(RID p_rid) {
m->shader->materials.remove(&m->list);
}
for (Map<Geometry *, int>::Element *E = m->geometry_owners.front(); E; E = E->next()) {
for (RBMap<Geometry *, int>::Element *E = m->geometry_owners.front(); E; E = E->next()) {
Geometry *g = E->key();
g->material = RID();
}
for (Map<RasterizerScene::InstanceBase *, int>::Element *E = m->instance_owners.front(); E; E = E->next()) {
for (RBMap<RasterizerScene::InstanceBase *, int>::Element *E = m->instance_owners.front(); E; E = E->next()) {
RasterizerScene::InstanceBase *ins = E->key();
if (ins->material_override == p_rid) {

View File

@ -404,7 +404,7 @@ public:
String code;
SelfList<Material>::List materials;
Map<StringName, ShaderLanguage::ShaderNode::Uniform> uniforms;
RBMap<StringName, ShaderLanguage::ShaderNode::Uniform> uniforms;
uint32_t texture_count;
@ -413,7 +413,7 @@ public:
SelfList<Shader> dirty_list;
Map<StringName, RID> default_textures;
RBMap<StringName, RID> default_textures;
Vector<ShaderLanguage::ShaderNode::Uniform::Hint> texture_hints;
@ -553,7 +553,7 @@ public:
struct Material : public RID_Data {
Shader *shader;
Map<StringName, Variant> params;
RBMap<StringName, Variant> params;
SelfList<Material> list;
SelfList<Material> dirty_list;
Vector<Pair<StringName, RID>> textures;
@ -565,8 +565,8 @@ public:
uint32_t index;
uint64_t last_pass;
Map<Geometry *, int> geometry_owners;
Map<RasterizerScene::InstanceBase *, int> instance_owners;
RBMap<Geometry *, int> geometry_owners;
RBMap<RasterizerScene::InstanceBase *, int> instance_owners;
bool can_cast_shadow_cache;
bool is_animated_cache;

View File

@ -217,7 +217,7 @@ static String get_constant_text(SL::DataType p_type, const Vector<SL::ConstantNo
}
}
void ShaderCompilerGLES2::_dump_function_deps(const SL::ShaderNode *p_node, const StringName &p_for_func, const Map<StringName, String> &p_func_code, StringBuilder &r_to_add, Set<StringName> &r_added) {
void ShaderCompilerGLES2::_dump_function_deps(const SL::ShaderNode *p_node, const StringName &p_for_func, const RBMap<StringName, String> &p_func_code, StringBuilder &r_to_add, Set<StringName> &r_added) {
int fidx = -1;
for (int i = 0; i < p_node->functions.size(); i++) {
@ -451,7 +451,7 @@ String ShaderCompilerGLES2::_dump_node_code(const SL::Node *p_node, int p_level,
// functions
Map<StringName, String> function_code;
RBMap<StringName, String> function_code;
for (int i = 0; i < snode->functions.size(); i++) {
SL::FunctionNode *fnode = snode->functions[i].function;

View File

@ -39,12 +39,12 @@
class ShaderCompilerGLES2 {
public:
struct IdentifierActions {
Map<StringName, Pair<int *, int>> render_mode_values;
Map<StringName, bool *> render_mode_flags;
Map<StringName, bool *> usage_flag_pointers;
Map<StringName, bool *> write_flag_pointers;
RBMap<StringName, Pair<int *, int>> render_mode_values;
RBMap<StringName, bool *> render_mode_flags;
RBMap<StringName, bool *> usage_flag_pointers;
RBMap<StringName, bool *> write_flag_pointers;
Map<StringName, ShaderLanguage::ShaderNode::Uniform> *uniforms;
RBMap<StringName, ShaderLanguage::ShaderNode::Uniform> *uniforms;
};
struct GeneratedCode {
@ -67,12 +67,12 @@ private:
ShaderLanguage parser;
struct DefaultIdentifierActions {
Map<StringName, String> renames;
Map<StringName, String> render_mode_defines;
Map<StringName, String> usage_defines;
RBMap<StringName, String> renames;
RBMap<StringName, String> render_mode_defines;
RBMap<StringName, String> usage_defines;
};
void _dump_function_deps(const ShaderLanguage::ShaderNode *p_node, const StringName &p_for_func, const Map<StringName, String> &p_func_code, StringBuilder &r_to_add, Set<StringName> &r_added);
void _dump_function_deps(const ShaderLanguage::ShaderNode *p_node, const StringName &p_for_func, const RBMap<StringName, String> &p_func_code, StringBuilder &r_to_add, Set<StringName> &r_added);
String _dump_node_code(const ShaderLanguage::Node *p_node, int p_level, GeneratedCode &r_gen_code, IdentifierActions &p_actions, const DefaultIdentifierActions &p_default_actions, bool p_assigning, bool p_use_scope = true);
const ShaderLanguage::ShaderNode *shader;

View File

@ -665,19 +665,19 @@ void ShaderGLES2::use_material(void *p_material) {
Version *v = version_map.getptr(conditional_version);
// bind uniforms
for (Map<StringName, ShaderLanguage::ShaderNode::Uniform>::Element *E = material->shader->uniforms.front(); E; E = E->next()) {
for (RBMap<StringName, ShaderLanguage::ShaderNode::Uniform>::Element *E = material->shader->uniforms.front(); E; E = E->next()) {
if (E->get().texture_order >= 0) {
continue; // this is a texture, doesn't go here
}
Map<StringName, GLint>::Element *L = v->custom_uniform_locations.find(E->key());
RBMap<StringName, GLint>::Element *L = v->custom_uniform_locations.find(E->key());
if (!L || L->get() < 0) {
continue; //uniform not valid
}
GLuint location = L->get();
Map<StringName, Variant>::Element *V = material->params.find(E->key());
RBMap<StringName, Variant>::Element *V = material->params.find(E->key());
if (V) {
switch (E->get().type) {

View File

@ -39,7 +39,7 @@
#endif
#include "core/containers/hash_map.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/math/projection.h"
#include "core/containers/pair.h"
#include "core/variant/variant.h"
@ -107,7 +107,7 @@ private:
GLuint frag_id;
GLint *uniform_location;
Vector<GLint> texture_uniform_locations;
Map<StringName, GLint> custom_uniform_locations;
RBMap<StringName, GLint> custom_uniform_locations;
uint32_t code_version;
bool ok;
Version() {
@ -170,7 +170,7 @@ private:
int max_image_units;
Map<StringName, Pair<ShaderLanguage::DataType, Vector<ShaderLanguage::ConstantNode::Value>>> uniform_values;
RBMap<StringName, Pair<ShaderLanguage::DataType, Vector<ShaderLanguage::ConstantNode::Value>>> uniform_values;
protected:
_FORCE_INLINE_ int _get_uniform(int p_which) const;

View File

@ -128,7 +128,7 @@ void IP_Unix::_resolve_hostname(List<IP_Address> &r_addresses, const String &p_h
#if defined(UWP_ENABLED)
void IP_Unix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) const {
void IP_Unix::get_local_interfaces(RBMap<String, Interface_Info> *r_interfaces) const {
using namespace Windows::Networking;
using namespace Windows::Networking::Connectivity;
@ -142,7 +142,7 @@ void IP_Unix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) co
continue;
String name = hostname->RawName->Data();
Map<String, Interface_Info>::Element *E = r_interfaces->find(name);
RBMap<String, Interface_Info>::Element *E = r_interfaces->find(name);
if (!E) {
Interface_Info info;
info.name = name;
@ -161,7 +161,7 @@ void IP_Unix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) co
#else
void IP_Unix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) const {
void IP_Unix::get_local_interfaces(RBMap<String, Interface_Info> *r_interfaces) const {
ULONG buf_size = 1024;
IP_ADAPTER_ADDRESSES *addrs;
@ -209,7 +209,7 @@ void IP_Unix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) co
#else // UNIX
void IP_Unix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) const {
void IP_Unix::get_local_interfaces(RBMap<String, Interface_Info> *r_interfaces) const {
struct ifaddrs *ifAddrStruct = nullptr;
struct ifaddrs *ifa = nullptr;
int family;
@ -227,7 +227,7 @@ void IP_Unix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) co
continue;
}
Map<String, Interface_Info>::Element *E = r_interfaces->find(ifa->ifa_name);
RBMap<String, Interface_Info>::Element *E = r_interfaces->find(ifa->ifa_name);
if (!E) {
Interface_Info info;
info.name = ifa->ifa_name;

View File

@ -42,7 +42,7 @@ class IP_Unix : public IP {
static IP *_create_unix();
public:
virtual void get_local_interfaces(Map<String, Interface_Info> *r_interfaces) const;
virtual void get_local_interfaces(RBMap<String, Interface_Info> *r_interfaces) const;
static void make_default();
IP_Unix();

View File

@ -239,9 +239,9 @@ _FORCE_INLINE_ Error NetSocketPosix::_change_multicast_group(IP_Address p_ip, St
IP_Address if_ip;
uint32_t if_v6id = 0;
Map<String, IP::Interface_Info> if_info;
RBMap<String, IP::Interface_Info> if_info;
IP::get_singleton()->get_local_interfaces(&if_info);
for (Map<String, IP::Interface_Info>::Element *E = if_info.front(); E; E = E->next()) {
for (RBMap<String, IP::Interface_Info>::Element *E = if_info.front(); E; E = E->next()) {
IP::Interface_Info &c = E->get();
if (c.name != p_if_name) {
continue;

View File

@ -81,7 +81,7 @@ void AnimationBezierTrackEdit::_draw_track(int p_track, const Color &p_color) {
int right_limit = get_size().width - timeline->get_buttons_width();
//selection may have altered the order of keys
Map<float, int> key_order;
RBMap<float, int> key_order;
for (int i = 0; i < animation->track_get_key_count(p_track); i++) {
float ofs = animation->track_get_key_time(p_track, i);
@ -92,7 +92,7 @@ void AnimationBezierTrackEdit::_draw_track(int p_track, const Color &p_color) {
key_order[ofs] = i;
}
for (Map<float, int>::Element *E = key_order.front(); E; E = E->next()) {
for (RBMap<float, int>::Element *E = key_order.front(); E; E = E->next()) {
int i = E->get();
if (!E->next()) {
@ -337,7 +337,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
// RELATED TRACKS TITLES
Map<int, Color> subtrack_colors;
RBMap<int, Color> subtrack_colors;
subtracks.clear();
for (int i = 0; i < animation->get_track_count(); i++) {
@ -418,7 +418,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
float scale = timeline->get_zoom_scale();
Ref<Texture> point = get_theme_icon("KeyValue", "EditorIcons");
for (Map<int, Color>::Element *E = subtrack_colors.front(); E; E = E->next()) {
for (RBMap<int, Color>::Element *E = subtrack_colors.front(); E; E = E->next()) {
_draw_track(E->key(), E->get());
for (int i = 0; i < animation->track_get_key_count(E->key()); i++) {
@ -698,7 +698,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
emit_signal("close_request");
return;
}
for (Map<int, Rect2>::Element *E = subtracks.front(); E; E = E->next()) {
for (RBMap<int, Rect2>::Element *E = subtracks.front(); E; E = E->next()) {
if (E->get().has_point(mb->get_position())) {
set_animation_and_track(animation, E->key());
_clear_selection();

View File

@ -32,7 +32,7 @@
#include "scene/gui/control.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/math/rect2.h"
#include "core/math/vector2.h"
#include "core/object/object.h"
@ -89,7 +89,7 @@ class AnimationBezierTrackEdit : public Control {
Rect2 close_icon_rect;
Map<int, Rect2> subtracks;
RBMap<int, Rect2> subtracks;
float v_scroll;
float v_zoom;

View File

@ -784,7 +784,7 @@ public:
return;
}
for (Map<int, List<float>>::Element *E = key_ofs_map.front(); E; E = E->next()) {
for (RBMap<int, List<float>>::Element *E = key_ofs_map.front(); E; E = E->next()) {
int key = 0;
for (List<float>::Element *F = E->value().front(); F; F = F->next()) {
float key_ofs = F->get();
@ -810,7 +810,7 @@ public:
bool _set(const StringName &p_name, const Variant &p_value) {
bool update_obj = false;
bool change_notify_deserved = false;
for (Map<int, List<float>>::Element *E = key_ofs_map.front(); E; E = E->next()) {
for (RBMap<int, List<float>>::Element *E = key_ofs_map.front(); E; E = E->next()) {
int track = E->key();
for (List<float>::Element *F = E->value().front(); F; F = F->next()) {
float key_ofs = F->get();
@ -1082,7 +1082,7 @@ public:
}
bool _get(const StringName &p_name, Variant &r_ret) const {
for (Map<int, List<float>>::Element *E = key_ofs_map.front(); E; E = E->next()) {
for (RBMap<int, List<float>>::Element *E = key_ofs_map.front(); E; E = E->next()) {
int track = E->key();
for (List<float>::Element *F = E->value().front(); F; F = F->next()) {
float key_ofs = F->get();
@ -1219,7 +1219,7 @@ public:
bool show_time = true;
bool same_track_type = true;
bool same_key_type = true;
for (Map<int, List<float>>::Element *E = key_ofs_map.front(); E; E = E->next()) {
for (RBMap<int, List<float>>::Element *E = key_ofs_map.front(); E; E = E->next()) {
int track = E->key();
ERR_FAIL_INDEX(track, animation->get_track_count());
@ -1368,8 +1368,8 @@ public:
Ref<Animation> animation;
Map<int, List<float>> key_ofs_map;
Map<int, NodePath> base_map;
RBMap<int, List<float>> key_ofs_map;
RBMap<int, NodePath> base_map;
PropertyInfo hint;
Node *root_path;
@ -4236,7 +4236,7 @@ void AnimationTrackEditor::_update_tracks() {
return;
}
Map<String, VBoxContainer *> group_sort;
RBMap<String, VBoxContainer *> group_sort;
bool use_grouping = !view_group->is_pressed();
bool use_filter = selected_filter->is_pressed();
@ -5030,10 +5030,10 @@ void AnimationTrackEditor::_update_key_edit() {
multi_key_edit = memnew(AnimationMultiTrackKeyEdit);
multi_key_edit->animation = animation;
Map<int, List<float>> key_ofs_map;
Map<int, NodePath> base_map;
RBMap<int, List<float>> key_ofs_map;
RBMap<int, NodePath> base_map;
int first_track = -1;
for (Map<SelectedKey, KeyInfo>::Element *E = selection.front(); E; E = E->next()) {
for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.front(); E; E = E->next()) {
int track = E->key().track;
if (first_track < 0) {
first_track = track;
@ -5092,11 +5092,11 @@ void AnimationTrackEditor::_move_selection_commit() {
float motion = moving_selection_offset;
// 1 - remove the keys
for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
undo_redo->add_do_method(animation.ptr(), "track_remove_key", E->key().track, E->key().key);
}
// 2 - remove overlapped keys
for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
float newtime = snap_time(E->get().pos + motion);
int idx = animation->track_find_key(E->key().track, newtime, true);
if (idx == -1) {
@ -5121,19 +5121,19 @@ void AnimationTrackEditor::_move_selection_commit() {
}
// 3 - move the keys (re insert them)
for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
float newpos = snap_time(E->get().pos + motion);
undo_redo->add_do_method(animation.ptr(), "track_insert_key", E->key().track, newpos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
}
// 4 - (undo) remove inserted keys
for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
float newpos = snap_time(E->get().pos + motion);
undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", E->key().track, newpos);
}
// 5 - (undo) reinsert keys
for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
undo_redo->add_undo_method(animation.ptr(), "track_insert_key", E->key().track, E->get().pos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
}
@ -5147,7 +5147,7 @@ void AnimationTrackEditor::_move_selection_commit() {
undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
// 7 - reselect
for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
float oldpos = E->get().pos;
float newpos = snap_time(oldpos + motion);
@ -5304,7 +5304,7 @@ void AnimationTrackEditor::_anim_duplicate_keys(bool transpose) {
if (selection.size() && animation.is_valid() && (!transpose || (_get_track_selected() >= 0 && _get_track_selected() < animation->get_track_count()))) {
int top_track = 0x7FFFFFFF;
float top_time = 1e10;
for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
const SelectedKey &sk = E->key();
float t = animation->track_get_key_time(sk.track, sk.key);
@ -5325,7 +5325,7 @@ void AnimationTrackEditor::_anim_duplicate_keys(bool transpose) {
List<Pair<int, float>> new_selection_values;
for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
const SelectedKey &sk = E->key();
float t = animation->track_get_key_time(sk.track, sk.key);
@ -5360,7 +5360,7 @@ void AnimationTrackEditor::_anim_duplicate_keys(bool transpose) {
//reselect duplicated
Map<SelectedKey, KeyInfo> new_selection;
RBMap<SelectedKey, KeyInfo> new_selection;
for (List<Pair<int, float>>::Element *E = new_selection_values.front(); E; E = E->next()) {
int track = E->get().first;
float time = E->get().second;
@ -5607,7 +5607,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
float len = -1e20;
float pivot = 0;
for (Map<SelectedKey, KeyInfo>::Element *E = selection.front(); E; E = E->next()) {
for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.front(); E; E = E->next()) {
float t = animation->track_get_key_time(E->key().track, E->key().key);
if (t < from_t) {
from_t = t;
@ -5635,11 +5635,11 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
List<_AnimMoveRestore> to_restore;
// 1-remove the keys
for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
undo_redo->add_do_method(animation.ptr(), "track_remove_key", E->key().track, E->key().key);
}
// 2- remove overlapped keys
for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
float newtime = (E->get().pos - from_t) * s + from_t;
int idx = animation->track_find_key(E->key().track, newtime, true);
if (idx == -1) {
@ -5665,19 +5665,19 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
#define _NEW_POS(m_ofs) (((s > 0) ? m_ofs : from_t + (len - (m_ofs - from_t))) - pivot) * ABS(s) + from_t
// 3-move the keys (re insert them)
for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
float newpos = _NEW_POS(E->get().pos);
undo_redo->add_do_method(animation.ptr(), "track_insert_key", E->key().track, newpos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
}
// 4-(undo) remove inserted keys
for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
float newpos = _NEW_POS(E->get().pos);
undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", E->key().track, newpos);
}
// 5-(undo) reinsert keys
for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
undo_redo->add_undo_method(animation.ptr(), "track_insert_key", E->key().track, E->get().pos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
}
@ -5691,7 +5691,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
// 7-reselect
for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
float oldpos = E->get().pos;
float newpos = _NEW_POS(oldpos);
if (newpos >= 0) {
@ -5722,7 +5722,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
int reset_tracks = reset->get_track_count();
Set<int> tracks_added;
for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
const SelectedKey &sk = E->key();
// Only add one key per track.
@ -5774,7 +5774,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
if (selection.size()) {
undo_redo->create_action(TTR("Anim Delete Keys"));
for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
undo_redo->add_do_method(animation.ptr(), "track_remove_key", E->key().track, E->key().key);
undo_redo->add_undo_method(animation.ptr(), "track_insert_key", E->key().track, E->get().pos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
}

View File

@ -39,7 +39,7 @@
#include "core/variant/dictionary.h"
#include "core/containers/list.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/math/rect2.h"
#include "core/math/vector2.h"
#include "core/string/node_path.h"
@ -431,7 +431,7 @@ class AnimationTrackEditor : public VBoxContainer {
float pos;
};
Map<SelectedKey, KeyInfo> selection;
RBMap<SelectedKey, KeyInfo> selection;
void _key_selected(int p_key, bool p_single, int p_track);
void _key_deselected(int p_key, int p_track);

View File

@ -224,7 +224,7 @@ AudioStreamPreviewGenerator *AudioStreamPreviewGenerator::singleton = nullptr;
void AudioStreamPreviewGenerator::_notification(int p_what) {
if (p_what == NOTIFICATION_PROCESS) {
List<ObjectID> to_erase;
for (Map<ObjectID, Preview>::Element *E = previews.front(); E; E = E->next()) {
for (RBMap<ObjectID, Preview>::Element *E = previews.front(); E; E = E->next()) {
if (!E->get().generating.is_set()) {
if (E->get().thread) {
E->get().thread->wait_to_finish();

View File

@ -36,7 +36,7 @@
#include "scene/main/node.h"
#include "servers/audio/audio_stream.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/object/object.h"
#include "core/object/object_id.h"
#include "core/object/reference.h"
@ -85,7 +85,7 @@ class AudioStreamPreviewGenerator : public Node {
}
};
Map<ObjectID, Preview> previews;
RBMap<ObjectID, Preview> previews;
static void _preview_thread(void *p_preview);

View File

@ -1025,9 +1025,9 @@ void ConnectionsDock::update_tree() {
String descr;
bool found = false;
Map<StringName, Map<StringName, String>>::Element *G = descr_cache.find(base);
RBMap<StringName, RBMap<StringName, String>>::Element *G = descr_cache.find(base);
if (G) {
Map<StringName, String>::Element *F = G->get().find(signal_name);
RBMap<StringName, String>::Element *F = G->get().find(signal_name);
if (F) {
found = true;
descr = F->get();
@ -1036,7 +1036,7 @@ void ConnectionsDock::update_tree() {
if (!found) {
DocData *dd = EditorHelp::get_doc_data();
Map<String, DocData::ClassDoc>::Element *F = dd->class_list.find(base);
RBMap<String, DocData::ClassDoc>::Element *F = dd->class_list.find(base);
while (F && descr == String()) {
for (int i = 0; i < F->get().signals.size(); i++) {
if (F->get().signals[i].name == signal_name.operator String()) {

View File

@ -39,7 +39,7 @@
#include "scene/gui/box_container.h"
#include "core/object/undo_redo.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/string/node_path.h"
#include "core/object/object.h"
#include "core/string/string_name.h"
@ -153,7 +153,7 @@ class ConnectionsDock : public VBoxContainer {
UndoRedo *undo_redo;
LineEdit *search_box;
Map<StringName, Map<StringName, String>> descr_cache;
RBMap<StringName, RBMap<StringName, String>> descr_cache;
void _filter_changed(const String &p_text);

View File

@ -39,7 +39,7 @@
#include "scene/gui/box_container.h"
#include "core/math/color.h"
#include "core/variant/dictionary.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/math/rect2.h"
#include "core/os/file_access.h"
#include "core/input/input_event.h"

View File

@ -63,7 +63,7 @@
#include "scene/resources/texture.h"
void DependencyEditor::_searched(const String &p_path) {
Map<String, String> dep_rename;
RBMap<String, String> dep_rename;
dep_rename[replacing] = p_path;
ResourceLoader::rename_dependencies(editing, dep_rename);
@ -90,7 +90,7 @@ void DependencyEditor::_load_pressed(Object *p_item, int p_cell, int p_button) {
search->popup_centered_ratio(0.65); // So it doesn't completely cover the dialog below it.
}
void DependencyEditor::_fix_and_find(EditorFileSystemDirectory *efsd, Map<String, Map<String, String>> &candidates) {
void DependencyEditor::_fix_and_find(EditorFileSystemDirectory *efsd, RBMap<String, RBMap<String, String>> &candidates) {
for (int i = 0; i < efsd->get_subdir_count(); i++) {
_fix_and_find(efsd->get_subdir(i), candidates);
}
@ -103,7 +103,7 @@ void DependencyEditor::_fix_and_find(EditorFileSystemDirectory *efsd, Map<String
String path = efsd->get_file_path(i);
for (Map<String, String>::Element *E = candidates[file].front(); E; E = E->next()) {
for (RBMap<String, String>::Element *E = candidates[file].front(); E; E = E->next()) {
if (E->get() == String()) {
E->get() = path;
continue;
@ -147,12 +147,12 @@ void DependencyEditor::_fix_all() {
return;
}
Map<String, Map<String, String>> candidates;
RBMap<String, RBMap<String, String>> candidates;
for (List<String>::Element *E = missing.front(); E; E = E->next()) {
String base = E->get().get_file();
if (!candidates.has(base)) {
candidates[base] = Map<String, String>();
candidates[base] = RBMap<String, String>();
}
candidates[base][E->get()] = "";
@ -160,10 +160,10 @@ void DependencyEditor::_fix_all() {
_fix_and_find(EditorFileSystem::get_singleton()->get_filesystem(), candidates);
Map<String, String> remaps;
RBMap<String, String> remaps;
for (Map<String, Map<String, String>>::Element *E = candidates.front(); E; E = E->next()) {
for (Map<String, String>::Element *F = E->get().front(); F; F = F->next()) {
for (RBMap<String, RBMap<String, String>>::Element *E = candidates.front(); E; E = E->next()) {
for (RBMap<String, String>::Element *F = E->get().front(); F; F = F->next()) {
if (F->get() != String()) {
remaps[F->key()] = F->get();
}
@ -430,7 +430,7 @@ void DependencyRemoveDialog::_build_removed_dependency_tree(const Vector<Removed
owners->clear();
owners->create_item(); // root
Map<String, TreeItem *> tree_items;
RBMap<String, TreeItem *> tree_items;
for (int i = 0; i < p_removed.size(); i++) {
RemovedDependency rd = p_removed[i];

View File

@ -34,7 +34,7 @@
#include "core/containers/hash_map.h"
#include "core/containers/list.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/object/object.h"
#include "core/string/ustring.h"
#include "core/containers/vector.h"
@ -62,7 +62,7 @@ class DependencyEditor : public AcceptDialog {
String editing;
List<String> missing;
void _fix_and_find(EditorFileSystemDirectory *efsd, Map<String, Map<String, String>> &candidates);
void _fix_and_find(EditorFileSystemDirectory *efsd, RBMap<String, RBMap<String, String>> &candidates);
void _searched(const String &p_path);
void _load_pressed(Object *p_item, int p_cell, int p_button);
@ -110,7 +110,7 @@ class DependencyRemoveDialog : public ConfirmationDialog {
Label *text;
Tree *owners;
Map<String, String> all_remove_files;
RBMap<String, String> all_remove_files;
Vector<String> dirs_to_delete;
Vector<String> files_to_delete;

View File

@ -85,7 +85,7 @@ static String _translate_doc_string(const String &p_text) {
}
void DocData::merge_from(const DocData &p_data) {
for (Map<String, ClassDoc>::Element *E = class_list.front(); E; E = E->next()) {
for (RBMap<String, ClassDoc>::Element *E = class_list.front(); E; E = E->next()) {
ClassDoc &c = E->get();
if (!p_data.class_list.has(c.name)) {
@ -202,7 +202,7 @@ void DocData::merge_from(const DocData &p_data) {
}
void DocData::remove_from(const DocData &p_data) {
for (Map<String, ClassDoc>::Element *E = p_data.class_list.front(); E; E = E->next()) {
for (RBMap<String, ClassDoc>::Element *E = p_data.class_list.front(); E; E = E->next()) {
if (class_list.has(E->key())) {
class_list.erase(E->key());
}
@ -1091,8 +1091,8 @@ static void _write_string(FileAccess *f, int p_tablevel, const String &p_string)
f->store_string(tab + p_string + "\n");
}
Error DocData::save_classes(const String &p_default_path, const Map<String, String> &p_class_path) {
for (Map<String, ClassDoc>::Element *E = class_list.front(); E; E = E->next()) {
Error DocData::save_classes(const String &p_default_path, const RBMap<String, String> &p_class_path) {
for (RBMap<String, ClassDoc>::Element *E = class_list.front(); E; E = E->next()) {
ClassDoc &c = E->get();
String save_path;

View File

@ -30,7 +30,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/variant/variant.h"
#include "core/object/reference.h"
#include "core/error/error_list.h"
@ -121,7 +121,7 @@ public:
String version;
Map<String, ClassDoc> class_list;
RBMap<String, ClassDoc> class_list;
Error _load(Ref<XMLParser> parser);
public:
@ -130,7 +130,7 @@ public:
void generate(bool p_basic_types = false);
Error load_classes(const String &p_dir);
static Error erase_classes(const String &p_dir);
Error save_classes(const String &p_default_path, const Map<String, String> &p_class_path);
Error save_classes(const String &p_default_path, const RBMap<String, String> &p_class_path);
Error load_compressed(const uint8_t *p_data, int p_compressed_size, int p_uncompressed_size);
};

View File

@ -42,7 +42,7 @@
#include "core/variant/dictionary.h"
#include "core/error/error_macros.h"
#include "core/io/resource_loader.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/math/math_funcs.h"
#include "core/os/file_access.h"
#include "core/os/memory.h"
@ -408,7 +408,7 @@ void EditorAutoloadSettings::update_autoload() {
updating_autoload = true;
Map<String, AutoLoadInfo> to_remove;
RBMap<String, AutoLoadInfo> to_remove;
List<AutoLoadInfo *> to_add;
for (List<AutoLoadInfo>::Element *E = autoload_cache.front(); E; E = E->next()) {
@ -493,7 +493,7 @@ void EditorAutoloadSettings::update_autoload() {
}
// Remove deleted/changed autoloads
for (Map<String, AutoLoadInfo>::Element *E = to_remove.front(); E; E = E->next()) {
for (RBMap<String, AutoLoadInfo>::Element *E = to_remove.front(); E; E = E->next()) {
AutoLoadInfo &info = E->get();
if (info.is_singleton) {
for (int i = 0; i < ScriptServer::get_language_count(); i++) {

View File

@ -492,7 +492,7 @@ Variant EditorData::instance_custom_type(const String &p_type, const String &p_i
}
void EditorData::remove_custom_type(const String &p_type) {
for (Map<String, Vector<CustomType>>::Element *E = custom_types.front(); E; E = E->next()) {
for (RBMap<String, Vector<CustomType>>::Element *E = custom_types.front(); E; E = E->next()) {
for (int i = 0; i < E->get().size(); i++) {
if (E->get()[i].name == p_type) {
E->get().remove(i);
@ -1104,7 +1104,7 @@ Array EditorSelection::_get_transformable_selected_nodes() {
Array EditorSelection::get_selected_nodes() {
Array ret;
for (Map<Node *, Object *>::Element *E = selection.front(); E; E = E->next()) {
for (RBMap<Node *, Object *>::Element *E = selection.front(); E; E = E->next()) {
ret.push_back(E->key());
}
@ -1133,7 +1133,7 @@ void EditorSelection::_update_nl() {
selected_node_list.clear();
for (Map<Node *, Object *>::Element *E = selection.front(); E; E = E->next()) {
for (RBMap<Node *, Object *>::Element *E = selection.front(); E; E = E->next()) {
Node *parent = E->key();
parent = parent->get_parent();
bool skip = false;
@ -1183,7 +1183,7 @@ List<Node *> &EditorSelection::get_selected_node_list() {
List<Node *> EditorSelection::get_full_selected_node_list() {
List<Node *> node_list;
for (Map<Node *, Object *>::Element *E = selection.front(); E; E = E->next()) {
for (RBMap<Node *, Object *>::Element *E = selection.front(); E; E = E->next()) {
node_list.push_back(E->key());
}

View File

@ -41,7 +41,7 @@
#include "core/variant/array.h"
#include "core/variant/dictionary.h"
#include "core/containers/hash_map.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/string/node_path.h"
#include "core/object/object_id.h"
#include "core/object/reference.h"
@ -149,7 +149,7 @@ private:
String name;
Variant value;
};
Map<String, Vector<CustomType>> custom_types;
RBMap<String, Vector<CustomType>> custom_types;
List<PropertyData> clipboard;
UndoRedo undo_redo;
@ -193,7 +193,7 @@ public:
void add_custom_type(const String &p_type, const String &p_inherits, const Ref<Script> &p_script, const Ref<Texture> &p_icon);
Variant instance_custom_type(const String &p_type, const String &p_inherits);
void remove_custom_type(const String &p_type);
const Map<String, Vector<CustomType>> &get_custom_types() const { return custom_types; }
const RBMap<String, Vector<CustomType>> &get_custom_types() const { return custom_types; }
int add_edited_scene(int p_at_pos);
void move_edited_scene_index(int p_idx, int p_to_idx);
@ -251,7 +251,7 @@ class EditorSelection : public Object {
GDCLASS(EditorSelection, Object);
private:
Map<Node *, Object *> selection;
RBMap<Node *, Object *> selection;
bool emitted;
bool changed;
@ -290,7 +290,7 @@ public:
List<Node *> &get_selected_node_list();
List<Node *> get_full_selected_node_list();
Map<Node *, Object *> &get_selection() { return selection; }
RBMap<Node *, Object *> &get_selection() { return selection; }
EditorSelection();
~EditorSelection();

View File

@ -1556,7 +1556,7 @@ void EditorExport::load_config() {
}
void EditorExport::update_export_presets() {
Map<StringName, List<EditorExportPlatform::ExportOption>> platform_options;
RBMap<StringName, List<EditorExportPlatform::ExportOption>> platform_options;
for (int i = 0; i < export_platforms.size(); i++) {
Ref<EditorExportPlatform> platform = export_platforms[i];
@ -1578,7 +1578,7 @@ void EditorExport::update_export_presets() {
List<EditorExportPlatform::ExportOption> options = platform_options[preset->get_platform()->get_name()];
// Copy the previous preset values
Map<StringName, Variant> previous_values = preset->values;
RBMap<StringName, Variant> previous_values = preset->values;
// Clear the preset properties and values prior to reloading
preset->properties.clear();
@ -1734,7 +1734,7 @@ bool EditorExportPlatform::can_export(const Ref<EditorExportPreset> &p_preset, S
List<String> EditorExportPlatformPC::get_binary_extensions(const Ref<EditorExportPreset> &p_preset) const {
List<String> list;
for (Map<String, String>::Element *E = extensions.front(); E; E = E->next()) {
for (RBMap<String, String>::Element *E = extensions.front(); E; E = E->next()) {
if (p_preset->get(E->key())) {
list.push_back(extensions[E->key()]);
return list;

View File

@ -38,7 +38,7 @@
#include "scene/resources/texture.h"
#include "core/containers/list.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/containers/pool_vector.h"
#include "core/containers/set.h"
#include "core/containers/vector.h"
@ -89,8 +89,8 @@ private:
friend class EditorExportPlatform;
List<PropertyInfo> properties;
Map<StringName, Variant> values;
Map<StringName, bool> update_visibility;
RBMap<StringName, Variant> values;
RBMap<StringName, bool> update_visibility;
String name;
@ -297,7 +297,7 @@ public:
virtual void get_export_options(List<ExportOption> *r_options) = 0;
virtual bool should_update_export_options() { return false; }
virtual bool get_option_visibility(const EditorExportPreset *p_preset, const String &p_option, const Map<StringName, Variant> &p_options) const { return true; }
virtual bool get_option_visibility(const EditorExportPreset *p_preset, const String &p_option, const RBMap<StringName, Variant> &p_options) const { return true; }
virtual String get_os_name() const = 0;
virtual String get_name() const = 0;
@ -481,7 +481,7 @@ private:
Ref<ImageTexture> logo;
String name;
String os_name;
Map<String, String> extensions;
RBMap<String, String> extensions;
String release_file_32;
String release_file_64;

View File

@ -1524,8 +1524,8 @@ Set<String> EditorFileSystem::get_valid_extensions() const {
Error EditorFileSystem::_reimport_group(const String &p_group_file, const Vector<String> &p_files) {
String importer_name;
Map<String, Map<StringName, Variant>> source_file_options;
Map<String, String> base_paths;
RBMap<String, RBMap<StringName, Variant>> source_file_options;
RBMap<String, String> base_paths;
for (int i = 0; i < p_files.size(); i++) {
Ref<ConfigFile> config;
config.instance();
@ -1541,7 +1541,7 @@ Error EditorFileSystem::_reimport_group(const String &p_group_file, const Vector
ERR_FAIL_V(ERR_FILE_CORRUPT);
}
source_file_options[p_files[i]] = Map<StringName, Variant>();
source_file_options[p_files[i]] = RBMap<StringName, Variant>();
importer_name = file_importer_name;
if (importer_name == "keep") {
@ -1582,7 +1582,7 @@ Error EditorFileSystem::_reimport_group(const String &p_group_file, const Vector
Error err = importer->import_group_file(p_group_file, source_file_options, base_paths);
//all went well, overwrite config files with proper remaps and md5s
for (Map<String, Map<StringName, Variant>>::Element *E = source_file_options.front(); E; E = E->next()) {
for (RBMap<String, RBMap<StringName, Variant>>::Element *E = source_file_options.front(); E; E = E->next()) {
const String &file = E->key();
String base_path = ResourceFormatImporter::get_singleton()->get_import_base_path(file);
FileAccessRef f = FileAccess::open(file + ".import", FileAccess::WRITE);
@ -1692,7 +1692,7 @@ void EditorFileSystem::_reimport_file(const String &p_file) {
//try to obtain existing params
Map<StringName, Variant> params;
RBMap<StringName, Variant> params;
String importer_name;
if (FileAccess::exists(p_file + ".import")) {
@ -1893,7 +1893,7 @@ void EditorFileSystem::_reimport_file(const String &p_file) {
EditorResourcePreview::get_singleton()->check_for_invalidation(p_file);
}
void EditorFileSystem::_find_group_files(EditorFileSystemDirectory *efd, Map<String, Vector<String>> &group_files, Set<String> &groups_to_reimport) {
void EditorFileSystem::_find_group_files(EditorFileSystemDirectory *efd, RBMap<String, Vector<String>> &group_files, Set<String> &groups_to_reimport) {
int fc = efd->files.size();
const EditorFileSystemDirectory::FileInfo *const *files = efd->files.ptr();
for (int i = 0; i < fc; i++) {
@ -1983,9 +1983,9 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
//reimport groups
if (groups_to_reimport.size()) {
Map<String, Vector<String>> group_files;
RBMap<String, Vector<String>> group_files;
_find_group_files(filesystem, group_files, groups_to_reimport);
for (Map<String, Vector<String>>::Element *E = group_files.front(); E; E = E->next()) {
for (RBMap<String, Vector<String>>::Element *E = group_files.front(); E; E = E->next()) {
Error err = _reimport_group(E->key(), E->get());
if (err == OK) {
_reimport_file(E->key());

View File

@ -41,7 +41,7 @@
#include "core/error/error_list.h"
#include "core/containers/hash_map.h"
#include "core/containers/list.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/string/string_name.h"
#include "core/string/ustring.h"
#include "core/containers/vector.h"
@ -250,7 +250,7 @@ class EditorFileSystem : public Node {
bool using_fat32_or_exfat; // Workaround for projects in FAT32 or exFAT filesystem (pendrives, most of the time)
void _find_group_files(EditorFileSystemDirectory *efd, Map<String, Vector<String>> &group_files, Set<String> &groups_to_reimport);
void _find_group_files(EditorFileSystemDirectory *efd, RBMap<String, Vector<String>> &group_files, Set<String> &groups_to_reimport);
void _move_group_files(EditorFileSystemDirectory *efd, const String &p_group_file, const String &p_new_location);

View File

@ -129,7 +129,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;
RBMap<String, int> *table = nullptr;
if (tag == "method") {
topic = "class_method";
@ -454,7 +454,7 @@ void EditorHelp::_update_doc() {
bool prev = false;
class_desc->push_font(doc_font);
for (Map<String, DocData::ClassDoc>::Element *E = doc->class_list.front(); E; E = E->next()) {
for (RBMap<String, DocData::ClassDoc>::Element *E = doc->class_list.front(); E; E = E->next()) {
if (E->get().inherits == cd.name) {
if (!found) {
class_desc->push_color(title_color);
@ -770,7 +770,7 @@ void EditorHelp::_update_doc() {
class_desc->push_indent(1);
String theme_data_type;
Map<String, String> data_type_names;
RBMap<String, String> data_type_names;
data_type_names["color"] = TTR("Colors");
data_type_names["constant"] = TTR("Constants");
data_type_names["font"] = TTR("Fonts");
@ -915,7 +915,7 @@ void EditorHelp::_update_doc() {
// Constants and enums
if (cd.constants.size()) {
Map<String, Vector<DocData::ConstantDoc>> enums;
RBMap<String, Vector<DocData::ConstantDoc>> enums;
Vector<DocData::ConstantDoc> constants;
for (int i = 0; i < cd.constants.size(); i++) {
@ -942,7 +942,7 @@ void EditorHelp::_update_doc() {
class_desc->add_newline();
for (Map<String, Vector<DocData::ConstantDoc>>::Element *E = enums.front(); E; E = E->next()) {
for (RBMap<String, Vector<DocData::ConstantDoc>>::Element *E = enums.front(); E; E = E->next()) {
enum_line[E->key()] = class_desc->get_line_count() - 2;
class_desc->push_font(doc_code_font);
@ -968,7 +968,7 @@ void EditorHelp::_update_doc() {
class_desc->push_indent(1);
Vector<DocData::ConstantDoc> enum_list = E->get();
Map<String, int> enumValuesContainer;
RBMap<String, int> enumValuesContainer;
int enumStartingLine = enum_line[E->key()];
for (int i = 0; i < enum_list.size(); i++) {
@ -1136,7 +1136,7 @@ void EditorHelp::_update_doc() {
class_desc->pop(); // font
class_desc->pop(); // cell
Map<String, DocData::MethodDoc> method_map;
RBMap<String, DocData::MethodDoc> method_map;
for (int j = 0; j < methods.size(); j++) {
method_map[methods[j].name] = methods[j];
}
@ -1320,7 +1320,7 @@ void EditorHelp::_help_callback(const String &p_topic) {
if (constant_line.has(name)) {
line = constant_line[name];
} else {
Map<String, Map<String, int>>::Element *iter = enum_values_line.front();
RBMap<String, RBMap<String, int>>::Element *iter = enum_values_line.front();
while (true) {
if (iter->value().has(name)) {
line = iter->value()[name];

View File

@ -38,7 +38,7 @@
#include "core/math/color.h"
#include "core/error/error_list.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/object/object.h"
#include "core/object/reference.h"
#include "core/string/ustring.h"
@ -116,13 +116,13 @@ class EditorHelp : public VBoxContainer {
String edited_class;
Vector<Pair<String, int>> section_line;
Map<String, int> method_line;
Map<String, int> signal_line;
Map<String, int> property_line;
Map<String, int> theme_property_line;
Map<String, int> constant_line;
Map<String, int> enum_line;
Map<String, Map<String, int>> enum_values_line;
RBMap<String, int> method_line;
RBMap<String, int> signal_line;
RBMap<String, int> property_line;
RBMap<String, int> theme_property_line;
RBMap<String, int> constant_line;
RBMap<String, int> enum_line;
RBMap<String, RBMap<String, int>> enum_values_line;
int description_line;
RichTextLabel *class_desc;

View File

@ -34,7 +34,7 @@
#include "scene/gui/dialogs.h"
#include "core/math/color.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/object/object.h"
#include "core/string/ustring.h"
#include "core/containers/vector.h"
@ -132,11 +132,11 @@ class EditorHelpSearch::Runner : public Reference {
Ref<Texture> empty_icon;
Color disabled_color;
Map<String, DocData::ClassDoc>::Element *iterator_doc;
Map<String, ClassMatch> matches;
Map<String, ClassMatch>::Element *iterator_match;
RBMap<String, DocData::ClassDoc>::Element *iterator_doc;
RBMap<String, ClassMatch> matches;
RBMap<String, ClassMatch>::Element *iterator_match;
TreeItem *root_item;
Map<String, TreeItem *> class_items;
RBMap<String, TreeItem *> class_items;
TreeItem *matched_item;
float match_highest_score = 0;

View File

@ -1420,7 +1420,7 @@ void EditorInspector::update_tree() {
object->get_property_list(&plist, true);
HashMap<String, VBoxContainer *> item_path;
Map<VBoxContainer *, EditorInspectorSection *> section_map;
RBMap<VBoxContainer *, EditorInspectorSection *> section_map;
item_path[""] = main_vbox;
@ -1482,7 +1482,7 @@ void EditorInspector::update_tree() {
if (!class_descr_cache.has(type2)) {
String descr;
DocData *dd = EditorHelp::get_doc_data();
Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(type2);
RBMap<String, DocData::ClassDoc>::Element *E = dd->class_list.find(type2);
if (E) {
descr = DTR(E->get().brief_description);
}
@ -1631,9 +1631,9 @@ void EditorInspector::update_tree() {
String descr;
bool found = false;
Map<StringName, Map<StringName, String>>::Element *E = descr_cache.find(classname);
RBMap<StringName, RBMap<StringName, String>>::Element *E = descr_cache.find(classname);
if (E) {
Map<StringName, String>::Element *F = E->get().find(propname);
RBMap<StringName, String>::Element *F = E->get().find(propname);
if (F) {
found = true;
descr = F->get();
@ -1642,7 +1642,7 @@ void EditorInspector::update_tree() {
if (!found) {
DocData *dd = EditorHelp::get_doc_data();
Map<String, DocData::ClassDoc>::Element *F = dd->class_list.find(classname);
RBMap<String, DocData::ClassDoc>::Element *F = dd->class_list.find(classname);
while (F && descr == String()) {
for (int i = 0; i < F->get().properties.size(); i++) {
if (F->get().properties[i].name == propname.operator String()) {
@ -1887,7 +1887,7 @@ void EditorInspector::collapse_all_folding() {
E->get()->fold();
}
for (Map<StringName, List<EditorProperty *>>::Element *F = editor_property_map.front(); F; F = F->next()) {
for (RBMap<StringName, List<EditorProperty *>>::Element *F = editor_property_map.front(); F; F = F->next()) {
for (List<EditorProperty *>::Element *E = F->get().front(); E; E = E->next()) {
E->get()->collapse_all_folding();
}
@ -1898,7 +1898,7 @@ void EditorInspector::expand_all_folding() {
for (List<EditorInspectorSection *>::Element *E = sections.front(); E; E = E->next()) {
E->get()->unfold();
}
for (Map<StringName, List<EditorProperty *>>::Element *F = editor_property_map.front(); F; F = F->next()) {
for (RBMap<StringName, List<EditorProperty *>>::Element *F = editor_property_map.front(); F; F = F->next()) {
for (List<EditorProperty *>::Element *E = F->get().front(); E; E = E->next()) {
E->get()->expand_all_folding();
}
@ -2152,7 +2152,7 @@ void EditorInspector::_property_selected(const String &p_path, int p_focusable)
property_selected = p_path;
property_focusable = p_focusable;
//deselect the others
for (Map<StringName, List<EditorProperty *>>::Element *F = editor_property_map.front(); F; F = F->next()) {
for (RBMap<StringName, List<EditorProperty *>>::Element *F = editor_property_map.front(); F; F = F->next()) {
if (F->key() == property_selected) {
continue;
}
@ -2208,7 +2208,7 @@ void EditorInspector::_notification(int p_what) {
if (refresh_countdown > 0) {
refresh_countdown -= get_process_delta_time();
if (refresh_countdown <= 0) {
for (Map<StringName, List<EditorProperty *>>::Element *F = editor_property_map.front(); F; F = F->next()) {
for (RBMap<StringName, List<EditorProperty *>>::Element *F = editor_property_map.front(); F; F = F->next()) {
for (List<EditorProperty *>::Element *E = F->get().front(); E; E = E->next()) {
E->get()->update_property();
E->get()->update_revert_and_pin_status();

View File

@ -36,7 +36,7 @@
#include "scene/gui/scroll_container.h"
#include "core/containers/list.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/math/color.h"
#include "core/math/rect2.h"
#include "core/math/vector2.h"
@ -292,7 +292,7 @@ class EditorInspector : public ScrollContainer {
VBoxContainer *main_vbox;
//map use to cache the instanced editors
Map<StringName, List<EditorProperty *>> editor_property_map;
RBMap<StringName, List<EditorProperty *>> editor_property_map;
List<EditorInspectorSection *> sections;
Set<StringName> pending;
@ -322,11 +322,11 @@ class EditorInspector : public ScrollContainer {
int property_focusable;
int update_scroll_request;
Map<StringName, Map<StringName, String>> descr_cache;
Map<StringName, String> class_descr_cache;
RBMap<StringName, RBMap<StringName, String>> descr_cache;
RBMap<StringName, String> class_descr_cache;
Set<StringName> restart_request_props;
Map<ObjectID, int> scroll_cache;
RBMap<ObjectID, int> scroll_cache;
String property_prefix; //used for sectioned inspector
String object_class;

View File

@ -71,7 +71,7 @@ void EditorNetworkProfiler::_update_frame() {
TreeItem *root = counters_display->create_item();
for (Map<ObjectID, MultiplayerAPI::ProfilingInfo>::Element *E = nodes_data.front(); E; E = E->next()) {
for (RBMap<ObjectID, MultiplayerAPI::ProfilingInfo>::Element *E = nodes_data.front(); E; E = E->next()) {
TreeItem *node = counters_display->create_item(root);
for (int j = 0; j < counters_display->get_columns(); ++j) {

View File

@ -33,7 +33,7 @@
#include "scene/gui/box_container.h"
#include "core/io/multiplayer_api.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/object/object.h"
#include "core/object/object_id.h"
@ -54,7 +54,7 @@ private:
Timer *frame_delay;
Map<ObjectID, MultiplayerAPI::ProfilingInfo> nodes_data;
RBMap<ObjectID, MultiplayerAPI::ProfilingInfo> nodes_data;
void _update_frame();

View File

@ -204,7 +204,7 @@ void EditorNode::disambiguate_filenames(const Vector<String> p_full_paths, Vecto
// Keep track of a list of "index sets," i.e. sets of indices
// within disambiguated_scene_names which contain the same name.
Vector<Set<int>> index_sets;
Map<String, int> scene_name_to_set_index;
RBMap<String, int> scene_name_to_set_index;
for (int i = 0; i < r_filenames.size(); i++) {
String scene_name = r_filenames[i];
if (!scene_name_to_set_index.has(scene_name)) {
@ -1288,7 +1288,7 @@ void EditorNode::_set_scene_metadata(const String &p_file, int p_idx) {
ERR_FAIL_COND_MSG(err != OK, "Cannot save config file to '" + path + "'.");
}
bool EditorNode::_find_and_save_resource(RES p_res, Map<RES, bool> &processed, int32_t flags) {
bool EditorNode::_find_and_save_resource(RES p_res, RBMap<RES, bool> &processed, int32_t flags) {
if (p_res.is_null()) {
return false;
}
@ -1315,7 +1315,7 @@ bool EditorNode::_find_and_save_resource(RES p_res, Map<RES, bool> &processed, i
}
}
bool EditorNode::_find_and_save_edited_subresources(Object *obj, Map<RES, bool> &processed, int32_t flags) {
bool EditorNode::_find_and_save_edited_subresources(Object *obj, RBMap<RES, bool> &processed, int32_t flags) {
bool ret_changed = false;
List<PropertyInfo> pi;
obj->get_property_list(&pi);
@ -1365,7 +1365,7 @@ bool EditorNode::_find_and_save_edited_subresources(Object *obj, Map<RES, bool>
return ret_changed;
}
void EditorNode::_save_edited_subresources(Node *scene, Map<RES, bool> &processed, int32_t flags) {
void EditorNode::_save_edited_subresources(Node *scene, RBMap<RES, bool> &processed, int32_t flags) {
_find_and_save_edited_subresources(scene, processed, flags);
for (int i = 0; i < scene->get_child_count(); i++) {
@ -1941,7 +1941,7 @@ void EditorNode::_save_default_environment() {
Ref<Environment3D> fallback = get_tree()->get_root()->get_world_3d()->get_fallback_environment();
if (fallback.is_valid() && fallback->get_path().is_resource_file()) {
Map<RES, bool> processed;
RBMap<RES, bool> processed;
_find_and_save_edited_subresources(fallback.ptr(), processed, 0);
save_resource_in_path(fallback, fallback->get_path());
}
@ -3220,7 +3220,7 @@ void EditorNode::_update_addon_config() {
Vector<String> enabled_addons;
for (Map<String, EditorPlugin *>::Element *E = plugin_addons.front(); E; E = E->next()) {
for (RBMap<String, EditorPlugin *>::Element *E = plugin_addons.front(); E; E = E->next()) {
enabled_addons.push_back(E->key());
}
@ -3614,7 +3614,7 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b
dependency_errors.erase(lpath); //at least not self path
for (Map<String, Set<String>>::Element *E = dependency_errors.front(); E; E = E->next()) {
for (RBMap<String, Set<String>>::Element *E = dependency_errors.front(); E; E = E->next()) {
String txt = vformat(TTR("Scene '%s' has broken dependencies:"), E->key()) + "\n";
for (Set<String>::Element *F = E->get().front(); F; F = F->next()) {
txt += "\t" + F->get() + "\n";
@ -4074,8 +4074,8 @@ Ref<Texture> EditorNode::get_class_icon(const String &p_class, const String &p_f
}
}
const Map<String, Vector<EditorData::CustomType>> &p_map = EditorNode::get_editor_data().get_custom_types();
for (const Map<String, Vector<EditorData::CustomType>>::Element *E = p_map.front(); E; E = E->next()) {
const RBMap<String, Vector<EditorData::CustomType>> &p_map = EditorNode::get_editor_data().get_custom_types();
for (const RBMap<String, Vector<EditorData::CustomType>>::Element *E = p_map.front(); E; E = E->next()) {
const Vector<EditorData::CustomType> &ct = E->value();
for (int i = 0; i < ct.size(); ++i) {
if (ct[i].name == p_class) {

View File

@ -42,7 +42,7 @@
#include "scene/gui/split_container.h"
#include "core/containers/list.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/containers/set.h"
#include "core/containers/vector.h"
#include "core/error/error_list.h"
@ -822,12 +822,12 @@ private:
Set<FileDialog *> file_dialogs;
Set<EditorFileDialog *> editor_file_dialogs;
Map<String, Ref<Texture>> icon_type_cache;
Map<Ref<Script>, Ref<Texture>> script_icon_cache;
RBMap<String, Ref<Texture>> icon_type_cache;
RBMap<Ref<Script>, Ref<Texture>> script_icon_cache;
void _build_icon_type_cache();
bool _initializing_addons;
Map<String, EditorPlugin *> plugin_addons;
RBMap<String, EditorPlugin *> plugin_addons;
static Ref<Texture> _file_dialog_get_icon(const String &p_path);
static void _file_dialog_register(FileDialog *p_dialog);
@ -837,15 +837,15 @@ private:
void _remove_edited_scene(bool p_change_tab = true);
void _remove_scene(int index, bool p_change_tab = true);
bool _find_and_save_resource(RES p_res, Map<RES, bool> &processed, int32_t flags);
bool _find_and_save_edited_subresources(Object *obj, Map<RES, bool> &processed, int32_t flags);
void _save_edited_subresources(Node *scene, Map<RES, bool> &processed, int32_t flags);
bool _find_and_save_resource(RES p_res, RBMap<RES, bool> &processed, int32_t flags);
bool _find_and_save_edited_subresources(Object *obj, RBMap<RES, bool> &processed, int32_t flags);
void _save_edited_subresources(Node *scene, RBMap<RES, bool> &processed, int32_t flags);
void _mark_unsaved_scenes();
void _find_node_types(Node *p_node, int &count_2d, int &count_3d);
void _save_scene_with_preview(String p_file, int p_idx = -1);
Map<String, Set<String>> dependency_errors;
RBMap<String, Set<String>> dependency_errors;
static void _dependency_error_report(void *ud, const String &p_path, const String &p_dep, const String &p_type) {
EditorNode *en = (EditorNode *)ud;

View File

@ -211,12 +211,12 @@ void EditorProfiler::_update_plot() {
}
for (Set<StringName>::Element *E = plot_sigs.front(); E; E = E->next()) {
const Map<StringName, Metric::Category *>::Element *F = m.category_ptrs.find(E->get());
const RBMap<StringName, Metric::Category *>::Element *F = m.category_ptrs.find(E->get());
if (F) {
highest = MAX(F->get()->total_time, highest);
}
const Map<StringName, Metric::Category::Item *>::Element *G = m.item_ptrs.find(E->get());
const RBMap<StringName, Metric::Category::Item *>::Element *G = m.item_ptrs.find(E->get());
if (G) {
if (use_self) {
highest = MAX(G->get()->self, highest);
@ -237,7 +237,7 @@ void EditorProfiler::_update_plot() {
int *column = columnv.ptrw();
Map<StringName, int> plot_prev;
RBMap<StringName, int> plot_prev;
//Map<StringName,int> plot_max;
for (int i = 0; i < w; i++) {
@ -272,12 +272,12 @@ void EditorProfiler::_update_plot() {
float value = 0;
const Map<StringName, Metric::Category *>::Element *F = m.category_ptrs.find(E->get());
const RBMap<StringName, Metric::Category *>::Element *F = m.category_ptrs.find(E->get());
if (F) {
value = F->get()->total_time;
}
const Map<StringName, Metric::Category::Item *>::Element *G = m.item_ptrs.find(E->get());
const RBMap<StringName, Metric::Category::Item *>::Element *G = m.item_ptrs.find(E->get());
if (G) {
if (use_self) {
value = G->get()->self;
@ -290,7 +290,7 @@ void EditorProfiler::_update_plot() {
}
int prev_plot = plot_pos;
Map<StringName, int>::Element *H = plot_prev.find(E->get());
RBMap<StringName, int>::Element *H = plot_prev.find(E->get());
if (H) {
prev_plot = H->get();
H->get() = plot_pos;
@ -637,16 +637,16 @@ Vector<Vector<String>> EditorProfiler::get_data_as_csv() const {
if (!m.valid) {
continue;
}
for (Map<StringName, Metric::Category *>::Element *E = m.category_ptrs.front(); E; E = E->next()) {
for (RBMap<StringName, Metric::Category *>::Element *E = m.category_ptrs.front(); E; E = E->next()) {
possible_signatures.insert(E->key());
}
for (Map<StringName, Metric::Category::Item *>::Element *E = m.item_ptrs.front(); E; E = E->next()) {
for (RBMap<StringName, Metric::Category::Item *>::Element *E = m.item_ptrs.front(); E; E = E->next()) {
possible_signatures.insert(E->key());
}
}
// Generate CSV header and cache indices.
Map<StringName, int> sig_map;
RBMap<StringName, int> sig_map;
Vector<String> signatures;
signatures.resize(possible_signatures.size());
int sig_index = 0;
@ -679,10 +679,10 @@ Vector<Vector<String>> EditorProfiler::get_data_as_csv() const {
values.clear();
values.resize(possible_signatures.size());
for (Map<StringName, Metric::Category *>::Element *E = m.category_ptrs.front(); E; E = E->next()) {
for (RBMap<StringName, Metric::Category *>::Element *E = m.category_ptrs.front(); E; E = E->next()) {
values.write[sig_map[E->key()]] = String::num_real(E->value()->total_time);
}
for (Map<StringName, Metric::Category::Item *>::Element *E = m.item_ptrs.front(); E; E = E->next()) {
for (RBMap<StringName, Metric::Category::Item *>::Element *E = m.item_ptrs.front(); E; E = E->next()) {
values.write[sig_map[E->key()]] = String::num_real(E->value()->total);
}

View File

@ -33,7 +33,7 @@
#include "scene/gui/box_container.h"
#include "core/math/color.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/object/object.h"
#include "core/containers/pool_vector.h"
#include "core/object/reference.h"
@ -87,8 +87,8 @@ public:
Vector<Category> categories;
Map<StringName, Category *> category_ptrs;
Map<StringName, Category::Item *> item_ptrs;
RBMap<StringName, Category *> category_ptrs;
RBMap<StringName, Category::Item *> item_ptrs;
Metric() {
valid = false;

View File

@ -40,7 +40,7 @@ String EditorPropertyNameProcessor::_capitalize_name(const String &p_name) const
String capitalized_string = p_name.capitalize();
// Fix the casing of a few strings commonly found in editor property/setting names.
for (Map<String, String>::Element *E = capitalize_string_remaps.front(); E; E = E->next()) {
for (RBMap<String, String>::Element *E = capitalize_string_remaps.front(); E; E = E->next()) {
capitalized_string = capitalized_string.replace(E->key(), E->value());
}

View File

@ -32,7 +32,7 @@
#include "scene/main/node.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/object/object.h"
#include "core/string/ustring.h"
@ -41,7 +41,7 @@ class EditorPropertyNameProcessor : public Node {
static EditorPropertyNameProcessor *singleton;
Map<String, String> capitalize_string_remaps;
RBMap<String, String> capitalize_string_remaps;
String _capitalize_name(const String &p_name) const;

View File

@ -41,7 +41,7 @@
#include "core/variant/dictionary.h"
#include "core/error/error_macros.h"
#include "core/io/resource_loader.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/math/math_defs.h"
#include "core/math/rect2.h"
#include "core/input/input_event.h"

View File

@ -37,7 +37,7 @@
#include "core/os/thread.h"
#include "core/os/safe_refcount.h"
#include "core/containers/list.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/math/vector2.h"
#include "core/object/object.h"
#include "core/object/object_id.h"
@ -98,7 +98,7 @@ class EditorResourcePreview : public Node {
int order;
Map<String, Item> cache;
RBMap<String, Item> cache;
void _preview_ready(const String &p_str, const Ref<Texture> &p_texture, const Ref<Texture> &p_small_texture, ObjectID id, const StringName &p_func, const Variant &p_ud);
void _generate_preview(Ref<ImageTexture> &r_texture, Ref<ImageTexture> &r_small_texture, const QueueItem &p_item, const String &cache_base);

View File

@ -80,7 +80,7 @@ void EditorRunNative::_notification(int p_what) {
bool changed = EditorExport::get_singleton()->poll_export_platforms() || first;
if (changed) {
for (Map<int, MenuButton *>::Element *E = menus.front(); E; E = E->next()) {
for (RBMap<int, MenuButton *>::Element *E = menus.front(); E; E = E->next()) {
Ref<EditorExportPlatform> eep = EditorExport::get_singleton()->get_export_platform(E->key());
MenuButton *mb = E->get();
int dc = eep->get_options_count();

View File

@ -32,7 +32,7 @@
#include "scene/gui/box_container.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/object/object.h"
class MenuButton;
@ -45,7 +45,7 @@ class EditorRunNative : public HBoxContainer {
RichTextLabel *result_dialog_log;
AcceptDialog *result_dialog;
Map<int, MenuButton *> menus;
RBMap<int, MenuButton *> menus;
bool first;
bool deploy_dumb;
bool deploy_debug_remote;

View File

@ -32,7 +32,7 @@
#include "scene/gui/split_container.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/object/object.h"
#include "core/object/object_id.h"
#include "core/string/ustring.h"
@ -51,7 +51,7 @@ class SectionedInspector : public HSplitContainer {
Tree *sections;
SectionedInspectorFilter *filter;
Map<String, TreeItem *> section_map;
RBMap<String, TreeItem *> section_map;
EditorInspector *inspector;
LineEdit *search_box;

View File

@ -131,7 +131,7 @@ bool EditorSettings::_get(const StringName &p_name, Variant &r_ret) const {
if (p_name.operator String() == "shortcuts") {
Array arr;
for (const Map<String, Ref<ShortCut>>::Element *E = shortcuts.front(); E; E = E->next()) {
for (const RBMap<String, Ref<ShortCut>>::Element *E = shortcuts.front(); E; E = E->next()) {
Ref<ShortCut> sc = E->get();
if (optimize_save) {
@ -1499,14 +1499,14 @@ void EditorSettings::add_shortcut(const String &p_name, Ref<ShortCut> &p_shortcu
}
bool EditorSettings::is_shortcut(const String &p_name, const Ref<InputEvent> &p_event) const {
const Map<String, Ref<ShortCut>>::Element *E = shortcuts.find(p_name);
const RBMap<String, Ref<ShortCut>>::Element *E = shortcuts.find(p_name);
ERR_FAIL_COND_V_MSG(!E, false, "Unknown Shortcut: " + p_name + ".");
return E->get()->is_shortcut(p_event);
}
Ref<ShortCut> EditorSettings::get_shortcut(const String &p_name) const {
const Map<String, Ref<ShortCut>>::Element *E = shortcuts.find(p_name);
const RBMap<String, Ref<ShortCut>>::Element *E = shortcuts.find(p_name);
if (!E) {
return Ref<ShortCut>();
}
@ -1515,7 +1515,7 @@ Ref<ShortCut> EditorSettings::get_shortcut(const String &p_name) const {
}
void EditorSettings::get_shortcut_list(List<String> *r_shortcuts) {
for (const Map<String, Ref<ShortCut>>::Element *E = shortcuts.front(); E; E = E->next()) {
for (const RBMap<String, Ref<ShortCut>>::Element *E = shortcuts.front(); E; E = E->next()) {
r_shortcuts->push_back(E->key());
}
}

View File

@ -40,7 +40,7 @@
#include "core/string/translation.h"
#include "core/containers/hash_map.h"
#include "core/containers/list.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/object/reference.h"
#include "core/string/string_name.h"
#include "core/string/ustring.h"
@ -103,7 +103,7 @@ private:
int last_order;
Ref<Resource> clipboard;
Map<String, Ref<ShortCut>> shortcuts;
RBMap<String, Ref<ShortCut>> shortcuts;
String resource_path;
String settings_dir;

View File

@ -48,7 +48,7 @@ class EditorFileServer : public Object {
struct ClientData {
Thread *thread;
Ref<StreamPeerTCP> connection;
Map<int, FileAccess *> files;
RBMap<int, FileAccess *> files;
EditorFileServer *efs;
bool quit;
};

View File

@ -1098,7 +1098,7 @@ void FileSystemDock::_get_all_items_in_dir(EditorFileSystemDirectory *efsd, Vect
}
}
void FileSystemDock::_find_remaps(EditorFileSystemDirectory *efsd, const Map<String, String> &renames, Vector<String> &to_remaps) const {
void FileSystemDock::_find_remaps(EditorFileSystemDirectory *efsd, const RBMap<String, String> &renames, Vector<String> &to_remaps) const {
for (int i = 0; i < efsd->get_subdir_count(); i++) {
_find_remaps(efsd->get_subdir(i), renames, to_remaps);
}
@ -1114,7 +1114,7 @@ void FileSystemDock::_find_remaps(EditorFileSystemDirectory *efsd, const Map<Str
}
void FileSystemDock::_try_move_item(const FileOrFolder &p_item, const String &p_new_path,
Map<String, String> &p_file_renames, Map<String, String> &p_folder_renames) {
RBMap<String, String> &p_file_renames, RBMap<String, String> &p_folder_renames) {
// Ensure folder paths end with "/".
String old_path = (p_item.is_file || p_item.path.ends_with("/")) ? p_item.path : (p_item.path + "/");
String new_path = (p_item.is_file || p_new_path.ends_with("/")) ? p_new_path : (p_new_path + "/");
@ -1216,7 +1216,7 @@ void FileSystemDock::_try_duplicate_item(const FileOrFolder &p_item, const Strin
memdelete(da);
}
void FileSystemDock::_update_resource_paths_after_move(const Map<String, String> &p_renames) const {
void FileSystemDock::_update_resource_paths_after_move(const RBMap<String, String> &p_renames) const {
// Rename all resources loaded, be it subresources or actual resources.
List<Ref<Resource>> cached;
ResourceCache::get_cached_resources(&cached);
@ -1263,7 +1263,7 @@ void FileSystemDock::_update_resource_paths_after_move(const Map<String, String>
}
}
void FileSystemDock::_update_dependencies_after_move(const Map<String, String> &p_renames) const {
void FileSystemDock::_update_dependencies_after_move(const RBMap<String, String> &p_renames) const {
// The following code assumes that the following holds:
// 1) EditorFileSystem contains the old paths/folder structure from before the rename/move.
// 2) ResourceLoader can use the new paths without needing to call rescan.
@ -1284,10 +1284,10 @@ void FileSystemDock::_update_dependencies_after_move(const Map<String, String> &
}
}
void FileSystemDock::_update_project_settings_after_move(const Map<String, String> &p_renames) const {
void FileSystemDock::_update_project_settings_after_move(const RBMap<String, String> &p_renames) const {
// Find all project settings of type FILE and replace them if needed.
const Map<StringName, PropertyInfo> prop_info = ProjectSettings::get_singleton()->get_custom_property_info();
for (const Map<StringName, PropertyInfo>::Element *E = prop_info.front(); E; E = E->next()) {
const RBMap<StringName, PropertyInfo> prop_info = ProjectSettings::get_singleton()->get_custom_property_info();
for (const RBMap<StringName, PropertyInfo>::Element *E = prop_info.front(); E; E = E->next()) {
if (E->get().hint == PROPERTY_HINT_FILE) {
String old_path = GLOBAL_GET(E->key());
if (p_renames.has(old_path)) {
@ -1315,7 +1315,7 @@ void FileSystemDock::_update_project_settings_after_move(const Map<String, Strin
ProjectSettings::get_singleton()->save();
}
void FileSystemDock::_update_favorites_list_after_move(const Map<String, String> &p_files_renames, const Map<String, String> &p_folders_renames) const {
void FileSystemDock::_update_favorites_list_after_move(const RBMap<String, String> &p_files_renames, const RBMap<String, String> &p_folders_renames) const {
Vector<String> favorites = EditorSettings::get_singleton()->get_favorites();
Vector<String> new_favorites;
@ -1333,7 +1333,7 @@ void FileSystemDock::_update_favorites_list_after_move(const Map<String, String>
EditorSettings::get_singleton()->set_favorites(new_favorites);
}
void FileSystemDock::_save_scenes_after_move(const Map<String, String> &p_renames) const {
void FileSystemDock::_save_scenes_after_move(const RBMap<String, String> &p_renames) const {
Vector<String> remaps;
_find_remaps(EditorFileSystem::get_singleton()->get_filesystem(), p_renames, remaps);
Vector<String> new_filenames;
@ -1493,8 +1493,8 @@ void FileSystemDock::_rename_operation_confirm() {
}
memdelete(da);
Map<String, String> file_renames;
Map<String, String> folder_renames;
RBMap<String, String> file_renames;
RBMap<String, String> folder_renames;
_try_move_item(to_rename, new_path, file_renames, folder_renames);
int current_tab = editor->get_current_tab();
@ -1595,8 +1595,8 @@ void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool overw
}
}
Map<String, String> file_renames;
Map<String, String> folder_renames;
RBMap<String, String> file_renames;
RBMap<String, String> folder_renames;
bool is_moved = false;
for (int i = 0; i < to_move.size(); i++) {
String old_path = to_move[i].path.ends_with("/") ? to_move[i].path.substr(0, to_move[i].path.length() - 1) : to_move[i].path;

View File

@ -35,7 +35,7 @@
#include "scene/gui/split_container.h"
#include "core/containers/list.h"
#include "core/containers/map.h"
#include "core/containers/rb_map.h"
#include "core/containers/set.h"
#include "core/containers/vector.h"
#include "core/math/vector2.h"
@ -231,14 +231,14 @@ private:
void _update_import_dock();
void _get_all_items_in_dir(EditorFileSystemDirectory *efsd, Vector<String> &files, Vector<String> &folders) const;
void _find_remaps(EditorFileSystemDirectory *efsd, const Map<String, String> &renames, Vector<String> &to_remaps) const;
void _try_move_item(const FileOrFolder &p_item, const String &p_new_path, Map<String, String> &p_file_renames, Map<String, String> &p_folder_renames);
void _find_remaps(EditorFileSystemDirectory *efsd, const RBMap<String, String> &renames, Vector<String> &to_remaps) const;
void _try_move_item(const FileOrFolder &p_item, const String &p_new_path, RBMap<String, String> &p_file_renames, RBMap<String, String> &p_folder_renames);
void _try_duplicate_item(const FileOrFolder &p_item, const String &p_new_path) const;
void _update_dependencies_after_move(const Map<String, String> &p_renames) const;
void _update_resource_paths_after_move(const Map<String, String> &p_renames) const;
void _save_scenes_after_move(const Map<String, String> &p_renames) const;
void _update_favorites_list_after_move(const Map<String, String> &p_files_renames, const Map<String, String> &p_folders_renames) const;
void _update_project_settings_after_move(const Map<String, String> &p_renames) const;
void _update_dependencies_after_move(const RBMap<String, String> &p_renames) const;
void _update_resource_paths_after_move(const RBMap<String, String> &p_renames) const;
void _save_scenes_after_move(const RBMap<String, String> &p_renames) const;
void _update_favorites_list_after_move(const RBMap<String, String> &p_files_renames, const RBMap<String, String> &p_folders_renames) const;
void _update_project_settings_after_move(const RBMap<String, String> &p_renames) const;
void _file_removed(String p_file);
void _folder_removed(String p_folder);

Some files were not shown because too many files have changed in this diff Show More