1 #ifndef UNICODEKEYMAP_HH
2 #define UNICODEKEYMAP_HH
17 static constexpr
unsigned INVALID = 0xFF;
43 : rowCol((row << 3) | col)
52 [[nodiscard]] constexpr
bool isValid()
const {
53 return rowCol != INVALID;
59 [[nodiscard]] constexpr
unsigned getRow()
const {
67 [[nodiscard]] constexpr
unsigned getColumn()
const {
85 [[nodiscard]] constexpr
unsigned getMask()
const {
93 byte rowCol = INVALID;
114 [[nodiscard]] constexpr
bool isValid()
const {
123 [[nodiscard]]
KeyInfo get(
unsigned unicode)
const;
137 if (!msxChars)
throw CommandException(
"Missing MSX-Video-characterset file");
142 static constexpr
unsigned NUM_DEAD_KEYS = 3;
144 void parseUnicodeKeymapfile(std::string_view data);
151 std::vector<Entry> mapdata;
157 KeyInfo deadKeys[NUM_DEAD_KEYS];
159 std::optional<MsxChar2Unicode> msxChars;
A position (row, column) in a keyboard matrix.
constexpr unsigned getRow() const
Returns the matrix row.
constexpr bool isValid() const
Returns true iff this position is valid.
static constexpr unsigned NUM_ROWCOL
Combined row and column values are in the range [0..NUM_ROWCOL).
constexpr KeyMatrixPosition(unsigned row, unsigned col)
Creates a key matrix position with a given row and column.
constexpr unsigned getMask() const
Returns a mask with the bit corresponding to this position's column set, all other bits clear.
constexpr bool operator==(const KeyMatrixPosition &) const =default
constexpr KeyMatrixPosition()=default
Creates an invalid key matrix position, which can be used when a key does not exist on a particular k...
static constexpr unsigned NUM_COLS
Columns are in the range [0..NUM_COLS).
static constexpr unsigned NUM_ROWS
Rows are in the range [0..NUM_ROWS).
constexpr KeyMatrixPosition(byte rowCol_)
Creates a key matrix position from a byte: the row is stored in the high nibble, the column is stored...
constexpr unsigned getColumn() const
Returns the matrix column.
constexpr byte getRowCol() const
Returns the matrix row and column combined in a single byte: the column is stored in the lower 3 bits...
byte getRelevantMods(const KeyInfo &keyInfo) const
Returns a mask in which a bit is set iff the corresponding modifier is relevant for the given key.
KeyInfo get(unsigned unicode) const
UnicodeKeymap(std::string_view keyboardType)
const MsxChar2Unicode & getMsxChars() const
KeyInfo getDeadkey(unsigned n) const
This file implemented 3 utility functions:
UnicodeKeymap::KeyInfo KeyInfo
static constexpr byte CAPS_MASK
constexpr KeyInfo()=default
constexpr bool isValid() const
constexpr KeyInfo(KeyMatrixPosition pos_, byte modmask_)
static constexpr byte CTRL_MASK
static constexpr byte GRAPH_MASK
static constexpr byte CODE_MASK
static constexpr byte SHIFT_MASK