Skip to content

Commit

Permalink
const std::string_view& -> std::string_view
Browse files Browse the repository at this point in the history
  • Loading branch information
y5nw committed Aug 31, 2024
1 parent 775cab0 commit 311c43d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/client/keycode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ static const table_key &lookup_keychar(wchar_t Char)
return table.emplace_back(std::move(new_key));
}

static const table_key &lookup_keyname(const std::string_view &name)
static const table_key &lookup_keyname(std::string_view name)
{
if (name.empty())
return invalid_key;
Expand Down Expand Up @@ -297,7 +297,7 @@ static const table_key &lookup_scancode(const u32 scancode)
return key.index() == 0 ? lookup_keykey(std::get<irr::EKEY_CODE>(key)) : lookup_keychar(std::get<wchar_t>(key));
}

KeyPress::KeyPress(const std::string_view &name)
KeyPress::KeyPress(std::string_view name)
{
if (loadFromScancode(name))
return;
Expand Down Expand Up @@ -337,7 +337,7 @@ wchar_t KeyPress::getKeychar() const
return lookup_scancode(scancode).Char;
}

bool KeyPress::loadFromScancode(const std::string_view &name)
bool KeyPress::loadFromScancode(std::string_view name)
{
if (name.size() < 2 || name[0] != '<')
return false;
Expand Down
4 changes: 2 additions & 2 deletions src/client/keycode.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class KeyPress
public:
KeyPress() {};

KeyPress(const std::string_view &name);
KeyPress(std::string_view name);

KeyPress(const irr::SEvent::SKeyInput &in) :
scancode(in.SystemKeyCode) {};
Expand Down Expand Up @@ -61,7 +61,7 @@ class KeyPress
static const KeyPress &getSpecialKey(const std::string &name);

private:
bool loadFromScancode(const std::string_view &name);
bool loadFromScancode(std::string_view name);

inline std::string formatScancode() const
{
Expand Down

0 comments on commit 311c43d

Please sign in to comment.