35 keyboard_virtual_key virtual_key;
38 constexpr keyboard_key() noexcept : modifiers(keyboard_modifiers::none), virtual_key(keyboard_virtual_key::nul) {}
41 modifiers(modifiers), virtual_key(key)
45 keyboard_key(std::string_view key_combination) : modifiers(keyboard_modifiers::none), virtual_key(keyboard_virtual_key::nul)
47 auto const modifiers_and_vkey = split(key_combination,
'+');
48 hi_assert(modifiers_and_vkey.cbegin() != modifiers_and_vkey.cend());
50 auto const end_modifiers = modifiers_and_vkey.cend() - 1;
51 for (
auto i = modifiers_and_vkey.cbegin(); i != end_modifiers; ++i) {
55 virtual_key = to_keyboard_virtual_key(modifiers_and_vkey.back());
60 return hash_mix(modifiers, virtual_key);
65 return lhs.modifiers == rhs.modifiers && lhs.virtual_key == rhs.virtual_key;
70 return std::format(
"{}{}", rhs.modifiers, rhs.virtual_key);
75 return lhs << to_string(rhs);
keyboard_modifiers to_keyboard_modifiers(std::string_view s)
Parse a key-binding modifier name.
Definition keyboard_modifiers.hpp:60