From 5e2e58a07c8abc51a26296d09a860cba10c59e43 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 19 Apr 2020 17:50:19 +0200 Subject: [PATCH] Added a few const qualifiers. --- profiles/actionbar/action_bar_entry.cpp | 18 +++++++++--------- profiles/actionbar/action_bar_entry.h | 18 +++++++++--------- profiles/actionbar/action_bar_profile.cpp | 6 +++--- profiles/actionbar/action_bar_profile.h | 8 ++++---- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/profiles/actionbar/action_bar_entry.cpp b/profiles/actionbar/action_bar_entry.cpp index 265e38e..da28ed7 100644 --- a/profiles/actionbar/action_bar_entry.cpp +++ b/profiles/actionbar/action_bar_entry.cpp @@ -37,37 +37,37 @@ void ActionBarEntry::set_owner(ActionBarProfile *owner) { _owner = owner; } -float ActionBarEntry::get_size() { +float ActionBarEntry::get_size() const { return _size; } -void ActionBarEntry::set_size(float value) { +void ActionBarEntry::set_size(const float value) { _size = value; emit_change(); } -int ActionBarEntry::get_action_bar_id() { +int ActionBarEntry::get_action_bar_id() const { return _action_bar_id; } -void ActionBarEntry::set_action_bar_id(int value) { +void ActionBarEntry::set_action_bar_id(const int value) { _action_bar_id = value; emit_change(); } -int ActionBarEntry::get_slot_num() { +int ActionBarEntry::get_slot_num() const { return _slot_num; } -void ActionBarEntry::set_slot_num(int value) { +void ActionBarEntry::set_slot_num(const int value) { _slot_num = value; emit_change(); } -int ActionBarEntry::get_action_bar_entry_count() { +int ActionBarEntry::get_action_bar_entry_count() const { return _button_entries.size(); } @@ -78,7 +78,7 @@ void ActionBarEntry::emit_change() { _owner->emit_change(); } -Ref ActionBarEntry::get_button_for_slotid(int slotId) { +Ref ActionBarEntry::get_button_for_slotid(const int slotId) { for (int i = 0; i < _button_entries.size(); ++i) { if (_button_entries.get(i)->get_slot_id() == slotId) { return _button_entries.get(i); @@ -94,7 +94,7 @@ Ref ActionBarEntry::get_button_for_slotid(int slotId) { return Ref(abe); } -Ref ActionBarEntry::get_button(int index) { +Ref ActionBarEntry::get_button(const int index) { ERR_FAIL_INDEX_V(index, _button_entries.size(), Ref(NULL)); return _button_entries.get(index); diff --git a/profiles/actionbar/action_bar_entry.h b/profiles/actionbar/action_bar_entry.h index c831097..731bdee 100644 --- a/profiles/actionbar/action_bar_entry.h +++ b/profiles/actionbar/action_bar_entry.h @@ -39,21 +39,21 @@ public: Ref get_owner(); void set_owner(ActionBarProfile *owner); - float get_size(); - void set_size(float value); + float get_size() const; + void set_size(const float value); - int get_action_bar_id(); - void set_action_bar_id(int value); + int get_action_bar_id() const; + void set_action_bar_id(const int value); - int get_slot_num(); - void set_slot_num(int value); + int get_slot_num() const; + void set_slot_num(const int value); - int get_action_bar_entry_count(); + int get_action_bar_entry_count() const; void emit_change(); - Ref get_button_for_slotid(int slotId); - Ref get_button(int index); + Ref get_button_for_slotid(const int slotId); + Ref get_button(const int index); Dictionary to_dict() const; void from_dict(const Dictionary &dict); diff --git a/profiles/actionbar/action_bar_profile.cpp b/profiles/actionbar/action_bar_profile.cpp index 1d2c93c..56d4c4c 100644 --- a/profiles/actionbar/action_bar_profile.cpp +++ b/profiles/actionbar/action_bar_profile.cpp @@ -35,7 +35,7 @@ String ActionBarProfile::get_action_bar_profile_name() { return _name; } -void ActionBarProfile::set_action_bar_profile_name(String value) { +void ActionBarProfile::set_action_bar_profile_name(const String &value) { _name = value; emit_change(); @@ -75,7 +75,7 @@ void ActionBarProfile::load_defaults() { emit_change(); } -int ActionBarProfile::get_action_bar_count() { +int ActionBarProfile::get_action_bar_count() const { return _action_bars.size(); } @@ -94,7 +94,7 @@ Ref ActionBarProfile::get_action_bar(int index) { return _action_bars.get(index); } -void ActionBarProfile::remove_action_bar(int index) { +void ActionBarProfile::remove_action_bar(const int index) { _action_bars.get(index)->set_owner(NULL); _action_bars.remove(index); diff --git a/profiles/actionbar/action_bar_profile.h b/profiles/actionbar/action_bar_profile.h index 3de1905..b2930f0 100644 --- a/profiles/actionbar/action_bar_profile.h +++ b/profiles/actionbar/action_bar_profile.h @@ -41,14 +41,14 @@ public: void set_owner(ClassProfile *owner); String get_action_bar_profile_name(); - void set_action_bar_profile_name(String value); + void set_action_bar_profile_name(const String &value); Vector > &get_action_bars(); void load_defaults(); - int get_action_bar_count(); + int get_action_bar_count() const; void add_action_bar(Ref actionbar); - Ref get_action_bar(int index); - void remove_action_bar(int index); + Ref get_action_bar(const int index); + void remove_action_bar(const int index); void clear_action_bars(); Dictionary to_dict() const;