Parse function key (F1-F24)
| 343 | |
| 344 | // Parse function key (F1-F24) |
| 345 | std::optional<UINT> ParseFunctionKey(std::wstring_view key) { |
| 346 | if (key.size() < 2 || (key[0] != L'F' && key[0] != L'f')) |
| 347 | return std::nullopt; |
| 348 | |
| 349 | auto num_part = key.substr(1); |
| 350 | if (num_part.empty() || !std::ranges::all_of(num_part, ::iswdigit)) |
| 351 | return std::nullopt; |
| 352 | |
| 353 | int fx = 0; |
| 354 | for (wchar_t c : num_part) { |
| 355 | fx = fx * 10 + (c - L'0'); |
| 356 | } |
| 357 | |
| 358 | if (fx >= 1 && fx <= 24) |
| 359 | return VK_F1 + fx - 1; |
| 360 | return std::nullopt; |
| 361 | } |
| 362 | |
| 363 | // Parse single character key (A-Z, 0-9, symbols) |
| 364 | std::optional<UINT> ParseCharacterKey(std::wstring_view key) { |