diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2020-12-28 13:23:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-28 13:23:25 +0100 |
commit | be509bf5e4d00b33f2867e6d06a23285b2a8fd29 (patch) | |
tree | 975e0a7384bc6fc7cf5b73b9ddc1e8eef13579d8 /core | |
parent | 886571e0fc54914f161ab3f1ccf9bfe40411bc20 (diff) | |
parent | 5b937d493f0046543a77a0be7920ad39f1e5fc3c (diff) |
Merge pull request #44401 from madmiraal/rename-empty-is_empty
Rename empty() to is_empty()
Diffstat (limited to 'core')
45 files changed, 134 insertions, 134 deletions
diff --git a/core/debugger/engine_debugger.cpp b/core/debugger/engine_debugger.cpp index 4bf31aa55f..5ef802957f 100644 --- a/core/debugger/engine_debugger.cpp +++ b/core/debugger/engine_debugger.cpp @@ -135,7 +135,7 @@ void EngineDebugger::iteration(uint64_t p_frame_ticks, uint64_t p_idle_ticks, ui void EngineDebugger::initialize(const String &p_uri, bool p_skip_breakpoints, Vector<String> p_breakpoints) { register_uri_handler("tcp://", RemoteDebuggerPeerTCP::create); // TCP is the default protocol. Platforms/modules can add more. - if (p_uri.empty()) { + if (p_uri.is_empty()) { return; } if (p_uri == "local://") { diff --git a/core/debugger/local_debugger.cpp b/core/debugger/local_debugger.cpp index 876be79418..e8401655f1 100644 --- a/core/debugger/local_debugger.cpp +++ b/core/debugger/local_debugger.cpp @@ -117,7 +117,7 @@ struct LocalDebugger::ScriptsProfiler { void LocalDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) { ScriptLanguage *script_lang = script_debugger->get_break_language(); - if (!target_function.empty()) { + if (!target_function.is_empty()) { String current_function = script_lang->debug_get_stack_level_function(0); if (current_function != target_function) { script_debugger->set_depth(0); @@ -259,7 +259,7 @@ void LocalDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) { String source = breakpoint.first; int linenr = breakpoint.second; - if (source.empty()) { + if (source.is_empty()) { continue; } @@ -285,7 +285,7 @@ void LocalDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) { String source = breakpoint.first; int linenr = breakpoint.second; - if (source.empty()) { + if (source.is_empty()) { continue; } @@ -323,7 +323,7 @@ void LocalDebugger::print_variables(const List<String> &names, const List<Varian for (const List<String>::Element *E = names.front(); E; E = E->next()) { value = String(V->get()); - if (variable_prefix.empty()) { + if (variable_prefix.is_empty()) { print_line(E->get() + ": " + String(V->get())); } else { print_line(E->get() + ":"); @@ -359,7 +359,7 @@ void LocalDebugger::send_message(const String &p_message, const Array &p_args) { } void LocalDebugger::send_error(const String &p_func, const String &p_file, int p_line, const String &p_err, const String &p_descr, ErrorHandlerType p_type) { - print_line("ERROR: '" + (p_descr.empty() ? p_err : p_descr) + "'"); + print_line("ERROR: '" + (p_descr.is_empty() ? p_err : p_descr) + "'"); } LocalDebugger::LocalDebugger() { diff --git a/core/debugger/remote_debugger.cpp b/core/debugger/remote_debugger.cpp index ff89517497..4e16bb0182 100644 --- a/core/debugger/remote_debugger.cpp +++ b/core/debugger/remote_debugger.cpp @@ -553,7 +553,7 @@ void RemoteDebugger::flush_output() { for (int i = 0; i < output_strings.size(); i++) { const OutputString &output_string = output_strings[i]; if (output_string.type == MESSAGE_TYPE_ERROR) { - if (!joined_log_strings.empty()) { + if (!joined_log_strings.is_empty()) { strings.push_back(String("\n").join(joined_log_strings)); types.push_back(MESSAGE_TYPE_LOG); joined_log_strings.clear(); @@ -565,7 +565,7 @@ void RemoteDebugger::flush_output() { } } - if (!joined_log_strings.empty()) { + if (!joined_log_strings.is_empty()) { strings.push_back(String("\n").join(joined_log_strings)); types.push_back(MESSAGE_TYPE_LOG); } diff --git a/core/input/input.cpp b/core/input/input.cpp index 153656e44a..c49193562e 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -806,7 +806,7 @@ void Input::accumulate_input_event(const Ref<InputEvent> &p_event) { parse_input_event(p_event); return; } - if (!accumulated_events.empty() && accumulated_events.back()->get()->accumulate(p_event)) { + if (!accumulated_events.is_empty() && accumulated_events.back()->get()->accumulate(p_event)) { return; //event was accumulated, exit } diff --git a/core/input/input_event.cpp b/core/input/input_event.cpp index 82bfaa82a5..bdfa5dff5f 100644 --- a/core/input/input_event.cpp +++ b/core/input/input_event.cpp @@ -210,7 +210,7 @@ String InputEventWithModifiers::as_text() const { mod_names.push_back(find_keycode_name(KEY_META)); } - if (!mod_names.empty()) { + if (!mod_names.is_empty()) { return String("+").join(mod_names); } else { return ""; diff --git a/core/input/input_map.cpp b/core/input/input_map.cpp index 979809c7af..45e2ddc71d 100644 --- a/core/input/input_map.cpp +++ b/core/input/input_map.cpp @@ -71,7 +71,7 @@ void InputMap::erase_action(const StringName &p_action) { Array InputMap::_get_actions() { Array ret; List<StringName> actions = get_actions(); - if (actions.empty()) { + if (actions.is_empty()) { return ret; } @@ -84,7 +84,7 @@ Array InputMap::_get_actions() { List<StringName> InputMap::get_actions() const { List<StringName> actions = List<StringName>(); - if (input_map.empty()) { + if (input_map.is_empty()) { return actions; } diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp index 8be39178db..a53431cab2 100644 --- a/core/io/config_file.cpp +++ b/core/io/config_file.cpp @@ -67,7 +67,7 @@ void ConfigFile::set_value(const String &p_section, const String &p_key, const V return; // ? } values[p_section].erase(p_key); - if (values[p_section].empty()) { + if (values[p_section].is_empty()) { values.erase(p_section); } diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp index 1e9266f118..207d5757ec 100644 --- a/core/io/file_access_network.cpp +++ b/core/io/file_access_network.cpp @@ -350,7 +350,7 @@ void FileAccessNetwork::_queue_page(int p_page) const { if (p_page >= pages.size()) { return; } - if (pages[p_page].buffer.empty() && !pages[p_page].queued) { + if (pages[p_page].buffer.is_empty() && !pages[p_page].queued) { FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton; { MutexLock lock(nc->blockrequest_mutex); @@ -386,7 +386,7 @@ int FileAccessNetwork::get_buffer(uint8_t *p_dst, int p_length) const { if (page != last_page) { buffer_mutex.lock(); - if (pages[page].buffer.empty()) { + if (pages[page].buffer.is_empty()) { waiting_on_page = page; for (int j = 0; j < read_ahead; j++) { _queue_page(page + j); diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp index a025ca5730..30c94d6a4d 100644 --- a/core/io/file_access_pack.cpp +++ b/core/io/file_access_pack.cpp @@ -89,7 +89,7 @@ void PackedData::add_path(const String &pkg_path, const String &path, uint64_t o } String filename = path.get_file(); // Don't add as a file if the path points to a directory - if (!filename.empty()) { + if (!filename.is_empty()) { cd->files.insert(filename); } } diff --git a/core/io/image.cpp b/core/io/image.cpp index 56d84325b5..fec7a6a0c5 100644 --- a/core/io/image.cpp +++ b/core/io/image.cpp @@ -375,7 +375,7 @@ Image::Image3DValidateError Image::validate_3d_image(Image::Format p_format, int if (idx >= p_images.size()) { return VALIDATE_3D_ERR_MISSING_IMAGES; } - if (p_images[idx].is_null() || p_images[idx]->empty()) { + if (p_images[idx].is_null() || p_images[idx]->is_empty()) { return VALIDATE_3D_ERR_IMAGE_EMPTY; } if (p_images[idx]->get_format() != p_format) { @@ -1756,7 +1756,7 @@ Error Image::generate_mipmap_roughness(RoughnessChannel p_roughness_channel, con double *normal_sat = nullptr; //summed area table for normalmap int normal_w = 0, normal_h = 0; - ERR_FAIL_COND_V_MSG(p_normal_map.is_null() || p_normal_map->empty(), ERR_INVALID_PARAMETER, "Must provide a valid normalmap for roughness mipmaps"); + ERR_FAIL_COND_V_MSG(p_normal_map.is_null() || p_normal_map->is_empty(), ERR_INVALID_PARAMETER, "Must provide a valid normalmap for roughness mipmaps"); Ref<Image> nm = p_normal_map->duplicate(); if (nm->is_compressed()) { @@ -1950,7 +1950,7 @@ void Image::clear_mipmaps() { return; } - if (empty()) { + if (is_empty()) { return; } @@ -1961,7 +1961,7 @@ void Image::clear_mipmaps() { mipmaps = false; } -bool Image::empty() const { +bool Image::is_empty() const { return (data.size() == 0); } @@ -3090,7 +3090,7 @@ void Image::_bind_methods() { ClassDB::bind_method(D_METHOD("create", "width", "height", "use_mipmaps", "format"), &Image::_create_empty); ClassDB::bind_method(D_METHOD("create_from_data", "width", "height", "use_mipmaps", "format", "data"), &Image::_create_from_data); - ClassDB::bind_method(D_METHOD("is_empty"), &Image::empty); + ClassDB::bind_method(D_METHOD("is_empty"), &Image::is_empty); ClassDB::bind_method(D_METHOD("load", "path"), &Image::load); ClassDB::bind_method(D_METHOD("save_png", "path"), &Image::save_png); @@ -3585,7 +3585,7 @@ Image::Image(const uint8_t *p_mem_png_jpg, int p_len) { copy_internals_from(_png_mem_loader_func(p_mem_png_jpg, p_len)); } - if (empty() && _jpg_mem_loader_func) { + if (is_empty() && _jpg_mem_loader_func) { copy_internals_from(_jpg_mem_loader_func(p_mem_png_jpg, p_len)); } } diff --git a/core/io/image.h b/core/io/image.h index 6b4488bd66..7280500c85 100644 --- a/core/io/image.h +++ b/core/io/image.h @@ -285,7 +285,7 @@ public: /** * returns true when the image is empty (0,0) in size */ - bool empty() const; + bool is_empty() const; Vector<uint8_t> get_data() const; diff --git a/core/io/ip.cpp b/core/io/ip.cpp index 9f3540efad..beb3c7fc2e 100644 --- a/core/io/ip.cpp +++ b/core/io/ip.cpp @@ -189,7 +189,7 @@ void IP::erase_resolve_item(ResolverID p_id) { void IP::clear_cache(const String &p_hostname) { MutexLock lock(resolver->mutex); - if (p_hostname.empty()) { + if (p_hostname.is_empty()) { resolver->cache.clear(); } else { resolver->cache.erase(_IP_ResolverPrivate::get_cache_key(p_hostname, IP::TYPE_NONE)); diff --git a/core/io/json.cpp b/core/io/json.cpp index d61c2b8236..f9d96c5e1f 100644 --- a/core/io/json.cpp +++ b/core/io/json.cpp @@ -47,7 +47,7 @@ const char *JSON::tk_name[TK_MAX] = { static String _make_indent(const String &p_indent, int p_size) { String indent_text = ""; - if (!p_indent.empty()) { + if (!p_indent.is_empty()) { for (int i = 0; i < p_size; i++) { indent_text += p_indent; } @@ -59,7 +59,7 @@ String JSON::_print_var(const Variant &p_var, const String &p_indent, int p_cur_ String colon = ":"; String end_statement = ""; - if (!p_indent.empty()) { + if (!p_indent.is_empty()) { colon += " "; end_statement += "\n"; } diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp index 5480d3c535..f2b0c80aab 100644 --- a/core/io/pck_packer.cpp +++ b/core/io/pck_packer.cpp @@ -53,7 +53,7 @@ void PCKPacker::_bind_methods() { } Error PCKPacker::pck_start(const String &p_file, int p_alignment, const String &p_key, bool p_encrypt_directory) { - ERR_FAIL_COND_V_MSG((p_key.empty() || !p_key.is_valid_hex_number(false) || p_key.length() != 64), ERR_CANT_CREATE, "Invalid Encryption Key (must be 64 characters long)."); + ERR_FAIL_COND_V_MSG((p_key.is_empty() || !p_key.is_valid_hex_number(false) || p_key.length() != 64), ERR_CANT_CREATE, "Invalid Encryption Key (must be 64 characters long)."); String _key = p_key.to_lower(); key.resize(32); diff --git a/core/io/translation_loader_po.cpp b/core/io/translation_loader_po.cpp index 34cccca540..88cd089663 100644 --- a/core/io/translation_loader_po.cpp +++ b/core/io/translation_loader_po.cpp @@ -70,7 +70,7 @@ RES TranslationLoaderPO::load_translation(FileAccess *f, Error *r_error) { is_eof = f->eof_reached(); // If we reached last line and it's not a content line, break, otherwise let processing that last loop - if (is_eof && l.empty()) { + if (is_eof && l.is_empty()) { if (status == STATUS_READING_ID || status == STATUS_READING_CONTEXT || (status == STATUS_READING_PLURAL && plural_index != plural_forms - 1)) { memdelete(f); ERR_FAIL_V_MSG(RES(), "Unexpected EOF while reading PO file at: " + path + ":" + itos(line)); diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp index b4410acf7d..6b97cba9f9 100644 --- a/core/math/a_star.cpp +++ b/core/math/a_star.cpp @@ -35,7 +35,7 @@ #include "scene/scene_string_names.h" int AStar::get_available_point_id() const { - if (points.empty()) { + if (points.is_empty()) { return 1; } @@ -341,7 +341,7 @@ bool AStar::_solve(Point *begin_point, Point *end_point) { begin_point->f_score = _estimate_cost(begin_point->id, end_point->id); open_list.push_back(begin_point); - while (!open_list.empty()) { + while (!open_list.is_empty()) { Point *p = open_list[0]; // The currently processed point if (p == end_point) { @@ -805,7 +805,7 @@ bool AStar2D::_solve(AStar::Point *begin_point, AStar::Point *end_point) { begin_point->f_score = _estimate_cost(begin_point->id, end_point->id); open_list.push_back(begin_point); - while (!open_list.empty()) { + while (!open_list.is_empty()) { AStar::Point *p = open_list[0]; // The currently processed point if (p == end_point) { diff --git a/core/math/dynamic_bvh.h b/core/math/dynamic_bvh.h index ecf2feb3d8..8b0d390465 100644 --- a/core/math/dynamic_bvh.h +++ b/core/math/dynamic_bvh.h @@ -278,7 +278,7 @@ private: public: // Methods void clear(); - bool empty() const { return (0 == bvh_root); } + bool is_empty() const { return (0 == bvh_root); } void optimize_bottom_up(); void optimize_top_down(int bu_threshold = 128); void optimize_incremental(int passes); @@ -332,7 +332,7 @@ void DynamicBVH::aabb_query(const AABB &p_box, QueryResult &r_result) { if (n->volume.intersects(volume)) { if (n->is_internal()) { if (depth > threshold) { - if (aux_stack.empty()) { + if (aux_stack.is_empty()) { aux_stack.resize(ALLOCA_STACK_SIZE * 2); copymem(aux_stack.ptr(), stack, ALLOCA_STACK_SIZE * sizeof(const Node *)); } else { @@ -388,7 +388,7 @@ void DynamicBVH::convex_query(const Plane *p_planes, int p_plane_count, const Ve if (n->volume.intersects(volume) && n->volume.intersects_convex(p_planes, p_plane_count, p_points, p_point_count)) { if (n->is_internal()) { if (depth > threshold) { - if (aux_stack.empty()) { + if (aux_stack.is_empty()) { aux_stack.resize(ALLOCA_STACK_SIZE * 2); copymem(aux_stack.ptr(), stack, ALLOCA_STACK_SIZE * sizeof(const Node *)); } else { @@ -445,7 +445,7 @@ void DynamicBVH::ray_query(const Vector3 &p_from, const Vector3 &p_to, QueryResu if (result1) { if (node->is_internal()) { if (depth > threshold) { - if (aux_stack.empty()) { + if (aux_stack.is_empty()) { aux_stack.resize(ALLOCA_STACK_SIZE * 2); copymem(aux_stack.ptr(), stack, ALLOCA_STACK_SIZE * sizeof(const Node *)); } else { diff --git a/core/math/octree.h b/core/math/octree.h index be1e7d6a61..f7ff4faef3 100644 --- a/core/math/octree.h +++ b/core/math/octree.h @@ -572,7 +572,7 @@ bool Octree<T, use_pairs, AL>::_remove_element_from_octant(Element *p_element, O Octant *parent = p_octant->parent; - if (p_octant->children_count == 0 && p_octant->elements.empty() && p_octant->pairable_elements.empty()) { + if (p_octant->children_count == 0 && p_octant->elements.is_empty() && p_octant->pairable_elements.is_empty()) { // erase octant if (p_octant == root) { // won't have a parent, just erase @@ -942,7 +942,7 @@ void Octree<T, use_pairs, AL>::_cull_convex(Octant *p_octant, _CullConvexData *p return; //pointless } - if (!p_octant->elements.empty()) { + if (!p_octant->elements.is_empty()) { typename List<Element *, AL>::Element *I; I = p_octant->elements.front(); @@ -965,7 +965,7 @@ void Octree<T, use_pairs, AL>::_cull_convex(Octant *p_octant, _CullConvexData *p } } - if (use_pairs && !p_octant->pairable_elements.empty()) { + if (use_pairs && !p_octant->pairable_elements.is_empty()) { typename List<Element *, AL>::Element *I; I = p_octant->pairable_elements.front(); @@ -1001,7 +1001,7 @@ void Octree<T, use_pairs, AL>::_cull_aabb(Octant *p_octant, const AABB &p_aabb, return; //pointless } - if (!p_octant->elements.empty()) { + if (!p_octant->elements.is_empty()) { typename List<Element *, AL>::Element *I; I = p_octant->elements.front(); for (; I; I = I->next()) { @@ -1027,7 +1027,7 @@ void Octree<T, use_pairs, AL>::_cull_aabb(Octant *p_octant, const AABB &p_aabb, } } - if (use_pairs && !p_octant->pairable_elements.empty()) { + if (use_pairs && !p_octant->pairable_elements.is_empty()) { typename List<Element *, AL>::Element *I; I = p_octant->pairable_elements.front(); for (; I; I = I->next()) { @@ -1065,7 +1065,7 @@ void Octree<T, use_pairs, AL>::_cull_segment(Octant *p_octant, const Vector3 &p_ return; //pointless } - if (!p_octant->elements.empty()) { + if (!p_octant->elements.is_empty()) { typename List<Element *, AL>::Element *I; I = p_octant->elements.front(); for (; I; I = I->next()) { @@ -1091,7 +1091,7 @@ void Octree<T, use_pairs, AL>::_cull_segment(Octant *p_octant, const Vector3 &p_ } } - if (use_pairs && !p_octant->pairable_elements.empty()) { + if (use_pairs && !p_octant->pairable_elements.is_empty()) { typename List<Element *, AL>::Element *I; I = p_octant->pairable_elements.front(); for (; I; I = I->next()) { @@ -1132,7 +1132,7 @@ void Octree<T, use_pairs, AL>::_cull_point(Octant *p_octant, const Vector3 &p_po return; //pointless } - if (!p_octant->elements.empty()) { + if (!p_octant->elements.is_empty()) { typename List<Element *, AL>::Element *I; I = p_octant->elements.front(); for (; I; I = I->next()) { @@ -1158,7 +1158,7 @@ void Octree<T, use_pairs, AL>::_cull_point(Octant *p_octant, const Vector3 &p_po } } - if (use_pairs && !p_octant->pairable_elements.empty()) { + if (use_pairs && !p_octant->pairable_elements.is_empty()) { typename List<Element *, AL>::Element *I; I = p_octant->pairable_elements.front(); for (; I; I = I->next()) { diff --git a/core/object/class_db.cpp b/core/object/class_db.cpp index f5171f60ec..6cdaacf164 100644 --- a/core/object/class_db.cpp +++ b/core/object/class_db.cpp @@ -377,7 +377,7 @@ uint64_t ClassDB::get_api_hash(APIType p_api) { while ((k = t->method_map.next(k))) { String name = k->operator String(); - ERR_CONTINUE(name.empty()); + ERR_CONTINUE(name.is_empty()); if (name[0] == '_') { continue; // Ignore non-virtual methods that start with an underscore diff --git a/core/object/object.cpp b/core/object/object.cpp index 681e1188ff..a53925f990 100644 --- a/core/object/object.cpp +++ b/core/object/object.cpp @@ -506,7 +506,7 @@ Variant Object::get(const StringName &p_name, bool *r_valid) const { } void Object::set_indexed(const Vector<StringName> &p_names, const Variant &p_value, bool *r_valid) { - if (p_names.empty()) { + if (p_names.is_empty()) { if (r_valid) { *r_valid = false; } @@ -561,11 +561,11 @@ void Object::set_indexed(const Vector<StringName> &p_names, const Variant &p_val set(p_names[0], value_stack.back()->get(), r_valid); value_stack.pop_back(); - ERR_FAIL_COND(!value_stack.empty()); + ERR_FAIL_COND(!value_stack.is_empty()); } Variant Object::get_indexed(const Vector<StringName> &p_names, bool *r_valid) const { - if (p_names.empty()) { + if (p_names.is_empty()) { if (r_valid) { *r_valid = false; } @@ -599,7 +599,7 @@ void Object::get_property_list(List<PropertyInfo> *p_list, bool p_reversed) cons if (!is_class("Script")) { // can still be set, but this is for userfriendlyness p_list->push_back(PropertyInfo(Variant::OBJECT, "script", PROPERTY_HINT_RESOURCE_TYPE, "Script", PROPERTY_USAGE_DEFAULT)); } - if (!metadata.empty()) { + if (!metadata.is_empty()) { p_list->push_back(PropertyInfo(Variant::DICTIONARY, "__meta__", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); } if (script_instance && !p_reversed) { @@ -1089,7 +1089,7 @@ Error Object::emit_signal(const StringName &p_name, const Variant **p_args, int } } - while (!disconnect_data.empty()) { + while (!disconnect_data.is_empty()) { const _ObjectSignalDisconnectData &dd = disconnect_data.front()->get(); _disconnect(dd.signal, dd.callable); @@ -1373,7 +1373,7 @@ void Object::_disconnect(const StringName &p_signal, const Callable &p_callable, target_object->connections.erase(slot->cE); s->slot_map.erase(*p_callable.get_base_comparator()); - if (s->slot_map.empty() && ClassDB::has_signal(get_class_name(), p_signal)) { + if (s->slot_map.is_empty() && ClassDB::has_signal(get_class_name(), p_signal)) { //not user signal, delete signal_map.erase(p_signal); } diff --git a/core/object/script_language.cpp b/core/object/script_language.cpp index 17ac75e19f..f9cc517448 100644 --- a/core/object/script_language.cpp +++ b/core/object/script_language.cpp @@ -275,7 +275,7 @@ void ScriptServer::save_global_classes() { gcarr.push_back(d); } - if (gcarr.empty()) { + if (gcarr.is_empty()) { if (ProjectSettings::get_singleton()->has_setting("_global_script_classes")) { ProjectSettings::get_singleton()->clear("_global_script_classes"); } diff --git a/core/string/string_buffer.h b/core/string/string_buffer.h index 1317b538d4..6f58e128be 100644 --- a/core/string/string_buffer.h +++ b/core/string/string_buffer.h @@ -40,7 +40,7 @@ class StringBuffer { int string_length = 0; _FORCE_INLINE_ char32_t *current_buffer_ptr() { - return static_cast<String &>(buffer).empty() ? short_buffer : buffer.ptrw(); + return static_cast<String &>(buffer).is_empty() ? short_buffer : buffer.ptrw(); } public: @@ -122,7 +122,7 @@ StringBuffer<SHORT_BUFFER_SIZE> &StringBuffer<SHORT_BUFFER_SIZE>::reserve(int p_ return *this; } - bool need_copy = string_length > 0 && buffer.empty(); + bool need_copy = string_length > 0 && buffer.is_empty(); buffer.resize(next_power_of_2(p_size)); if (need_copy) { memcpy(buffer.ptrw(), short_buffer, string_length * sizeof(char32_t)); @@ -139,7 +139,7 @@ int StringBuffer<SHORT_BUFFER_SIZE>::length() const { template <int SHORT_BUFFER_SIZE> String StringBuffer<SHORT_BUFFER_SIZE>::as_string() { current_buffer_ptr()[string_length] = '\0'; - if (buffer.empty()) { + if (buffer.is_empty()) { return String(short_buffer); } else { buffer.resize(string_length + 1); diff --git a/core/string/string_name.h b/core/string/string_name.h index 320f63bf68..1c0a4e582d 100644 --- a/core/string/string_name.h +++ b/core/string/string_name.h @@ -83,7 +83,7 @@ class StringName { StringName(_Data *p_data) { _data = p_data; } public: - operator const void *() const { return (_data && (_data->cname || !_data->name.empty())) ? (void *)1 : nullptr; } + operator const void *() const { return (_data && (_data->cname || !_data->name.is_empty())) ? (void *)1 : nullptr; } bool operator==(const String &p_name) const; bool operator==(const char *p_name) const; diff --git a/core/string/translation.cpp b/core/string/translation.cpp index 7b8c28e2e2..5828f0e127 100644 --- a/core/string/translation.cpp +++ b/core/string/translation.cpp @@ -851,7 +851,7 @@ void Translation::add_message(const StringName &p_src_text, const StringName &p_ void Translation::add_plural_message(const StringName &p_src_text, const Vector<String> &p_plural_xlated_texts, const StringName &p_context) { WARN_PRINT("Translation class doesn't handle plural messages. Calling add_plural_message() on a Translation instance is probably a mistake. \nUse a derived Translation class that handles plurals, such as TranslationPO class"); - ERR_FAIL_COND_MSG(p_plural_xlated_texts.empty(), "Parameter vector p_plural_xlated_texts passed in is empty."); + ERR_FAIL_COND_MSG(p_plural_xlated_texts.is_empty(), "Parameter vector p_plural_xlated_texts passed in is empty."); translation_map[p_src_text] = p_plural_xlated_texts[0]; } diff --git a/core/string/translation_po.cpp b/core/string/translation_po.cpp index 203f29026b..0892741021 100644 --- a/core/string/translation_po.cpp +++ b/core/string/translation_po.cpp @@ -230,7 +230,7 @@ StringName TranslationPO::get_message(const StringName &p_src_text, const String if (!translation_map.has(p_context) || !translation_map[p_context].has(p_src_text)) { return StringName(); } - ERR_FAIL_COND_V_MSG(translation_map[p_context][p_src_text].empty(), StringName(), "Source text \"" + String(p_src_text) + "\" is registered but doesn't have a translation. Please report this bug."); + ERR_FAIL_COND_V_MSG(translation_map[p_context][p_src_text].is_empty(), StringName(), "Source text \"" + String(p_src_text) + "\" is registered but doesn't have a translation. Please report this bug."); return translation_map[p_context][p_src_text][0]; } @@ -246,7 +246,7 @@ StringName TranslationPO::get_plural_message(const StringName &p_src_text, const if (!translation_map.has(p_context) || !translation_map[p_context].has(p_src_text)) { return StringName(); } - ERR_FAIL_COND_V_MSG(translation_map[p_context][p_src_text].empty(), StringName(), "Source text \"" + String(p_src_text) + "\" is registered but doesn't have a translation. Please report this bug."); + ERR_FAIL_COND_V_MSG(translation_map[p_context][p_src_text].is_empty(), StringName(), "Source text \"" + String(p_src_text) + "\" is registered but doesn't have a translation. Please report this bug."); if (translation_map[p_context][p_src_text].size() == 1) { WARN_PRINT("Source string \"" + String(p_src_text) + "\" doesn't have plural translations. Use singular translation API for such as tr(), TTR() to translate \"" + String(p_src_text) + "\""); diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp index fee168993b..3276038c4d 100644 --- a/core/string/ustring.cpp +++ b/core/string/ustring.cpp @@ -427,12 +427,12 @@ String operator+(char32_t p_chr, const String &p_str) { } String &String::operator+=(const String &p_str) { - if (empty()) { + if (is_empty()) { *this = p_str; return *this; } - if (p_str.empty()) { + if (p_str.is_empty()) { return *this; } @@ -519,7 +519,7 @@ bool String::operator==(const char *p_str) const { if (length() != len) { return false; } - if (empty()) { + if (is_empty()) { return true; } @@ -558,7 +558,7 @@ bool String::operator==(const char32_t *p_str) const { if (length() != len) { return false; } - if (empty()) { + if (is_empty()) { return true; } @@ -580,7 +580,7 @@ bool String::operator==(const String &p_str) const { if (length() != p_str.length()) { return false; } - if (empty()) { + if (is_empty()) { return true; } @@ -605,7 +605,7 @@ bool String::operator==(const StrRange &p_str_range) const { if (length() != len) { return false; } - if (empty()) { + if (is_empty()) { return true; } @@ -678,20 +678,20 @@ bool String::operator>=(const String &p_str) const { } bool String::operator<(const char *p_str) const { - if (empty() && p_str[0] == 0) { + if (is_empty() && p_str[0] == 0) { return false; } - if (empty()) { + if (is_empty()) { return true; } return is_str_less(get_data(), p_str); } bool String::operator<(const wchar_t *p_str) const { - if (empty() && p_str[0] == 0) { + if (is_empty() && p_str[0] == 0) { return false; } - if (empty()) { + if (is_empty()) { return true; } @@ -705,10 +705,10 @@ bool String::operator<(const wchar_t *p_str) const { } bool String::operator<(const char32_t *p_str) const { - if (empty() && p_str[0] == 0) { + if (is_empty() && p_str[0] == 0) { return false; } - if (empty()) { + if (is_empty()) { return true; } @@ -720,13 +720,13 @@ bool String::operator<(const String &p_str) const { } signed char String::nocasecmp_to(const String &p_str) const { - if (empty() && p_str.empty()) { + if (is_empty() && p_str.is_empty()) { return 0; } - if (empty()) { + if (is_empty()) { return -1; } - if (p_str.empty()) { + if (p_str.is_empty()) { return 1; } @@ -752,13 +752,13 @@ signed char String::nocasecmp_to(const String &p_str) const { } signed char String::casecmp_to(const String &p_str) const { - if (empty() && p_str.empty()) { + if (is_empty() && p_str.is_empty()) { return 0; } - if (empty()) { + if (is_empty()) { return -1; } - if (p_str.empty()) { + if (p_str.is_empty()) { return 1; } @@ -949,10 +949,10 @@ String String::get_with_code_lines() const { } int String::get_slice_count(String p_splitter) const { - if (empty()) { + if (is_empty()) { return 0; } - if (p_splitter.empty()) { + if (p_splitter.is_empty()) { return 0; } @@ -968,7 +968,7 @@ int String::get_slice_count(String p_splitter) const { } String String::get_slice(String p_splitter, int p_slice) const { - if (empty() || p_splitter.empty()) { + if (is_empty() || p_splitter.is_empty()) { return ""; } @@ -1008,7 +1008,7 @@ String String::get_slice(String p_splitter, int p_slice) const { } String String::get_slicec(char32_t p_splitter, int p_slice) const { - if (empty()) { + if (is_empty()) { return String(); } @@ -2585,7 +2585,7 @@ int64_t String::to_int(const char32_t *p_str, int p_len, bool p_clamp) { } double String::to_float() const { - if (empty()) { + if (is_empty()) { return 0; } return built_in_strtod<char32_t>(get_data()); @@ -2767,7 +2767,7 @@ String String::substr(int p_from, int p_chars) const { p_chars = length() - p_from; } - if (empty() || p_from < 0 || p_from >= length() || p_chars <= 0) { + if (is_empty() || p_from < 0 || p_from >= length() || p_chars <= 0) { return ""; } @@ -3142,7 +3142,7 @@ bool String::is_quoted() const { } int String::_count(const String &p_string, int p_from, int p_to, bool p_case_insensitive) const { - if (p_string.empty()) { + if (p_string.is_empty()) { return 0; } int len = length(); @@ -4241,7 +4241,7 @@ bool String::is_valid_ip_address() const { Vector<String> ip = split(":"); for (int i = 0; i < ip.size(); i++) { String n = ip[i]; - if (n.empty()) { + if (n.is_empty()) { continue; } if (n.is_valid_hex_number(false)) { @@ -4331,7 +4331,7 @@ String String::get_extension() const { } String String::plus_file(const String &p_file) const { - if (empty()) { + if (is_empty()) { return p_file; } if (operator[](length() - 1) == '/' || (p_file.size() > 0 && p_file.operator[](0) == '/')) { @@ -4760,7 +4760,7 @@ String String::unquote() const { Vector<uint8_t> String::to_ascii_buffer() const { const String *s = this; - if (s->empty()) { + if (s->is_empty()) { return Vector<uint8_t>(); } CharString charstr = s->ascii(); @@ -4776,7 +4776,7 @@ Vector<uint8_t> String::to_ascii_buffer() const { Vector<uint8_t> String::to_utf8_buffer() const { const String *s = this; - if (s->empty()) { + if (s->is_empty()) { return Vector<uint8_t>(); } CharString charstr = s->utf8(); @@ -4792,7 +4792,7 @@ Vector<uint8_t> String::to_utf8_buffer() const { Vector<uint8_t> String::to_utf16_buffer() const { const String *s = this; - if (s->empty()) { + if (s->is_empty()) { return Vector<uint8_t>(); } Char16String charstr = s->utf16(); @@ -4808,7 +4808,7 @@ Vector<uint8_t> String::to_utf16_buffer() const { Vector<uint8_t> String::to_utf32_buffer() const { const String *s = this; - if (s->empty()) { + if (s->is_empty()) { return Vector<uint8_t>(); } diff --git a/core/string/ustring.h b/core/string/ustring.h index 7ff78b2d86..b42814a0a3 100644 --- a/core/string/ustring.h +++ b/core/string/ustring.h @@ -394,7 +394,7 @@ public: Vector<uint8_t> sha1_buffer() const; Vector<uint8_t> sha256_buffer() const; - _FORCE_INLINE_ bool empty() const { return length() == 0; } + _FORCE_INLINE_ bool is_empty() const { return length() == 0; } // path functions bool is_abs_path() const; diff --git a/core/templates/cowdata.h b/core/templates/cowdata.h index d5eb08286d..705eae8f9f 100644 --- a/core/templates/cowdata.h +++ b/core/templates/cowdata.h @@ -135,7 +135,7 @@ public: } _FORCE_INLINE_ void clear() { resize(0); } - _FORCE_INLINE_ bool empty() const { return _ptr == nullptr; } + _FORCE_INLINE_ bool is_empty() const { return _ptr == nullptr; } _FORCE_INLINE_ void set(int p_index, const T &p_elem) { CRASH_BAD_INDEX(p_index, size()); diff --git a/core/templates/hash_map.h b/core/templates/hash_map.h index e1ba381595..2e98302809 100644 --- a/core/templates/hash_map.h +++ b/core/templates/hash_map.h @@ -497,7 +497,7 @@ public: return elements; } - inline bool empty() const { + inline bool is_empty() const { return elements == 0; } diff --git a/core/templates/list.h b/core/templates/list.h index 8e14aaa90d..bab5198380 100644 --- a/core/templates/list.h +++ b/core/templates/list.h @@ -373,7 +373,7 @@ public: /** * return whether the list is empty */ - _FORCE_INLINE_ bool empty() const { + _FORCE_INLINE_ bool is_empty() const { return (!_data || !_data->size_cache); } diff --git a/core/templates/local_vector.h b/core/templates/local_vector.h index 4ef040dc77..1bf4161f87 100644 --- a/core/templates/local_vector.h +++ b/core/templates/local_vector.h @@ -104,7 +104,7 @@ public: capacity = 0; } } - _FORCE_INLINE_ bool empty() const { return count == 0; } + _FORCE_INLINE_ bool is_empty() const { return count == 0; } _FORCE_INLINE_ void reserve(U p_size) { p_size = nearest_power_of_2_templated(p_size); if (p_size > capacity) { diff --git a/core/templates/map.h b/core/templates/map.h index c454d69256..4e002b67f8 100644 --- a/core/templates/map.h +++ b/core/templates/map.h @@ -625,7 +625,7 @@ public: return e; } - inline bool empty() const { return _data.size_cache == 0; } + inline bool is_empty() const { return _data.size_cache == 0; } inline int size() const { return _data.size_cache; } int calculate_depth() const { diff --git a/core/templates/oa_hash_map.h b/core/templates/oa_hash_map.h index d9d632b4ce..49551ffc2d 100644 --- a/core/templates/oa_hash_map.h +++ b/core/templates/oa_hash_map.h @@ -190,7 +190,7 @@ public: _FORCE_INLINE_ uint32_t get_capacity() const { return capacity; } _FORCE_INLINE_ uint32_t get_num_elements() const { return num_elements; } - bool empty() const { + bool is_empty() const { return num_elements == 0; } diff --git a/core/templates/ordered_hash_map.h b/core/templates/ordered_hash_map.h index 9398868b01..fce9bcfbfc 100644 --- a/core/templates/ordered_hash_map.h +++ b/core/templates/ordered_hash_map.h @@ -265,7 +265,7 @@ public: return ConstElement(list.back()); } - inline bool empty() const { return list.empty(); } + inline bool is_empty() const { return list.is_empty(); } inline int size() const { return list.size(); } const void *id() const { diff --git a/core/templates/set.h b/core/templates/set.h index d0ac71a710..c323618062 100644 --- a/core/templates/set.h +++ b/core/templates/set.h @@ -576,7 +576,7 @@ public: return e; } - inline bool empty() const { return _data.size_cache == 0; } + inline bool is_empty() const { return _data.size_cache == 0; } inline int size() const { return _data.size_cache; } int calculate_depth() const { diff --git a/core/templates/vector.h b/core/templates/vector.h index 7420384bf7..1c06e7e3ab 100644 --- a/core/templates/vector.h +++ b/core/templates/vector.h @@ -79,7 +79,7 @@ public: _FORCE_INLINE_ T *ptrw() { return _cowdata.ptrw(); } _FORCE_INLINE_ const T *ptr() const { return _cowdata.ptr(); } _FORCE_INLINE_ void clear() { resize(0); } - _FORCE_INLINE_ bool empty() const { return _cowdata.empty(); } + _FORCE_INLINE_ bool is_empty() const { return _cowdata.is_empty(); } _FORCE_INLINE_ T get(int p_index) { return _cowdata.get(p_index); } _FORCE_INLINE_ const T &get(int p_index) const { return _cowdata.get(p_index); } diff --git a/core/templates/vmap.h b/core/templates/vmap.h index 8d2a3d2a9c..5fdfa1a7b5 100644 --- a/core/templates/vmap.h +++ b/core/templates/vmap.h @@ -54,7 +54,7 @@ private: _FORCE_INLINE_ int _find(const T &p_val, bool &r_exact) const { r_exact = false; - if (_cowdata.empty()) { + if (_cowdata.is_empty()) { return 0; } @@ -89,7 +89,7 @@ private: } _FORCE_INLINE_ int _find_exact(const T &p_val) const { - if (_cowdata.empty()) { + if (_cowdata.is_empty()) { return -1; } @@ -147,7 +147,7 @@ public: } _FORCE_INLINE_ int size() const { return _cowdata.size(); } - _FORCE_INLINE_ bool empty() const { return _cowdata.empty(); } + _FORCE_INLINE_ bool is_empty() const { return _cowdata.is_empty(); } const Pair *get_array() const { return _cowdata.ptr(); diff --git a/core/templates/vset.h b/core/templates/vset.h index 4c0b8717b6..f2ea5c814b 100644 --- a/core/templates/vset.h +++ b/core/templates/vset.h @@ -40,7 +40,7 @@ class VSet { _FORCE_INLINE_ int _find(const T &p_val, bool &r_exact) const { r_exact = false; - if (_data.empty()) { + if (_data.is_empty()) { return 0; } @@ -76,7 +76,7 @@ class VSet { } _FORCE_INLINE_ int _find_exact(const T &p_val) const { - if (_data.empty()) { + if (_data.is_empty()) { return -1; } @@ -126,7 +126,7 @@ public: return _find_exact(p_val); } - _FORCE_INLINE_ bool empty() const { return _data.empty(); } + _FORCE_INLINE_ bool is_empty() const { return _data.is_empty(); } _FORCE_INLINE_ int size() const { return _data.size(); } diff --git a/core/variant/array.cpp b/core/variant/array.cpp index 5043868b1d..9b8ef24cb9 100644 --- a/core/variant/array.cpp +++ b/core/variant/array.cpp @@ -86,8 +86,8 @@ int Array::size() const { return _p->array.size(); } -bool Array::empty() const { - return _p->array.empty(); +bool Array::is_empty() const { + return _p->array.is_empty(); } void Array::clear() { @@ -318,7 +318,7 @@ Array Array::slice(int p_begin, int p_end, int p_step, bool p_deep) const { // l ERR_FAIL_COND_V_MSG(p_step == 0, new_arr, "Array slice step size cannot be zero."); - if (empty()) { // Don't try to slice empty arrays. + if (is_empty()) { // Don't try to slice empty arrays. return new_arr; } if (p_step > 0) { @@ -459,7 +459,7 @@ void Array::push_front(const Variant &p_value) { } Variant Array::pop_back() { - if (!_p->array.empty()) { + if (!_p->array.is_empty()) { int n = _p->array.size() - 1; Variant ret = _p->array.get(n); _p->array.resize(n); @@ -469,7 +469,7 @@ Variant Array::pop_back() { } Variant Array::pop_front() { - if (!_p->array.empty()) { + if (!_p->array.is_empty()) { Variant ret = _p->array.get(0); _p->array.remove(0); return ret; diff --git a/core/variant/array.h b/core/variant/array.h index e01ac13168..6d21446b07 100644 --- a/core/variant/array.h +++ b/core/variant/array.h @@ -57,7 +57,7 @@ public: const Variant &get(int p_idx) const; int size() const; - bool empty() const; + bool is_empty() const; void clear(); bool operator==(const Array &p_array) const; diff --git a/core/variant/dictionary.cpp b/core/variant/dictionary.cpp index 2bc1f7a86d..aff3f1326a 100644 --- a/core/variant/dictionary.cpp +++ b/core/variant/dictionary.cpp @@ -40,7 +40,7 @@ struct DictionaryPrivate { }; void Dictionary::get_key_list(List<Variant> *p_keys) const { - if (_p->variant_map.empty()) { + if (_p->variant_map.is_empty()) { return; } @@ -121,7 +121,7 @@ int Dictionary::size() const { return _p->variant_map.size(); } -bool Dictionary::empty() const { +bool Dictionary::is_empty() const { return !_p->variant_map.size(); } @@ -192,7 +192,7 @@ uint32_t Dictionary::hash() const { Array Dictionary::keys() const { Array varr; - if (_p->variant_map.empty()) { + if (_p->variant_map.is_empty()) { return varr; } @@ -209,7 +209,7 @@ Array Dictionary::keys() const { Array Dictionary::values() const { Array varr; - if (_p->variant_map.empty()) { + if (_p->variant_map.is_empty()) { return varr; } diff --git a/core/variant/dictionary.h b/core/variant/dictionary.h index bbe94122ad..8bc559a73d 100644 --- a/core/variant/dictionary.h +++ b/core/variant/dictionary.h @@ -60,7 +60,7 @@ public: Variant get(const Variant &p_key, const Variant &p_default) const; int size() const; - bool empty() const; + bool is_empty() const; void clear(); bool has(const Variant &p_key) const; diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp index 9eb512f71d..8e14886e38 100644 --- a/core/variant/variant.cpp +++ b/core/variant/variant.cpp @@ -912,11 +912,11 @@ bool Variant::is_zero() const { } break; case DICTIONARY: { - return reinterpret_cast<const Dictionary *>(_data._mem)->empty(); + return reinterpret_cast<const Dictionary *>(_data._mem)->is_empty(); } break; case ARRAY: { - return reinterpret_cast<const Array *>(_data._mem)->empty(); + return reinterpret_cast<const Array *>(_data._mem)->is_empty(); } break; diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp index 854c0c01ef..2b6364786e 100644 --- a/core/variant/variant_call.cpp +++ b/core/variant/variant_call.cpp @@ -940,7 +940,7 @@ static void _register_variant_builtin_methods() { bind_method(String, md5_buffer, sarray(), varray()); bind_method(String, sha1_buffer, sarray(), varray()); bind_method(String, sha256_buffer, sarray(), varray()); - bind_method(String, empty, sarray(), varray()); + bind_method(String, is_empty, sarray(), varray()); // FIXME: Static function, not sure how to bind //bind_method(String, humanize_size, sarray("size"), varray()); @@ -1269,7 +1269,7 @@ static void _register_variant_builtin_methods() { /* Dictionary */ bind_method(Dictionary, size, sarray(), varray()); - bind_method(Dictionary, empty, sarray(), varray()); + bind_method(Dictionary, is_empty, sarray(), varray()); bind_method(Dictionary, clear, sarray(), varray()); bind_method(Dictionary, has, sarray("key"), varray()); bind_method(Dictionary, has_all, sarray("keys"), varray()); @@ -1283,7 +1283,7 @@ static void _register_variant_builtin_methods() { /* Array */ bind_method(Array, size, sarray(), varray()); - bind_method(Array, empty, sarray(), varray()); + bind_method(Array, is_empty, sarray(), varray()); bind_method(Array, clear, sarray(), varray()); bind_method(Array, hash, sarray(), varray()); bind_method(Array, push_back, sarray("value"), varray()); @@ -1316,7 +1316,7 @@ static void _register_variant_builtin_methods() { /* Byte Array */ bind_method(PackedByteArray, size, sarray(), varray()); - bind_method(PackedByteArray, empty, sarray(), varray()); + bind_method(PackedByteArray, is_empty, sarray(), varray()); bind_method(PackedByteArray, set, sarray("index", "value"), varray()); bind_method(PackedByteArray, push_back, sarray("value"), varray()); bind_method(PackedByteArray, append, sarray("value"), varray()); @@ -1342,7 +1342,7 @@ static void _register_variant_builtin_methods() { /* Int32 Array */ bind_method(PackedInt32Array, size, sarray(), varray()); - bind_method(PackedInt32Array, empty, sarray(), varray()); + bind_method(PackedInt32Array, is_empty, sarray(), varray()); bind_method(PackedInt32Array, set, sarray("index", "value"), varray()); bind_method(PackedInt32Array, push_back, sarray("value"), varray()); bind_method(PackedInt32Array, append, sarray("value"), varray()); @@ -1360,7 +1360,7 @@ static void _register_variant_builtin_methods() { /* Int64 Array */ bind_method(PackedInt64Array, size, sarray(), varray()); - bind_method(PackedInt64Array, empty, sarray(), varray()); + bind_method(PackedInt64Array, is_empty, sarray(), varray()); bind_method(PackedInt64Array, set, sarray("index", "value"), varray()); bind_method(PackedInt64Array, push_back, sarray("value"), varray()); bind_method(PackedInt64Array, append, sarray("value"), varray()); @@ -1378,7 +1378,7 @@ static void _register_variant_builtin_methods() { /* Float32 Array */ bind_method(PackedFloat32Array, size, sarray(), varray()); - bind_method(PackedFloat32Array, empty, sarray(), varray()); + bind_method(PackedFloat32Array, is_empty, sarray(), varray()); bind_method(PackedFloat32Array, set, sarray("index", "value"), varray()); bind_method(PackedFloat32Array, push_back, sarray("value"), varray()); bind_method(PackedFloat32Array, append, sarray("value"), varray()); @@ -1396,7 +1396,7 @@ static void _register_variant_builtin_methods() { /* Float64 Array */ bind_method(PackedFloat64Array, size, sarray(), varray()); - bind_method(PackedFloat64Array, empty, sarray(), varray()); + bind_method(PackedFloat64Array, is_empty, sarray(), varray()); bind_method(PackedFloat64Array, set, sarray("index", "value"), varray()); bind_method(PackedFloat64Array, push_back, sarray("value"), varray()); bind_method(PackedFloat64Array, append, sarray("value"), varray()); @@ -1414,7 +1414,7 @@ static void _register_variant_builtin_methods() { /* String Array */ bind_method(PackedStringArray, size, sarray(), varray()); - bind_method(PackedStringArray, empty, sarray(), varray()); + bind_method(PackedStringArray, is_empty, sarray(), varray()); bind_method(PackedStringArray, set, sarray("index", "value"), varray()); bind_method(PackedStringArray, push_back, sarray("value"), varray()); bind_method(PackedStringArray, append, sarray("value"), varray()); @@ -1432,7 +1432,7 @@ static void _register_variant_builtin_methods() { /* Vector2 Array */ bind_method(PackedVector2Array, size, sarray(), varray()); - bind_method(PackedVector2Array, empty, sarray(), varray()); + bind_method(PackedVector2Array, is_empty, sarray(), varray()); bind_method(PackedVector2Array, set, sarray("index", "value"), varray()); bind_method(PackedVector2Array, push_back, sarray("value"), varray()); bind_method(PackedVector2Array, append, sarray("value"), varray()); @@ -1450,7 +1450,7 @@ static void _register_variant_builtin_methods() { /* Vector3 Array */ bind_method(PackedVector3Array, size, sarray(), varray()); - bind_method(PackedVector3Array, empty, sarray(), varray()); + bind_method(PackedVector3Array, is_empty, sarray(), varray()); bind_method(PackedVector3Array, set, sarray("index", "value"), varray()); bind_method(PackedVector3Array, push_back, sarray("value"), varray()); bind_method(PackedVector3Array, append, sarray("value"), varray()); @@ -1468,7 +1468,7 @@ static void _register_variant_builtin_methods() { /* Color Array */ bind_method(PackedColorArray, size, sarray(), varray()); - bind_method(PackedColorArray, empty, sarray(), varray()); + bind_method(PackedColorArray, is_empty, sarray(), varray()); bind_method(PackedColorArray, set, sarray("index", "value"), varray()); bind_method(PackedColorArray, push_back, sarray("value"), varray()); bind_method(PackedColorArray, append, sarray("value"), varray()); diff --git a/core/variant/variant_setget.cpp b/core/variant/variant_setget.cpp index dd3e70fc6a..f099c768a0 100644 --- a/core/variant/variant_setget.cpp +++ b/core/variant/variant_setget.cpp @@ -1477,7 +1477,7 @@ bool Variant::iter_init(Variant &r_iter, bool &valid) const { case STRING: { const String *str = reinterpret_cast<const String *>(_data._mem); - if (str->empty()) { + if (str->is_empty()) { return false; } r_iter = 0; @@ -1485,7 +1485,7 @@ bool Variant::iter_init(Variant &r_iter, bool &valid) const { } break; case DICTIONARY: { const Dictionary *dic = reinterpret_cast<const Dictionary *>(_data._mem); - if (dic->empty()) { + if (dic->is_empty()) { return false; } @@ -1496,7 +1496,7 @@ bool Variant::iter_init(Variant &r_iter, bool &valid) const { } break; case ARRAY: { const Array *arr = reinterpret_cast<const Array *>(_data._mem); - if (arr->empty()) { + if (arr->is_empty()) { return false; } r_iter = 0; |