MayaFlux 0.3.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ from_char()

MAYAFLUX_API std::optional< Keys > MayaFlux::IO::from_char ( char  c)
noexcept

Converts a character to the corresponding Keys enum value.

Parameters
cThe character to convert.
Returns
An optional Keys value if the character matches a key, std::nullopt otherwise.

Definition at line 22 of file Keys.cpp.

23{
24 for (const auto& [ch, key] : char_to_keys) {
25 if (ch == c)
26 return key;
27 }
28
29 if (c >= '0' && c <= '9') {
30 return static_cast<Keys>(static_cast<int>(c));
31 }
32 if (c >= 'A' && c <= 'Z') {
33 return static_cast<Keys>(static_cast<int>(c));
34 }
35 if (c >= 'a' && c <= 'z') {
36 return static_cast<Keys>(static_cast<int>(c) - 32);
37 }
38
39 return std::nullopt;
40}

Referenced by from_string().

+ Here is the caller graph for this function: