use StringView for parse_keys
This commit is contained in:
parent
b2123547df
commit
055eacd032
|
@ -36,7 +36,7 @@ static const KeyAndName keynamemap[] = {
|
||||||
{ "backtab", Key::BackTab },
|
{ "backtab", Key::BackTab },
|
||||||
};
|
};
|
||||||
|
|
||||||
KeyList parse_keys(const String& str)
|
KeyList parse_keys(StringView str)
|
||||||
{
|
{
|
||||||
KeyList result;
|
KeyList result;
|
||||||
for (ByteCount pos = 0; pos < str.length(); ++pos)
|
for (ByteCount pos = 0; pos < str.length(); ++pos)
|
||||||
|
@ -51,7 +51,7 @@ KeyList parse_keys(const String& str)
|
||||||
{
|
{
|
||||||
Key::Modifiers modifier = Key::Modifiers::None;
|
Key::Modifiers modifier = Key::Modifiers::None;
|
||||||
|
|
||||||
String keyname = str.substr(pos+1, end_pos - pos - 1);
|
auto keyname = str.substr(pos+1, end_pos - pos - 1);
|
||||||
if (keyname.length() > 2)
|
if (keyname.length() > 2)
|
||||||
{
|
{
|
||||||
if (tolower(keyname[0]) == 'c' and keyname[1] == '-')
|
if (tolower(keyname[0]) == 'c' and keyname[1] == '-')
|
||||||
|
|
|
@ -66,7 +66,7 @@ struct Key
|
||||||
|
|
||||||
using KeyList = std::vector<Key>;
|
using KeyList = std::vector<Key>;
|
||||||
|
|
||||||
KeyList parse_keys(const String& str);
|
KeyList parse_keys(StringView str);
|
||||||
String key_to_str(Key key);
|
String key_to_str(Key key);
|
||||||
|
|
||||||
constexpr Key alt(Codepoint key) { return { Key::Modifiers::Alt, key }; }
|
constexpr Key alt(Codepoint key) { return { Key::Modifiers::Alt, key }; }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user