Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace all instances of erase with remove #49701

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions core/config/project_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ bool ProjectSettings::_set(const StringName &p_name, const Variant &p_value) {
_THREAD_SAFE_METHOD_

if (p_value.get_type() == Variant::NIL) {
props.erase(p_name);
props.remove(p_name);
if (p_name.operator String().begins_with("autoload/")) {
String node_name = p_name.operator String().split("/")[1];
if (autoloads.has(node_name)) {
Expand Down Expand Up @@ -680,7 +680,7 @@ bool ProjectSettings::is_builtin_setting(const String &p_name) const {

void ProjectSettings::clear(const String &p_name) {
ERR_FAIL_COND_MSG(!props.has(p_name), "Request for nonexistent project setting: " + p_name + ".");
props.erase(p_name);
props.remove(p_name);
}

Error ProjectSettings::save() {
Expand Down Expand Up @@ -1022,7 +1022,7 @@ void ProjectSettings::add_autoload(const AutoloadInfo &p_autoload) {

void ProjectSettings::remove_autoload(const StringName &p_autoload) {
ERR_FAIL_COND_MSG(!autoloads.has(p_autoload), "Trying to remove non-existent autoload.");
autoloads.erase(p_autoload);
autoloads.remove(p_autoload);
}

bool ProjectSettings::has_autoload(const StringName &p_autoload) const {
Expand Down
4 changes: 2 additions & 2 deletions core/core_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2250,7 +2250,7 @@ void _EngineDebugger::register_profiler(const StringName &p_name, const Callable
void _EngineDebugger::unregister_profiler(const StringName &p_name) {
ERR_FAIL_COND_MSG(!profilers.has(p_name), "Profiler not registered: " + p_name);
EngineDebugger::unregister_profiler(p_name);
profilers.erase(p_name);
profilers.remove(p_name);
}

bool _EngineDebugger::_EngineDebugger::is_profiling(const StringName &p_name) {
Expand Down Expand Up @@ -2282,7 +2282,7 @@ void _EngineDebugger::register_message_capture(const StringName &p_name, const C
void _EngineDebugger::unregister_message_capture(const StringName &p_name) {
ERR_FAIL_COND_MSG(!captures.has(p_name), "Capture not registered: " + p_name);
EngineDebugger::unregister_message_capture(p_name);
captures.erase(p_name);
captures.remove(p_name);
}

bool _EngineDebugger::has_capture(const StringName &p_name) {
Expand Down
4 changes: 2 additions & 2 deletions core/debugger/engine_debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void EngineDebugger::unregister_profiler(const StringName &p_name) {
p.toggle(p.data, false, Array());
p.active = false;
}
profilers.erase(p_name);
profilers.remove(p_name);
}

void EngineDebugger::register_message_capture(const StringName &p_name, Capture p_func) {
Expand All @@ -65,7 +65,7 @@ void EngineDebugger::register_message_capture(const StringName &p_name, Capture

void EngineDebugger::unregister_message_capture(const StringName &p_name) {
ERR_FAIL_COND_MSG(!captures.has(p_name), "Capture not registered: " + p_name);
captures.erase(p_name);
captures.remove(p_name);
}

void EngineDebugger::register_uri_handler(const String &p_protocol, CreatePeerFunc p_func) {
Expand Down
4 changes: 2 additions & 2 deletions core/debugger/script_debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ void ScriptDebugger::remove_breakpoint(int p_line, const StringName &p_source) {
return;
}

breakpoints[p_line].erase(p_source);
breakpoints[p_line].remove(p_source);
if (breakpoints[p_line].size() == 0) {
breakpoints.erase(p_line);
breakpoints.remove(p_line);
}
}

Expand Down
10 changes: 5 additions & 5 deletions core/input/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ void Input::joy_connection_changed(int p_idx, bool p_connected, String p_name, S
js.connected = false;
for (int i = 0; i < JOY_BUTTON_MAX; i++) {
int c = _combine_device(i, p_idx);
joy_buttons_pressed.erase(c);
joy_buttons_pressed.remove(c);
}
for (int i = 0; i < JOY_AXIS_MAX; i++) {
set_joy_axis(p_idx, i, 0.0f);
Expand Down Expand Up @@ -480,7 +480,7 @@ void Input::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_em
if (k->is_pressed()) {
keys_pressed.insert(k->get_keycode());
} else {
keys_pressed.erase(k->get_keycode());
keys_pressed.remove(k->get_keycode());
}
}

Expand Down Expand Up @@ -536,7 +536,7 @@ void Input::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_em
} else {
// Since a pointer index may not occur again (OSs may or may not reuse them),
// imperatively remove it from the map to keep no fossil entries in it
touch_speed_track.erase(st->get_index());
touch_speed_track.remove(st->get_index());
}

if (emulate_mouse_from_touch) {
Expand Down Expand Up @@ -603,7 +603,7 @@ void Input::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_em
if (jb->is_pressed()) {
joy_buttons_pressed.insert(c);
} else {
joy_buttons_pressed.erase(c);
joy_buttons_pressed.remove(c);
}
}

Expand Down Expand Up @@ -1342,7 +1342,7 @@ void Input::add_joy_mapping(String p_mapping, bool p_update_existing) {
void Input::remove_joy_mapping(String p_guid) {
for (int i = map_db.size() - 1; i >= 0; i--) {
if (p_guid == map_db[i].uid) {
map_db.remove(i);
map_db.remove_at(i);
}
}
for (Map<int, Joypad>::Element *E = joy_names.front(); E; E = E->next()) {
Expand Down
16 changes: 8 additions & 8 deletions core/input/input_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ void InputMap::_bind_methods() {
ClassDB::bind_method(D_METHOD("has_action", "action"), &InputMap::has_action);
ClassDB::bind_method(D_METHOD("get_actions"), &InputMap::_get_actions);
ClassDB::bind_method(D_METHOD("add_action", "action", "deadzone"), &InputMap::add_action, DEFVAL(0.5f));
ClassDB::bind_method(D_METHOD("erase_action", "action"), &InputMap::erase_action);
ClassDB::bind_method(D_METHOD("remove_action", "action"), &InputMap::remove_action);

ClassDB::bind_method(D_METHOD("action_set_deadzone", "action", "deadzone"), &InputMap::action_set_deadzone);
ClassDB::bind_method(D_METHOD("action_add_event", "action", "event"), &InputMap::action_add_event);
ClassDB::bind_method(D_METHOD("action_has_event", "action", "event"), &InputMap::action_has_event);
ClassDB::bind_method(D_METHOD("action_erase_event", "action", "event"), &InputMap::action_erase_event);
ClassDB::bind_method(D_METHOD("action_erase_events", "action"), &InputMap::action_erase_events);
ClassDB::bind_method(D_METHOD("action_remove_event", "action", "event"), &InputMap::action_remove_event);
ClassDB::bind_method(D_METHOD("action_remove_events", "action"), &InputMap::action_remove_events);
ClassDB::bind_method(D_METHOD("action_get_events", "action"), &InputMap::_action_get_events);
ClassDB::bind_method(D_METHOD("event_is_action", "event", "action", "exact_match"), &InputMap::event_is_action, DEFVAL(false));
ClassDB::bind_method(D_METHOD("load_from_project_settings"), &InputMap::load_from_project_settings);
Expand Down Expand Up @@ -91,10 +91,10 @@ void InputMap::add_action(const StringName &p_action, float p_deadzone) {
last_id++;
}

void InputMap::erase_action(const StringName &p_action) {
void InputMap::remove_action(const StringName &p_action) {
ERR_FAIL_COND_MSG(!input_map.has(p_action), _suggest_actions(p_action));

input_map.erase(p_action);
input_map.remove(p_action);
}

Array InputMap::_get_actions() {
Expand Down Expand Up @@ -177,19 +177,19 @@ bool InputMap::action_has_event(const StringName &p_action, const Ref<InputEvent
return (_find_event(input_map[p_action], p_event, true) != nullptr);
}

void InputMap::action_erase_event(const StringName &p_action, const Ref<InputEvent> &p_event) {
void InputMap::action_remove_event(const StringName &p_action, const Ref<InputEvent> &p_event) {
ERR_FAIL_COND_MSG(!input_map.has(p_action), _suggest_actions(p_action));

List<Ref<InputEvent>>::Element *E = _find_event(input_map[p_action], p_event, true);
if (E) {
input_map[p_action].inputs.erase(E);
input_map[p_action].inputs.remove(E);
if (Input::get_singleton()->is_action_pressed(p_action)) {
Input::get_singleton()->action_release(p_action);
}
}
}

void InputMap::action_erase_events(const StringName &p_action) {
void InputMap::action_remove_events(const StringName &p_action) {
ERR_FAIL_COND_MSG(!input_map.has(p_action), _suggest_actions(p_action));

input_map[p_action].inputs.clear();
Expand Down
6 changes: 3 additions & 3 deletions core/input/input_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ class InputMap : public Object {
bool has_action(const StringName &p_action) const;
List<StringName> get_actions() const;
void add_action(const StringName &p_action, float p_deadzone = 0.5);
void erase_action(const StringName &p_action);
void remove_action(const StringName &p_action);

float action_get_deadzone(const StringName &p_action);
void action_set_deadzone(const StringName &p_action, float p_deadzone);
void action_add_event(const StringName &p_action, const Ref<InputEvent> &p_event);
bool action_has_event(const StringName &p_action, const Ref<InputEvent> &p_event);
void action_erase_event(const StringName &p_action, const Ref<InputEvent> &p_event);
void action_erase_events(const StringName &p_action);
void action_remove_event(const StringName &p_action, const Ref<InputEvent> &p_event);
void action_remove_events(const StringName &p_action);

const List<Ref<InputEvent>> *action_get_events(const StringName &p_action);
bool event_is_action(const Ref<InputEvent> &p_event, const StringName &p_action, bool p_exact_match = false) const;
Expand Down
24 changes: 12 additions & 12 deletions core/io/config_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ PackedStringArray ConfigFile::_get_section_keys(const String &p_section) const {

void ConfigFile::set_value(const String &p_section, const String &p_key, const Variant &p_value) {
if (p_value.get_type() == Variant::NIL) {
//erase
//remove
if (!values.has(p_section)) {
return; // ?
}
values[p_section].erase(p_key);
values[p_section].remove(p_key);
if (values[p_section].is_empty()) {
values.erase(p_section);
values.remove(p_section);
}

} else {
Expand Down Expand Up @@ -115,16 +115,16 @@ void ConfigFile::get_section_keys(const String &p_section, List<String> *r_keys)
}
}

void ConfigFile::erase_section(const String &p_section) {
ERR_FAIL_COND_MSG(!values.has(p_section), vformat("Cannot erase nonexistent section \"%s\".", p_section));
values.erase(p_section);
void ConfigFile::remove_section(const String &p_section) {
ERR_FAIL_COND_MSG(!values.has(p_section), vformat("Cannot remove nonexistent section \"%s\".", p_section));
values.remove(p_section);
}

void ConfigFile::erase_section_key(const String &p_section, const String &p_key) {
ERR_FAIL_COND_MSG(!values.has(p_section), vformat("Cannot erase key \"%s\" from nonexistent section \"%s\".", p_key, p_section));
ERR_FAIL_COND_MSG(!values[p_section].has(p_key), vformat("Cannot erase nonexistent key \"%s\" from section \"%s\".", p_key, p_section));
void ConfigFile::remove_section_key(const String &p_section, const String &p_key) {
ERR_FAIL_COND_MSG(!values.has(p_section), vformat("Cannot remove key \"%s\" from nonexistent section \"%s\".", p_key, p_section));
ERR_FAIL_COND_MSG(!values[p_section].has(p_key), vformat("Cannot remove nonexistent key \"%s\" from section \"%s\".", p_key, p_section));

values[p_section].erase(p_key);
values[p_section].remove(p_key);
}

Error ConfigFile::save(const String &p_path) {
Expand Down Expand Up @@ -308,8 +308,8 @@ void ConfigFile::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_sections"), &ConfigFile::_get_sections);
ClassDB::bind_method(D_METHOD("get_section_keys", "section"), &ConfigFile::_get_section_keys);

ClassDB::bind_method(D_METHOD("erase_section", "section"), &ConfigFile::erase_section);
ClassDB::bind_method(D_METHOD("erase_section_key", "section", "key"), &ConfigFile::erase_section_key);
ClassDB::bind_method(D_METHOD("remove_section", "section"), &ConfigFile::remove_section);
ClassDB::bind_method(D_METHOD("remove_section_key", "section", "key"), &ConfigFile::remove_section_key);

ClassDB::bind_method(D_METHOD("load", "path"), &ConfigFile::load);
ClassDB::bind_method(D_METHOD("parse", "data"), &ConfigFile::parse);
Expand Down
4 changes: 2 additions & 2 deletions core/io/config_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ class ConfigFile : public RefCounted {
void get_sections(List<String> *r_sections) const;
void get_section_keys(const String &p_section, List<String> *r_keys) const;

void erase_section(const String &p_section);
void erase_section_key(const String &p_section, const String &p_key);
void remove_section(const String &p_section);
void remove_section_key(const String &p_section, const String &p_key);

Error save(const String &p_path);
Error load(const String &p_path);
Expand Down
8 changes: 4 additions & 4 deletions core/io/dir_access.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ bool DirAccess::drives_are_shortcuts() {
return false;
}

static Error _erase_recursive(DirAccess *da) {
static Error _remove_recursive(DirAccess *da) {
List<String> dirs;
List<String> files;

Expand All @@ -96,7 +96,7 @@ static Error _erase_recursive(DirAccess *da) {
for (List<String>::Element *E = dirs.front(); E; E = E->next()) {
Error err = da->change_dir(E->get());
if (err == OK) {
err = _erase_recursive(da);
err = _remove_recursive(da);
if (err) {
da->change_dir("..");
return err;
Expand Down Expand Up @@ -124,8 +124,8 @@ static Error _erase_recursive(DirAccess *da) {
return OK;
}

Error DirAccess::erase_contents_recursive() {
return _erase_recursive(this);
Error DirAccess::remove_contents_recursive() {
return _remove_recursive(this);
}

Error DirAccess::make_dir_recursive(String p_dir) {
Expand Down
2 changes: 1 addition & 1 deletion core/io/dir_access.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class DirAccess {
virtual String get_current_dir(bool p_include_drive = true) = 0; ///< return current dir location
virtual Error make_dir(String p_dir) = 0;
virtual Error make_dir_recursive(String p_dir);
virtual Error erase_contents_recursive(); //super dangerous, use with care!
virtual Error remove_contents_recursive(); //super dangerous, use with care!

virtual bool file_exists(String p_file) = 0;
virtual bool dir_exists(String p_dir) = 0;
Expand Down
2 changes: 1 addition & 1 deletion core/io/file_access_network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,6 @@ FileAccessNetwork::~FileAccessNetwork() {
FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton;
nc->lock_mutex();
id = nc->last_id++;
nc->accesses.erase(id);
nc->accesses.remove(id);
nc->unlock_mutex();
}
4 changes: 2 additions & 2 deletions core/io/file_access_pack.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class PackedData {
public:
struct PackedFile {
String pack;
uint64_t offset; //if offset is ZERO, the file was ERASED
uint64_t offset; //if offset is ZERO, the file was REMOVED
uint64_t size;
uint8_t md5[16];
PackSource *src;
Expand Down Expand Up @@ -193,7 +193,7 @@ FileAccess *PackedData::try_open_path(const String &p_path) {
return nullptr; //not found
}
if (E->get().offset == 0) {
return nullptr; //was erased
return nullptr; //was removed
}

return E->get().src->get_file(p_path, &E->get());
Expand Down
8 changes: 4 additions & 4 deletions core/io/http_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ void HTTPClient::close() {
status = STATUS_DISCONNECTED;
head_request = false;
if (resolving != IP::RESOLVER_INVALID_ID) {
IP::get_singleton()->erase_resolve_item(resolving);
IP::get_singleton()->remove_resolve_item(resolving);
resolving = IP::RESOLVER_INVALID_ID;
}

Expand Down Expand Up @@ -330,7 +330,7 @@ Error HTTPClient::poll() {
case IP::RESOLVER_STATUS_DONE: {
IPAddress host = IP::get_singleton()->get_resolve_item_address(resolving);
Error err = tcp_connection->connect_to_host(host, conn_port);
IP::get_singleton()->erase_resolve_item(resolving);
IP::get_singleton()->remove_resolve_item(resolving);
resolving = IP::RESOLVER_INVALID_ID;
if (err) {
status = STATUS_CANT_CONNECT;
Expand All @@ -341,7 +341,7 @@ Error HTTPClient::poll() {
} break;
case IP::RESOLVER_STATUS_NONE:
case IP::RESOLVER_STATUS_ERROR: {
IP::get_singleton()->erase_resolve_item(resolving);
IP::get_singleton()->remove_resolve_item(resolving);
resolving = IP::RESOLVER_INVALID_ID;
close();
status = STATUS_CANT_RESOLVE;
Expand Down Expand Up @@ -763,7 +763,7 @@ String HTTPClient::query_string_from_dict(const Dictionary &p_dict) {
}
}
}
query.erase(0, 1);
query.remove(0, 1);
return query;
}

Expand Down
2 changes: 1 addition & 1 deletion core/io/image_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void ImageLoader::add_image_format_loader(ImageFormatLoader *p_loader) {
}

void ImageLoader::remove_image_format_loader(ImageFormatLoader *p_loader) {
loader.erase(p_loader);
loader.remove(p_loader);
}

const Vector<ImageFormatLoader *> &ImageLoader::get_image_format_loaders() {
Expand Down
12 changes: 6 additions & 6 deletions core/io/ip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ Array IP::get_resolve_item_addresses(ResolverID p_id) const {
return result;
}

void IP::erase_resolve_item(ResolverID p_id) {
void IP::remove_resolve_item(ResolverID p_id) {
ERR_FAIL_INDEX(p_id, IP::RESOLVER_MAX_QUERIES);

MutexLock lock(resolver->mutex);
Expand All @@ -241,10 +241,10 @@ void IP::clear_cache(const String &p_hostname) {
if (p_hostname.is_empty()) {
resolver->cache.clear();
} else {
resolver->cache.erase(_IP_ResolverPrivate::get_cache_key(p_hostname, IP::TYPE_NONE));
resolver->cache.erase(_IP_ResolverPrivate::get_cache_key(p_hostname, IP::TYPE_IPV4));
resolver->cache.erase(_IP_ResolverPrivate::get_cache_key(p_hostname, IP::TYPE_IPV6));
resolver->cache.erase(_IP_ResolverPrivate::get_cache_key(p_hostname, IP::TYPE_ANY));
resolver->cache.remove(_IP_ResolverPrivate::get_cache_key(p_hostname, IP::TYPE_NONE));
resolver->cache.remove(_IP_ResolverPrivate::get_cache_key(p_hostname, IP::TYPE_IPV4));
resolver->cache.remove(_IP_ResolverPrivate::get_cache_key(p_hostname, IP::TYPE_IPV6));
resolver->cache.remove(_IP_ResolverPrivate::get_cache_key(p_hostname, IP::TYPE_ANY));
}
}

Expand Down Expand Up @@ -299,7 +299,7 @@ void IP::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_resolve_item_status", "id"), &IP::get_resolve_item_status);
ClassDB::bind_method(D_METHOD("get_resolve_item_address", "id"), &IP::get_resolve_item_address);
ClassDB::bind_method(D_METHOD("get_resolve_item_addresses", "id"), &IP::get_resolve_item_addresses);
ClassDB::bind_method(D_METHOD("erase_resolve_item", "id"), &IP::erase_resolve_item);
ClassDB::bind_method(D_METHOD("remove_resolve_item", "id"), &IP::remove_resolve_item);
ClassDB::bind_method(D_METHOD("get_local_addresses"), &IP::_get_local_addresses);
ClassDB::bind_method(D_METHOD("get_local_interfaces"), &IP::_get_local_interfaces);
ClassDB::bind_method(D_METHOD("clear_cache", "hostname"), &IP::clear_cache, DEFVAL(""));
Expand Down
Loading