Added a few const qualifiers.

This commit is contained in:
Relintai 2020-04-19 17:50:19 +02:00
parent db04b24273
commit 5e2e58a07c
4 changed files with 25 additions and 25 deletions

View File

@ -37,37 +37,37 @@ void ActionBarEntry::set_owner(ActionBarProfile *owner) {
_owner = owner; _owner = owner;
} }
float ActionBarEntry::get_size() { float ActionBarEntry::get_size() const {
return _size; return _size;
} }
void ActionBarEntry::set_size(float value) { void ActionBarEntry::set_size(const float value) {
_size = value; _size = value;
emit_change(); emit_change();
} }
int ActionBarEntry::get_action_bar_id() { int ActionBarEntry::get_action_bar_id() const {
return _action_bar_id; 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; _action_bar_id = value;
emit_change(); emit_change();
} }
int ActionBarEntry::get_slot_num() { int ActionBarEntry::get_slot_num() const {
return _slot_num; return _slot_num;
} }
void ActionBarEntry::set_slot_num(int value) { void ActionBarEntry::set_slot_num(const int value) {
_slot_num = value; _slot_num = value;
emit_change(); emit_change();
} }
int ActionBarEntry::get_action_bar_entry_count() { int ActionBarEntry::get_action_bar_entry_count() const {
return _button_entries.size(); return _button_entries.size();
} }
@ -78,7 +78,7 @@ void ActionBarEntry::emit_change() {
_owner->emit_change(); _owner->emit_change();
} }
Ref<ActionBarButtonEntry> ActionBarEntry::get_button_for_slotid(int slotId) { Ref<ActionBarButtonEntry> ActionBarEntry::get_button_for_slotid(const int slotId) {
for (int i = 0; i < _button_entries.size(); ++i) { for (int i = 0; i < _button_entries.size(); ++i) {
if (_button_entries.get(i)->get_slot_id() == slotId) { if (_button_entries.get(i)->get_slot_id() == slotId) {
return _button_entries.get(i); return _button_entries.get(i);
@ -94,7 +94,7 @@ Ref<ActionBarButtonEntry> ActionBarEntry::get_button_for_slotid(int slotId) {
return Ref<ActionBarButtonEntry>(abe); return Ref<ActionBarButtonEntry>(abe);
} }
Ref<ActionBarButtonEntry> ActionBarEntry::get_button(int index) { Ref<ActionBarButtonEntry> ActionBarEntry::get_button(const int index) {
ERR_FAIL_INDEX_V(index, _button_entries.size(), Ref<ActionBarButtonEntry>(NULL)); ERR_FAIL_INDEX_V(index, _button_entries.size(), Ref<ActionBarButtonEntry>(NULL));
return _button_entries.get(index); return _button_entries.get(index);

View File

@ -39,21 +39,21 @@ public:
Ref<ActionBarProfile> get_owner(); Ref<ActionBarProfile> get_owner();
void set_owner(ActionBarProfile *owner); void set_owner(ActionBarProfile *owner);
float get_size(); float get_size() const;
void set_size(float value); void set_size(const float value);
int get_action_bar_id(); int get_action_bar_id() const;
void set_action_bar_id(int value); void set_action_bar_id(const int value);
int get_slot_num(); int get_slot_num() const;
void set_slot_num(int value); void set_slot_num(const int value);
int get_action_bar_entry_count(); int get_action_bar_entry_count() const;
void emit_change(); void emit_change();
Ref<ActionBarButtonEntry> get_button_for_slotid(int slotId); Ref<ActionBarButtonEntry> get_button_for_slotid(const int slotId);
Ref<ActionBarButtonEntry> get_button(int index); Ref<ActionBarButtonEntry> get_button(const int index);
Dictionary to_dict() const; Dictionary to_dict() const;
void from_dict(const Dictionary &dict); void from_dict(const Dictionary &dict);

View File

@ -35,7 +35,7 @@ String ActionBarProfile::get_action_bar_profile_name() {
return _name; return _name;
} }
void ActionBarProfile::set_action_bar_profile_name(String value) { void ActionBarProfile::set_action_bar_profile_name(const String &value) {
_name = value; _name = value;
emit_change(); emit_change();
@ -75,7 +75,7 @@ void ActionBarProfile::load_defaults() {
emit_change(); emit_change();
} }
int ActionBarProfile::get_action_bar_count() { int ActionBarProfile::get_action_bar_count() const {
return _action_bars.size(); return _action_bars.size();
} }
@ -94,7 +94,7 @@ Ref<ActionBarEntry> ActionBarProfile::get_action_bar(int index) {
return _action_bars.get(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.get(index)->set_owner(NULL);
_action_bars.remove(index); _action_bars.remove(index);

View File

@ -41,14 +41,14 @@ public:
void set_owner(ClassProfile *owner); void set_owner(ClassProfile *owner);
String get_action_bar_profile_name(); String get_action_bar_profile_name();
void set_action_bar_profile_name(String value); void set_action_bar_profile_name(const String &value);
Vector<Ref<ActionBarEntry> > &get_action_bars(); Vector<Ref<ActionBarEntry> > &get_action_bars();
void load_defaults(); void load_defaults();
int get_action_bar_count(); int get_action_bar_count() const;
void add_action_bar(Ref<ActionBarEntry> actionbar); void add_action_bar(Ref<ActionBarEntry> actionbar);
Ref<ActionBarEntry> get_action_bar(int index); Ref<ActionBarEntry> get_action_bar(const int index);
void remove_action_bar(int index); void remove_action_bar(const int index);
void clear_action_bars(); void clear_action_bars();
Dictionary to_dict() const; Dictionary to_dict() const;