Skip to content

Commit

Permalink
removed const ref on primative types
Browse files Browse the repository at this point in the history
  • Loading branch information
Lavius Motileng committed Feb 11, 2020
1 parent eca45e6 commit 176afbd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
24 changes: 12 additions & 12 deletions src/common/settings_objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace PowerToysSettings {
m_json.SetNamedValue(L"properties", json::JsonObject{});
}

void Settings::set_description(const UINT &resource_id) {
void Settings::set_description( UINT resource_id) {
m_json.SetNamedValue(L"description", json::value(get_resource(resource_id)));
}

Expand All @@ -32,7 +32,7 @@ namespace PowerToysSettings {
}

// add_bool_toogle overloads.
void Settings::add_bool_toogle(const std::wstring_view &name, const UINT &description_resource_id, const bool &value) {
void Settings::add_bool_toogle(const std::wstring_view &name, UINT description_resource_id, const bool &value) {
add_bool_toogle(name, get_resource(description_resource_id), value);
}

Expand All @@ -47,7 +47,7 @@ namespace PowerToysSettings {
}

// add_int_spinner overloads.
void Settings::add_int_spinner(const const std::wstring_view &name, const UINT &description_resource_id,const int &value,const int &min, const int &max, const int &step) {
void Settings::add_int_spinner(const const std::wstring_view &name, UINT description_resource_id,const int &value,const int &min, const int &max, const int &step) {
add_int_spinner(name, get_resource(description_resource_id), value, min, max, step);
}

Expand All @@ -65,7 +65,7 @@ namespace PowerToysSettings {
}

// add_string overloads.
void Settings::add_string(const std::wstring_view &name,const UINT &description_resource_id, const std::wstring_view &value) {
void Settings::add_string(const std::wstring_view &name, UINT description_resource_id, const std::wstring_view &value) {
add_string(name, get_resource(description_resource_id), value);
}

Expand All @@ -80,7 +80,7 @@ namespace PowerToysSettings {
}

// add_multiline_string overloads.
void Settings::add_multiline_string(const std::wstring_view &name,const UINT &description_resource_id,const std::wstring_view &value) {
void Settings::add_multiline_string(const std::wstring_view &name, UINT description_resource_id,const std::wstring_view &value) {
add_multiline_string(name, get_resource(description_resource_id), value);
}

Expand All @@ -106,7 +106,7 @@ namespace PowerToysSettings {
}

// add_color_picker overloads.
void Settings::add_color_picker(const std::wstring_view &name,const UINT &description_resource_id,const std::wstring_view &value) {
void Settings::add_color_picker(const std::wstring_view &name, UINT description_resource_id,const std::wstring_view &value) {
add_color_picker(name, get_resource(description_resource_id), value);
}

Expand All @@ -120,7 +120,7 @@ namespace PowerToysSettings {
m_json.GetNamedObject(L"properties").SetNamedValue(name, picker);
}

void Settings::add_hotkey(const std::wstring_view &name,const UINT &description_resource_id, const HotkeyObject& hotkey) {
void Settings::add_hotkey(const std::wstring_view &name, UINT description_resource_id, const HotkeyObject& hotkey) {
add_hotkey(name, get_resource(description_resource_id), hotkey);
}

Expand All @@ -134,7 +134,7 @@ namespace PowerToysSettings {
m_json.GetNamedObject(L"properties").SetNamedValue(name, hotkey);
}

void Settings::add_choice_group(const std::wstring_view &name, const UINT &description_resource_id,const std::wstring_view &value, const std::vector<std::pair<std::wstring, UINT>>& keys_and_text_ids) {
void Settings::add_choice_group(const std::wstring_view &name, UINT description_resource_id,const std::wstring_view &value, const std::vector<std::pair<std::wstring, UINT>>& keys_and_text_ids) {
std::vector<std::pair<std::wstring, std::wstring>> keys_and_texts;
keys_and_texts.reserve(keys_and_text_ids.size());
for (const auto& kv : keys_and_text_ids) {
Expand All @@ -161,7 +161,7 @@ namespace PowerToysSettings {
m_json.GetNamedObject(L"properties").SetNamedValue(name, choice_group);
}

void Settings::add_dropdown(const std::wstring_view &name,const UINT &description_resource_id,const std::wstring_view &value, const std::vector<std::pair<std::wstring, UINT>>& keys_and_text_ids) {
void Settings::add_dropdown(const std::wstring_view &name, UINT description_resource_id,const std::wstring_view &value, const std::vector<std::pair<std::wstring, UINT>>& keys_and_text_ids) {
std::vector<std::pair<std::wstring, std::wstring>> keys_and_texts;
keys_and_texts.reserve(keys_and_text_ids.size());
for (const auto& kv : keys_and_text_ids) {
Expand Down Expand Up @@ -189,11 +189,11 @@ namespace PowerToysSettings {
}

// add_custom_action overloads.
void Settings::add_custom_action(const std::wstring_view &name,const UINT &description_resource_id,const UINT &button_text_resource_id,const UINT &ext_description_resource_id) {
void Settings::add_custom_action(const std::wstring_view &name, UINT description_resource_id, UINT button_text_resource_id, UINT ext_description_resource_id) {
add_custom_action(name, get_resource(description_resource_id), get_resource(button_text_resource_id), get_resource(ext_description_resource_id));
}

void Settings::add_custom_action(const std::wstring_view &name,const UINT &description_resource_id,const UINT &button_text_resource_id,const std::wstring_view &value) {
void Settings::add_custom_action(const std::wstring_view &name, UINT description_resource_id, UINT button_text_resource_id,const std::wstring_view &value) {
add_custom_action(name, get_resource(description_resource_id), get_resource(button_text_resource_id), value);
}

Expand Down Expand Up @@ -227,7 +227,7 @@ namespace PowerToysSettings {
}

// Resource helper.
std::wstring Settings::get_resource(const UINT &resource_id) const{
std::wstring Settings::get_resource( UINT resource_id) const{
if (resource_id != 0) {
wchar_t* res_ptr;
const size_t resource_length = LoadStringW(m_instance, resource_id, reinterpret_cast<wchar_t *>(&res_ptr), 0);
Expand Down
24 changes: 12 additions & 12 deletions src/common/settings_objects.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,40 @@ namespace PowerToysSettings {
);

// Add additional general information to the PowerToy settings.
void set_description(const UINT &resource_id);
void set_description(UINT resource_id);
void set_description(const std::wstring_view &description);

void set_icon_key(const std::wstring_view &icon_key);
void set_overview_link(const std::wstring_view &overview_link);
void set_video_link(const std::wstring_view &video_link);

// Add properties to the PowerToy settings.
void add_bool_toogle(const std::wstring_view &name, const UINT &description_resource_id,const bool &value);
void add_bool_toogle(const std::wstring_view &name, UINT description_resource_id,const bool &value);
void add_bool_toogle(const std::wstring_view &name, const std::wstring_view &description,const bool &value);

void add_int_spinner(const std::wstring_view &name, const UINT &description_resource_id,const int &value,const int &min,const int &max, const int &step);
void add_int_spinner(const std::wstring_view &name, UINT description_resource_id,const int &value,const int &min,const int &max, const int &step);
void add_int_spinner(const std::wstring_view &name, const std::wstring_view &description,const int &value,const int &min,const int &max, const int &step);

void add_string(const std::wstring_view &name,const UINT &description_resource_id,const std::wstring_view &value);
void add_string(const std::wstring_view &name, UINT description_resource_id,const std::wstring_view &value);
void add_string(const std::wstring_view &name, const std::wstring_view &description,const std::wstring_view &value);

void add_multiline_string(const std::wstring_view &name, const UINT &description_resource_id,const std::wstring_view &value);
void add_multiline_string(const std::wstring_view &name, UINT description_resource_id,const std::wstring_view &value);
void add_multiline_string(const std::wstring_view &name,const std::wstring_view &description,const std::wstring_view &value);

void add_color_picker(const std::wstring_view &name,const UINT &description_resource_id,const std::wstring_view &value);
void add_color_picker(const std::wstring_view &name, UINT description_resource_id,const std::wstring_view &value);
void add_color_picker(const std::wstring_view &name,const std::wstring_view &description,const std::wstring_view &value);

void add_hotkey(const std::wstring_view &name,const UINT &description_resource_id, const HotkeyObject& hotkey);
void add_hotkey(const std::wstring_view &name, UINT description_resource_id, const HotkeyObject& hotkey);
void add_hotkey(const std::wstring_view &name,const std::wstring_view &description, const HotkeyObject& hotkey);

void add_choice_group(const std::wstring_view &name,const UINT &description_resource_id,const std::wstring_view &value, const std::vector<std::pair<std::wstring, UINT>>& keys_and_text_ids);
void add_choice_group(const std::wstring_view &name, UINT description_resource_id,const std::wstring_view &value, const std::vector<std::pair<std::wstring, UINT>>& keys_and_text_ids);
void add_choice_group(const std::wstring_view &name,const std::wstring_view &description,const std::wstring_view &value, const std::vector<std::pair<std::wstring, std::wstring>>& keys_and_texts);

void add_dropdown(const std::wstring_view &name,const UINT &description_resource_id,const std::wstring_view &value, const std::vector<std::pair<std::wstring, UINT>>& keys_and_text_ids);
void add_dropdown(const std::wstring_view &name, UINT description_resource_id,const std::wstring_view &value, const std::vector<std::pair<std::wstring, UINT>>& keys_and_text_ids);
void add_dropdown(const std::wstring_view &name,const std::wstring_view &description,const std::wstring_view &value, const std::vector<std::pair<std::wstring, std::wstring>>& keys_and_texts);

void add_custom_action(const std::wstring_view &name,const UINT &description_resource_id,const UINT &button_text_resource_id,const UINT &ext_description_resource_id);
void add_custom_action(const std::wstring_view &name,const UINT &description_resource_id,const UINT &button_text_resource_id,const std::wstring_view &value);
void add_custom_action(const std::wstring_view &name,UINT description_resource_id, UINT button_text_resource_id, UINT ext_description_resource_id);
void add_custom_action(const std::wstring_view &name, UINT description_resource_id, UINT button_text_resource_id,const std::wstring_view &value);
void add_custom_action(const std::wstring_view &name,const std::wstring_view &description,const std::wstring_view &button_text,const std::wstring_view &value);

void add_header_szLarge(const std::wstring_view &name,const std::wstring_view &description,const std::wstring_view &value);
Expand All @@ -61,7 +61,7 @@ namespace PowerToysSettings {
int m_curr_priority = 0; // For keeping order when adding elements.
HINSTANCE m_instance;

std::wstring get_resource(const UINT &resource_id) const;
std::wstring get_resource( UINT resource_id) const;
};

class PowerToyValues {
Expand Down

0 comments on commit 176afbd

Please sign in to comment.