From 96a95cb9743e755f10fa6a14895ea099e5ac4c51 Mon Sep 17 00:00:00 2001 From: Muller-Castro <37383316+Muller-Castro@users.noreply.github.com> Date: Sun, 1 Aug 2021 16:47:20 -0300 Subject: [PATCH] Add const lvalue ref to container parameters --- core/core_bind.cpp | 14 +++++------ core/core_bind.h | 14 +++++------ core/core_constants.cpp | 2 +- core/core_constants.h | 2 +- core/extension/gdextension.cpp | 4 ++-- core/extension/gdextension.h | 4 ++-- core/object/script_language.h | 2 +- core/object/script_language_extension.h | 2 +- core/variant/variant.h | 4 ++-- core/variant/variant_call.cpp | 10 ++++---- editor/editor_resource_picker.cpp | 2 +- editor/editor_resource_picker.h | 2 +- editor/export/project_export.cpp | 2 +- .../post_import_plugin_skeleton_renamer.cpp | 4 ++-- .../3d/post_import_plugin_skeleton_renamer.h | 2 +- editor/plugins/bone_map_editor_plugin.cpp | 2 +- editor/plugins/bone_map_editor_plugin.h | 2 +- editor/plugins/canvas_item_editor_plugin.cpp | 10 ++++---- editor/plugins/canvas_item_editor_plugin.h | 10 ++++---- editor/plugins/theme_editor_plugin.cpp | 2 +- editor/plugins/theme_editor_plugin.h | 2 +- editor/plugins/tiles/tile_data_editors.cpp | 24 +++++++++---------- editor/plugins/tiles/tile_data_editors.h | 22 ++++++++--------- .../tiles/tile_set_atlas_source_editor.cpp | 2 +- .../tiles/tile_set_atlas_source_editor.h | 2 +- editor/scene_tree_dock.cpp | 2 +- modules/gdscript/gdscript.h | 2 +- modules/gdscript/gdscript_analyzer.cpp | 2 +- modules/gdscript/gdscript_analyzer.h | 2 +- modules/gdscript/gdscript_editor.cpp | 12 +++++----- modules/gltf/gltf_document.cpp | 2 +- modules/gltf/structures/gltf_skeleton.h | 2 +- modules/mono/csharp_script.cpp | 2 +- modules/mono/csharp_script.h | 2 +- .../scene_replication_interface.cpp | 4 ++-- .../multiplayer/scene_replication_interface.h | 4 ++-- platform/android/java_godot_wrapper.cpp | 2 +- platform/android/java_godot_wrapper.h | 2 +- platform/web/export/export_plugin.cpp | 2 +- platform/web/export/export_plugin.h | 2 +- scene/3d/visual_instance_3d.cpp | 2 +- scene/3d/visual_instance_3d.h | 2 +- scene/3d/xr_nodes.cpp | 12 +++++----- scene/3d/xr_nodes.h | 12 +++++----- scene/animation/animation_mixer.cpp | 2 +- scene/animation/animation_mixer.h | 2 +- scene/gui/graph_edit_arranger.cpp | 4 ++-- scene/gui/graph_edit_arranger.h | 4 ++-- scene/resources/bone_map.cpp | 10 ++++---- scene/resources/bone_map.h | 10 ++++---- scene/resources/material.cpp | 2 +- scene/resources/material.h | 2 +- scene/resources/navigation_mesh.cpp | 2 +- scene/resources/navigation_mesh.h | 2 +- scene/resources/navigation_polygon.cpp | 2 +- scene/resources/navigation_polygon.h | 2 +- scene/resources/skeleton_profile.cpp | 18 +++++++------- scene/resources/skeleton_profile.h | 18 +++++++------- scene/resources/theme.cpp | 14 +++++------ scene/resources/theme.h | 14 +++++------ scene/theme/theme_owner.cpp | 4 ++-- scene/theme/theme_owner.h | 4 ++-- servers/audio_server.cpp | 8 +++---- servers/audio_server.h | 8 +++---- .../storage_rd/render_scene_buffers_rd.cpp | 4 ++-- .../storage_rd/render_scene_buffers_rd.h | 6 ++--- servers/rendering/shader_language.cpp | 4 ++-- servers/rendering/shader_language.h | 4 ++-- 68 files changed, 185 insertions(+), 185 deletions(-) diff --git a/core/core_bind.cpp b/core/core_bind.cpp index e3dad090917..e5363f9acc8 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -1375,11 +1375,11 @@ Variant ClassDB::instantiate(const StringName &p_class) const { } } -bool ClassDB::class_has_signal(StringName p_class, StringName p_signal) const { +bool ClassDB::class_has_signal(const StringName &p_class, const StringName &p_signal) const { return ::ClassDB::has_signal(p_class, p_signal); } -Dictionary ClassDB::class_get_signal(StringName p_class, StringName p_signal) const { +Dictionary ClassDB::class_get_signal(const StringName &p_class, const StringName &p_signal) const { MethodInfo signal; if (::ClassDB::get_signal(p_class, p_signal, &signal)) { return signal.operator Dictionary(); @@ -1388,7 +1388,7 @@ Dictionary ClassDB::class_get_signal(StringName p_class, StringName p_signal) co } } -TypedArray ClassDB::class_get_signal_list(StringName p_class, bool p_no_inheritance) const { +TypedArray ClassDB::class_get_signal_list(const StringName &p_class, bool p_no_inheritance) const { List signals; ::ClassDB::get_signal_list(p_class, &signals, p_no_inheritance); TypedArray ret; @@ -1400,7 +1400,7 @@ TypedArray ClassDB::class_get_signal_list(StringName p_class, bool p return ret; } -TypedArray ClassDB::class_get_property_list(StringName p_class, bool p_no_inheritance) const { +TypedArray ClassDB::class_get_property_list(const StringName &p_class, bool p_no_inheritance) const { List plist; ::ClassDB::get_property_list(p_class, &plist, p_no_inheritance); TypedArray ret; @@ -1428,11 +1428,11 @@ Error ClassDB::class_set_property(Object *p_object, const StringName &p_property return OK; } -bool ClassDB::class_has_method(StringName p_class, StringName p_method, bool p_no_inheritance) const { +bool ClassDB::class_has_method(const StringName &p_class, const StringName &p_method, bool p_no_inheritance) const { return ::ClassDB::has_method(p_class, p_method, p_no_inheritance); } -TypedArray ClassDB::class_get_method_list(StringName p_class, bool p_no_inheritance) const { +TypedArray ClassDB::class_get_method_list(const StringName &p_class, bool p_no_inheritance) const { List methods; ::ClassDB::get_method_list(p_class, &methods, p_no_inheritance); TypedArray ret; @@ -1513,7 +1513,7 @@ StringName ClassDB::class_get_integer_constant_enum(const StringName &p_class, c return ::ClassDB::get_integer_constant_enum(p_class, p_name, p_no_inheritance); } -bool ClassDB::is_class_enabled(StringName p_class) const { +bool ClassDB::is_class_enabled(const StringName &p_class) const { return ::ClassDB::is_class_enabled(p_class); } diff --git a/core/core_bind.h b/core/core_bind.h index a8244cf7c5d..94d95f2ce98 100644 --- a/core/core_bind.h +++ b/core/core_bind.h @@ -435,17 +435,17 @@ public: bool can_instantiate(const StringName &p_class) const; Variant instantiate(const StringName &p_class) const; - bool class_has_signal(StringName p_class, StringName p_signal) const; - Dictionary class_get_signal(StringName p_class, StringName p_signal) const; - TypedArray class_get_signal_list(StringName p_class, bool p_no_inheritance = false) const; + bool class_has_signal(const StringName &p_class, const StringName &p_signal) const; + Dictionary class_get_signal(const StringName &p_class, const StringName &p_signal) const; + TypedArray class_get_signal_list(const StringName &p_class, bool p_no_inheritance = false) const; - TypedArray class_get_property_list(StringName p_class, bool p_no_inheritance = false) const; + TypedArray class_get_property_list(const StringName &p_class, bool p_no_inheritance = false) const; Variant class_get_property(Object *p_object, const StringName &p_property) const; Error class_set_property(Object *p_object, const StringName &p_property, const Variant &p_value) const; - bool class_has_method(StringName p_class, StringName p_method, bool p_no_inheritance = false) const; + bool class_has_method(const StringName &p_class, const StringName &p_method, bool p_no_inheritance = false) const; - TypedArray class_get_method_list(StringName p_class, bool p_no_inheritance = false) const; + TypedArray class_get_method_list(const StringName &p_class, bool p_no_inheritance = false) const; PackedStringArray class_get_integer_constant_list(const StringName &p_class, bool p_no_inheritance = false) const; bool class_has_integer_constant(const StringName &p_class, const StringName &p_name) const; @@ -456,7 +456,7 @@ public: PackedStringArray class_get_enum_constants(const StringName &p_class, const StringName &p_enum, bool p_no_inheritance = false) const; StringName class_get_integer_constant_enum(const StringName &p_class, const StringName &p_name, bool p_no_inheritance = false) const; - bool is_class_enabled(StringName p_class) const; + bool is_class_enabled(const StringName &p_class) const; ClassDB() {} ~ClassDB() {} diff --git a/core/core_constants.cpp b/core/core_constants.cpp index 2f70fdf2196..3b96fc20c6e 100644 --- a/core/core_constants.cpp +++ b/core/core_constants.cpp @@ -845,7 +845,7 @@ bool CoreConstants::is_global_enum(const StringName &p_enum) { return _global_enums.has(p_enum); } -void CoreConstants::get_enum_values(StringName p_enum, HashMap *p_values) { +void CoreConstants::get_enum_values(const StringName &p_enum, HashMap *p_values) { ERR_FAIL_NULL_MSG(p_values, "Trying to get enum values with null map."); ERR_FAIL_COND_MSG(!_global_enums.has(p_enum), "Trying to get values of non-existing enum."); for (const _CoreConstant &constant : _global_enums[p_enum]) { diff --git a/core/core_constants.h b/core/core_constants.h index 51842490c88..82d626c7495 100644 --- a/core/core_constants.h +++ b/core/core_constants.h @@ -45,7 +45,7 @@ public: static bool is_global_constant(const StringName &p_name); static int get_global_constant_index(const StringName &p_name); static bool is_global_enum(const StringName &p_enum); - static void get_enum_values(StringName p_enum, HashMap *p_values); + static void get_enum_values(const StringName &p_enum, HashMap *p_values); }; #endif // CORE_CONSTANTS_H diff --git a/core/extension/gdextension.cpp b/core/extension/gdextension.cpp index 19ffe96a092..ce01531b5ce 100644 --- a/core/extension/gdextension.cpp +++ b/core/extension/gdextension.cpp @@ -666,12 +666,12 @@ void GDExtension::_get_library_path(GDExtensionClassLibraryPtr p_library, GDExte HashMap GDExtension::gdextension_interface_functions; -void GDExtension::register_interface_function(StringName p_function_name, GDExtensionInterfaceFunctionPtr p_function_pointer) { +void GDExtension::register_interface_function(const StringName &p_function_name, GDExtensionInterfaceFunctionPtr p_function_pointer) { ERR_FAIL_COND_MSG(gdextension_interface_functions.has(p_function_name), "Attempt to register interface function '" + p_function_name + "', which appears to be already registered."); gdextension_interface_functions.insert(p_function_name, p_function_pointer); } -GDExtensionInterfaceFunctionPtr GDExtension::get_interface_function(StringName p_function_name) { +GDExtensionInterfaceFunctionPtr GDExtension::get_interface_function(const StringName &p_function_name) { GDExtensionInterfaceFunctionPtr *function = gdextension_interface_functions.getptr(p_function_name); ERR_FAIL_NULL_V_MSG(function, nullptr, "Attempt to get non-existent interface function: " + String(p_function_name) + "."); return *function; diff --git a/core/extension/gdextension.h b/core/extension/gdextension.h index 0d20b8e50c8..0b39581751a 100644 --- a/core/extension/gdextension.h +++ b/core/extension/gdextension.h @@ -154,8 +154,8 @@ public: void initialize_library(InitializationLevel p_level); void deinitialize_library(InitializationLevel p_level); - static void register_interface_function(StringName p_function_name, GDExtensionInterfaceFunctionPtr p_function_pointer); - static GDExtensionInterfaceFunctionPtr get_interface_function(StringName p_function_name); + static void register_interface_function(const StringName &p_function_name, GDExtensionInterfaceFunctionPtr p_function_pointer); + static GDExtensionInterfaceFunctionPtr get_interface_function(const StringName &p_function_name); static void initialize_gdextensions(); static void finalize_gdextensions(); diff --git a/core/object/script_language.h b/core/object/script_language.h index 69da50f0742..66106bf1397 100644 --- a/core/object/script_language.h +++ b/core/object/script_language.h @@ -243,7 +243,7 @@ public: virtual void get_doc_comment_delimiters(List *p_delimiters) const = 0; virtual void get_string_delimiters(List *p_delimiters) const = 0; virtual Ref