Skip to content

Commit

Permalink
Add const lvalue ref to container parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Muller-Castro committed Jan 5, 2024
1 parent 89cc635 commit 96a95cb
Show file tree
Hide file tree
Showing 68 changed files with 185 additions and 185 deletions.
14 changes: 7 additions & 7 deletions core/core_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -1388,7 +1388,7 @@ Dictionary ClassDB::class_get_signal(StringName p_class, StringName p_signal) co
}
}

TypedArray<Dictionary> ClassDB::class_get_signal_list(StringName p_class, bool p_no_inheritance) const {
TypedArray<Dictionary> ClassDB::class_get_signal_list(const StringName &p_class, bool p_no_inheritance) const {
List<MethodInfo> signals;
::ClassDB::get_signal_list(p_class, &signals, p_no_inheritance);
TypedArray<Dictionary> ret;
Expand All @@ -1400,7 +1400,7 @@ TypedArray<Dictionary> ClassDB::class_get_signal_list(StringName p_class, bool p
return ret;
}

TypedArray<Dictionary> ClassDB::class_get_property_list(StringName p_class, bool p_no_inheritance) const {
TypedArray<Dictionary> ClassDB::class_get_property_list(const StringName &p_class, bool p_no_inheritance) const {
List<PropertyInfo> plist;
::ClassDB::get_property_list(p_class, &plist, p_no_inheritance);
TypedArray<Dictionary> ret;
Expand Down Expand Up @@ -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<Dictionary> ClassDB::class_get_method_list(StringName p_class, bool p_no_inheritance) const {
TypedArray<Dictionary> ClassDB::class_get_method_list(const StringName &p_class, bool p_no_inheritance) const {
List<MethodInfo> methods;
::ClassDB::get_method_list(p_class, &methods, p_no_inheritance);
TypedArray<Dictionary> ret;
Expand Down Expand Up @@ -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);
}

Expand Down
14 changes: 7 additions & 7 deletions core/core_bind.h
Original file line number Diff line number Diff line change
Expand Up @@ -435,17 +435,17 @@ class ClassDB : public Object {
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<Dictionary> 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<Dictionary> class_get_signal_list(const StringName &p_class, bool p_no_inheritance = false) const;

TypedArray<Dictionary> class_get_property_list(StringName p_class, bool p_no_inheritance = false) const;
TypedArray<Dictionary> 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<Dictionary> class_get_method_list(StringName p_class, bool p_no_inheritance = false) const;
TypedArray<Dictionary> 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;
Expand All @@ -456,7 +456,7 @@ class ClassDB : public Object {
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() {}
Expand Down
2 changes: 1 addition & 1 deletion core/core_constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<StringName, int64_t> *p_values) {
void CoreConstants::get_enum_values(const StringName &p_enum, HashMap<StringName, int64_t> *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]) {
Expand Down
2 changes: 1 addition & 1 deletion core/core_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class CoreConstants {
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<StringName, int64_t> *p_values);
static void get_enum_values(const StringName &p_enum, HashMap<StringName, int64_t> *p_values);
};

#endif // CORE_CONSTANTS_H
4 changes: 2 additions & 2 deletions core/extension/gdextension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -666,12 +666,12 @@ void GDExtension::_get_library_path(GDExtensionClassLibraryPtr p_library, GDExte

HashMap<StringName, GDExtensionInterfaceFunctionPtr> 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;
Expand Down
4 changes: 2 additions & 2 deletions core/extension/gdextension.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ class GDExtension : public Resource {
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();

Expand Down
2 changes: 1 addition & 1 deletion core/object/script_language.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ class ScriptLanguage : public Object {
virtual void get_doc_comment_delimiters(List<String> *p_delimiters) const = 0;
virtual void get_string_delimiters(List<String> *p_delimiters) const = 0;
virtual Ref<Script> make_template(const String &p_template, const String &p_class_name, const String &p_base_class_name) const { return Ref<Script>(); }
virtual Vector<ScriptTemplate> get_built_in_templates(StringName p_object) { return Vector<ScriptTemplate>(); }
virtual Vector<ScriptTemplate> get_built_in_templates(const StringName &p_object) { return Vector<ScriptTemplate>(); }
virtual bool is_using_templates() { return false; }
virtual bool validate(const String &p_script, const String &p_path = "", List<String> *r_functions = nullptr, List<ScriptError> *r_errors = nullptr, List<Warning> *r_warnings = nullptr, HashSet<int> *r_safe_lines = nullptr) const = 0;
virtual String validate_path(const String &p_path) const { return ""; }
Expand Down
2 changes: 1 addition & 1 deletion core/object/script_language_extension.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ class ScriptLanguageExtension : public ScriptLanguage {

GDVIRTUAL1RC(TypedArray<Dictionary>, _get_built_in_templates, StringName)

virtual Vector<ScriptTemplate> get_built_in_templates(StringName p_object) override {
virtual Vector<ScriptTemplate> get_built_in_templates(const StringName &p_object) override {
TypedArray<Dictionary> ret;
GDVIRTUAL_REQUIRED_CALL(_get_built_in_templates, p_object, ret);
Vector<ScriptTemplate> stret;
Expand Down
4 changes: 2 additions & 2 deletions core/variant/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -781,8 +781,8 @@ class Variant {
static Variant get_constant_value(Variant::Type p_type, const StringName &p_value, bool *r_valid = nullptr);

static void get_enums_for_type(Variant::Type p_type, List<StringName> *p_enums);
static void get_enumerations_for_enum(Variant::Type p_type, StringName p_enum_name, List<StringName> *p_enumerations);
static int get_enum_value(Variant::Type p_type, StringName p_enum_name, StringName p_enumeration, bool *r_valid = nullptr);
static void get_enumerations_for_enum(Variant::Type p_type, const StringName &p_enum_name, List<StringName> *p_enumerations);
static int get_enum_value(Variant::Type p_type, const StringName &p_enum_name, const StringName &p_enumeration, bool *r_valid = nullptr);

typedef String (*ObjectDeConstruct)(const Variant &p_object, void *ud);
typedef void (*ObjectConstruct)(const String &p_text, void *ud, Variant &r_value);
Expand Down
10 changes: 5 additions & 5 deletions core/variant/variant_call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1071,14 +1071,14 @@ struct _VariantCall {

static ConstantData *constant_data;

static void add_constant(int p_type, StringName p_constant_name, int64_t p_constant_value) {
static void add_constant(int p_type, const StringName &p_constant_name, int64_t p_constant_value) {
constant_data[p_type].value[p_constant_name] = p_constant_value;
#ifdef DEBUG_ENABLED
constant_data[p_type].value_ordered.push_back(p_constant_name);
#endif
}

static void add_variant_constant(int p_type, StringName p_constant_name, const Variant &p_constant_value) {
static void add_variant_constant(int p_type, const StringName &p_constant_name, const Variant &p_constant_value) {
constant_data[p_type].variant_value[p_constant_name] = p_constant_value;
#ifdef DEBUG_ENABLED
constant_data[p_type].variant_value_ordered.push_back(p_constant_name);
Expand All @@ -1091,7 +1091,7 @@ struct _VariantCall {

static EnumData *enum_data;

static void add_enum_constant(int p_type, StringName p_enum_type_name, StringName p_enumeration_name, int p_enum_value) {
static void add_enum_constant(int p_type, const StringName &p_enum_type_name, const StringName &p_enumeration_name, int p_enum_value) {
enum_data[p_type].value[p_enum_type_name][p_enumeration_name] = p_enum_value;
}
};
Expand Down Expand Up @@ -1504,7 +1504,7 @@ void Variant::get_enums_for_type(Variant::Type p_type, List<StringName> *p_enums
}
}

void Variant::get_enumerations_for_enum(Variant::Type p_type, StringName p_enum_name, List<StringName> *p_enumerations) {
void Variant::get_enumerations_for_enum(Variant::Type p_type, const StringName &p_enum_name, List<StringName> *p_enumerations) {
ERR_FAIL_INDEX(p_type, Variant::VARIANT_MAX);

_VariantCall::EnumData &enum_data = _VariantCall::enum_data[p_type];
Expand All @@ -1516,7 +1516,7 @@ void Variant::get_enumerations_for_enum(Variant::Type p_type, StringName p_enum_
}
}

int Variant::get_enum_value(Variant::Type p_type, StringName p_enum_name, StringName p_enumeration, bool *r_valid) {
int Variant::get_enum_value(Variant::Type p_type, const StringName &p_enum_name, const StringName &p_enumeration, bool *r_valid) {
if (r_valid) {
*r_valid = false;
}
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_resource_picker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ bool EditorResourcePicker::_is_drop_valid(const Dictionary &p_drag_data) const {
return false;
}

bool EditorResourcePicker::_is_type_valid(const String p_type_name, HashSet<StringName> p_allowed_types) const {
bool EditorResourcePicker::_is_type_valid(const String p_type_name, const HashSet<StringName> &p_allowed_types) const {
for (const StringName &E : p_allowed_types) {
String at = E;
if (p_type_name == at || ClassDB::is_parent_class(p_type_name, at) || EditorNode::get_editor_data().script_class_is_parent(p_type_name, at)) {
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_resource_picker.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class EditorResourcePicker : public HBoxContainer {
String _get_resource_type(const Ref<Resource> &p_resource) const;
void _get_allowed_types(bool p_with_convert, HashSet<StringName> *p_vector) const;
bool _is_drop_valid(const Dictionary &p_drag_data) const;
bool _is_type_valid(const String p_type_name, HashSet<StringName> p_allowed_types) const;
bool _is_type_valid(const String p_type_name, const HashSet<StringName> &p_allowed_types) const;

Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
Expand Down
2 changes: 1 addition & 1 deletion editor/export/project_export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ ProjectExportDialog::ProjectExportDialog() {
ClassDB::get_inheriters_from_class("Resource", &resource_names);

PackedStringArray strippable;
for (StringName resource_name : resource_names) {
for (const StringName &resource_name : resource_names) {
if (ClassDB::has_method(resource_name, "create_placeholder", true)) {
strippable.push_back(resource_name);
}
Expand Down
4 changes: 2 additions & 2 deletions editor/import/3d/post_import_plugin_skeleton_renamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void PostImportPluginSkeletonRenamer::get_internal_import_options(InternalImport
}
}

void PostImportPluginSkeletonRenamer::_internal_process(InternalImportCategory p_category, Node *p_base_scene, Node *p_node, Ref<Resource> p_resource, const Dictionary &p_options, HashMap<String, String> p_rename_map) {
void PostImportPluginSkeletonRenamer::_internal_process(InternalImportCategory p_category, Node *p_base_scene, Node *p_node, Ref<Resource> p_resource, const Dictionary &p_options, const HashMap<String, String> &p_rename_map) {
// Prepare objects.
Object *map = p_options["retarget/bone_map"].get_validated_object();
if (!map || !bool(p_options["retarget/bone_renamer/rename_bones"])) {
Expand Down Expand Up @@ -121,7 +121,7 @@ void PostImportPluginSkeletonRenamer::_internal_process(InternalImportCategory p
// Rename bones in all Nodes by calling method.
{
Dictionary rename_map_dict;
for (HashMap<String, String>::Iterator E = p_rename_map.begin(); E; ++E) {
for (HashMap<String, String>::ConstIterator E = p_rename_map.begin(); E; ++E) {
rename_map_dict[E->key] = E->value;
}

Expand Down
2 changes: 1 addition & 1 deletion editor/import/3d/post_import_plugin_skeleton_renamer.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class PostImportPluginSkeletonRenamer : public EditorScenePostImportPlugin {
virtual void get_internal_import_options(InternalImportCategory p_category, List<ResourceImporter::ImportOption> *r_options) override;
virtual void internal_process(InternalImportCategory p_category, Node *p_base_scene, Node *p_node, Ref<Resource> p_resource, const Dictionary &p_options) override;

void _internal_process(InternalImportCategory p_category, Node *p_base_scene, Node *p_node, Ref<Resource> p_resource, const Dictionary &p_options, HashMap<String, String> p_rename_map);
void _internal_process(InternalImportCategory p_category, Node *p_base_scene, Node *p_node, Ref<Resource> p_resource, const Dictionary &p_options, const HashMap<String, String> &p_rename_map);

PostImportPluginSkeletonRenamer();
};
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/bone_map_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void BoneMapperButton::_notification(int p_what) {
}
}

BoneMapperButton::BoneMapperButton(const StringName p_profile_bone_name, bool p_require, bool p_selected) {
BoneMapperButton::BoneMapperButton(const StringName &p_profile_bone_name, bool p_require, bool p_selected) {
profile_bone_name = p_profile_bone_name;
require = p_require;
selected = p_selected;
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/bone_map_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class BoneMapperButton : public TextureButton {

bool is_require() const;

BoneMapperButton(const StringName p_profile_bone_name, bool p_require, bool p_selected);
BoneMapperButton(const StringName &p_profile_bone_name, bool p_require, bool p_selected);
~BoneMapperButton();
};

Expand Down
10 changes: 5 additions & 5 deletions editor/plugins/canvas_item_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ void CanvasItemEditor::_snap_other_nodes(
}
}

Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, unsigned int p_forced_modes, const CanvasItem *p_self_canvas_item, List<CanvasItem *> p_other_nodes_exceptions) {
Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, unsigned int p_forced_modes, const CanvasItem *p_self_canvas_item, const List<CanvasItem *> &p_other_nodes_exceptions) {
snap_target[0] = SNAP_TARGET_NONE;
snap_target[1] = SNAP_TARGET_NONE;

Expand Down Expand Up @@ -535,7 +535,7 @@ void CanvasItemEditor::_keying_changed() {
}
}

Rect2 CanvasItemEditor::_get_encompassing_rect_from_list(List<CanvasItem *> p_list) {
Rect2 CanvasItemEditor::_get_encompassing_rect_from_list(const List<CanvasItem *> &p_list) {
ERR_FAIL_COND_V(p_list.is_empty(), Rect2());

// Handles the first element
Expand Down Expand Up @@ -830,7 +830,7 @@ Vector2 CanvasItemEditor::_position_to_anchor(const Control *p_control, Vector2
return output;
}

void CanvasItemEditor::_save_canvas_item_state(List<CanvasItem *> p_canvas_items, bool save_bones) {
void CanvasItemEditor::_save_canvas_item_state(const List<CanvasItem *> &p_canvas_items, bool save_bones) {
original_transform = Transform2D();
bool transform_stored = false;

Expand All @@ -853,14 +853,14 @@ void CanvasItemEditor::_save_canvas_item_state(List<CanvasItem *> p_canvas_items
}
}

void CanvasItemEditor::_restore_canvas_item_state(List<CanvasItem *> p_canvas_items, bool restore_bones) {
void CanvasItemEditor::_restore_canvas_item_state(const List<CanvasItem *> &p_canvas_items, bool restore_bones) {
for (CanvasItem *ci : drag_selection) {
CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(ci);
ci->_edit_set_state(se->undo_state);
}
}

void CanvasItemEditor::_commit_canvas_item_state(List<CanvasItem *> p_canvas_items, String action_name, bool commit_bones) {
void CanvasItemEditor::_commit_canvas_item_state(const List<CanvasItem *> &p_canvas_items, String action_name, bool commit_bones) {
List<CanvasItem *> modified_canvas_items;
for (CanvasItem *ci : p_canvas_items) {
Dictionary old_state = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(ci)->undo_state;
Expand Down
Loading

0 comments on commit 96a95cb

Please sign in to comment.