Skip to content

Commit

Permalink
Change generate_help_text_for_file param to const reference
Browse files Browse the repository at this point in the history
For improved style and consistency with the item_processor parameter.
  • Loading branch information
James De Ricco committed Jan 15, 2024
1 parent a068656 commit a0db7f7
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/editor/object_option.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ FileObjectOption::FileObjectOption(const std::string& text, std::string* pointer
const std::string& basedir,
bool path_relative_to_basedir,
unsigned int flags,
std::function<std::string(std::string)> generate_help_text_for_file) :
const std::function<std::string(std::string)>& generate_help_text_for_file) :
ObjectOption(text, key, flags, pointer),
m_default_value(std::move(default_value)),
m_filter(std::move(filter)),
Expand Down
2 changes: 1 addition & 1 deletion src/editor/object_option.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ class FileObjectOption final : public ObjectOption<std::string>
const std::string& basedir,
bool path_relative_to_basedir,
unsigned int flags,
std::function<std::string(std::string)> generate_help_text_for_file = nullptr);
const std::function<std::string(std::string)>& generate_help_text_for_file = nullptr);

virtual void save(Writer& write) const override;
virtual std::string to_string() const override;
Expand Down
2 changes: 1 addition & 1 deletion src/editor/object_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ ObjectSettings::add_file(const std::string& text, std::string* value_ptr,
const std::string& basedir,
bool path_relative_to_basedir,
unsigned int flags,
std::function<std::string(std::string)> generate_help_text_for_file)
const std::function<std::string(std::string)>& generate_help_text_for_file)
{
add_option(std::make_unique<FileObjectOption>(text, value_ptr, default_value, key, filter, basedir, path_relative_to_basedir, flags, generate_help_text_for_file));
}
Expand Down
2 changes: 1 addition & 1 deletion src/editor/object_settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class ObjectSettings final
const std::string& basedir = {},
bool path_relative_to_basedir = true,
unsigned int flags = 0,
std::function<std::string(std::string)> generate_help_text_for_file = nullptr);
const std::function<std::string(std::string)>& generate_help_text_for_file = nullptr);
void add_sexp(const std::string& text, const std::string& key,
sexp::Value& value, unsigned int flags = 0);
void add_string_array(const std::string& text, const std::string& key, std::vector<std::string>& items);
Expand Down
2 changes: 1 addition & 1 deletion src/gui/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ ItemAction&
Menu::add_file(const std::string& text, std::string* input, const std::vector<std::string>& extensions,
const std::string& basedir, bool path_relative_to_basedir,
const std::function<void (MenuItem&)>& item_processor,
const std::function<std::string(std::string)> generate_help_text_for_file, int id)
const std::function<std::string(std::string)>& generate_help_text_for_file, int id)
{
auto item = std::make_unique<ItemAction>(text, id,
[input, extensions, basedir, path_relative_to_basedir, item_processor, generate_help_text_for_file]()
Expand Down
2 changes: 1 addition & 1 deletion src/gui/menu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class Menu
ItemAction& add_file(const std::string& text, std::string* input, const std::vector<std::string>& extensions,
const std::string& basedir, bool path_relative_to_basedir,
const std::function<void (MenuItem&)>& item_processor = {},
const std::function<std::string(std::string)> generate_help_text_for_file = nullptr,
const std::function<std::string(std::string)>& generate_help_text_for_file = nullptr,
int id = -1);

ItemColor& add_color(const std::string& text, Color* color, int id = -1);
Expand Down
2 changes: 1 addition & 1 deletion src/gui/menu_filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ FileSystemMenu::FileSystemMenu(std::string* filename, const std::vector<std::str
const std::string& basedir, bool path_relative_to_basedir,
std::function<void(std::string)> callback,
const std::function<void (MenuItem&)>& item_processor,
std::function<std::string(std::string)> generate_help_text_for_file) :
const std::function<std::string(std::string)>& generate_help_text_for_file) :
m_filename(filename),
// when a basedir is given, 'filename' is relative to basedir, so
// it's useless as a starting point
Expand Down
2 changes: 1 addition & 1 deletion src/gui/menu_filesystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class FileSystemMenu final : public Menu
FileSystemMenu(std::string* filename, const std::vector<std::string>& extensions,
const std::string& basedir, bool path_relative_to_basedir, const std::function<void(std::string)> callback = nullptr,
const std::function<void (MenuItem&)>& item_processor = {},
const std::function<std::string(std::string)> generate_help_text_for_file = nullptr);
const std::function<std::string(std::string)>& generate_help_text_for_file = nullptr);
~FileSystemMenu() override;

void menu_action(MenuItem& item) override;
Expand Down

0 comments on commit a0db7f7

Please sign in to comment.