| 92 | } |
| 93 | |
| 94 | static BAN::Optional<uint8_t> parse_keycode(BAN::StringView str) |
| 95 | { |
| 96 | if (str.size() > 3) |
| 97 | return {}; |
| 98 | uint16_t keycode = 0; |
| 99 | for (char c : str) |
| 100 | { |
| 101 | if (!isdigit(c)) |
| 102 | return {}; |
| 103 | keycode = (keycode * 10) + (c - '0'); |
| 104 | } |
| 105 | if (keycode > 0xFF) |
| 106 | return {}; |
| 107 | return keycode; |
| 108 | } |
| 109 | |
| 110 | static BAN::HashMap<BAN::StringView, Key, StringViewLowerHash, StringViewLowerComp> s_name_to_key; |
| 111 | static BAN::ErrorOr<void> initialize_name_to_key(); |
no test coverage detected