MCPcopy Create free account
hub / github.com/Bananymous/banan-os / parse_keycode

Function parse_keycode

userspace/libraries/LibInput/KeyboardLayout.cpp:94–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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();

Callers 1

load_from_fileMethod · 0.85

Calls 2

isdigitFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected