openMSX
Public Member Functions | Static Public Attributes | List of all members
openmsx::KeyMatrixPosition Class Referencefinal

A position (row, column) in a keyboard matrix. More...

#include <UnicodeKeymap.hh>

Public Member Functions

 KeyMatrixPosition ()=default
 Creates an invalid key matrix position, which can be used when a key does not exist on a particular keyboard. More...
 
 KeyMatrixPosition (byte rowCol_)
 Creates a key matrix position from a byte: the row is stored in the high nibble, the column is stored in the low nibble. More...
 
 KeyMatrixPosition (unsigned row, unsigned col)
 Creates a key matrix position with a given row and column. More...
 
bool isValid () const
 Returns true iff this position is valid. More...
 
unsigned getRow () const
 Returns the matrix row. More...
 
unsigned getColumn () const
 Returns the matrix column. More...
 
byte getRowCol () const
 Returns the matrix row and column combined in a single byte: the column is stored in the lower 3 bits, the row is stored in the higher bits. More...
 
unsigned getMask () const
 Returns a mask with the bit corresponding to this position's column set, all other bits clear. More...
 
bool operator== (const KeyMatrixPosition &other) const
 

Static Public Attributes

static constexpr unsigned NUM_ROWS = 16
 Rows are in the range [0..NUM_ROWS). More...
 
static constexpr unsigned NUM_COLS = 8
 Columns are in the range [0..NUM_COLS). More...
 
static constexpr unsigned NUM_ROWCOL = 1 << 7
 Combined row and column values are in the range [0..NUM_ROWCOL). More...
 

Detailed Description

A position (row, column) in a keyboard matrix.

Definition at line 14 of file UnicodeKeymap.hh.

Constructor & Destructor Documentation

◆ KeyMatrixPosition() [1/3]

openmsx::KeyMatrixPosition::KeyMatrixPosition ( )
default

Creates an invalid key matrix position, which can be used when a key does not exist on a particular keyboard.

◆ KeyMatrixPosition() [2/3]

openmsx::KeyMatrixPosition::KeyMatrixPosition ( byte  rowCol_)
inline

Creates a key matrix position from a byte: the row is stored in the high nibble, the column is stored in the low nibble.

Definition at line 33 of file UnicodeKeymap.hh.

◆ KeyMatrixPosition() [3/3]

openmsx::KeyMatrixPosition::KeyMatrixPosition ( unsigned  row,
unsigned  col 
)
inline

Creates a key matrix position with a given row and column.

Definition at line 40 of file UnicodeKeymap.hh.

References isValid().

Member Function Documentation

◆ getColumn()

unsigned openmsx::KeyMatrixPosition::getColumn ( ) const
inline

Returns the matrix column.

Must only be called on valid positions.

Definition at line 65 of file UnicodeKeymap.hh.

References isValid().

Referenced by getMask().

◆ getMask()

unsigned openmsx::KeyMatrixPosition::getMask ( ) const
inline

Returns a mask with the bit corresponding to this position's column set, all other bits clear.

Must only be called on valid positions.

Definition at line 83 of file UnicodeKeymap.hh.

References getColumn(), and isValid().

Referenced by openmsx::Keyboard::transferHostKeyMatrix().

◆ getRow()

unsigned openmsx::KeyMatrixPosition::getRow ( ) const
inline

Returns the matrix row.

Must only be called on valid positions.

Definition at line 57 of file UnicodeKeymap.hh.

References isValid().

Referenced by openmsx::Keyboard::transferHostKeyMatrix().

◆ getRowCol()

byte openmsx::KeyMatrixPosition::getRowCol ( ) const
inline

Returns the matrix row and column combined in a single byte: the column is stored in the lower 3 bits, the row is stored in the higher bits.

Must only be called on valid positions.

Definition at line 74 of file UnicodeKeymap.hh.

References isValid().

Referenced by openmsx::UnicodeKeymap::getRelevantMods().

◆ isValid()

bool openmsx::KeyMatrixPosition::isValid ( ) const
inline

Returns true iff this position is valid.

Definition at line 50 of file UnicodeKeymap.hh.

Referenced by getColumn(), getMask(), getRow(), getRowCol(), KeyMatrixPosition(), and openmsx::Keyboard::transferHostKeyMatrix().

◆ operator==()

bool openmsx::KeyMatrixPosition::operator== ( const KeyMatrixPosition other) const
inline

Definition at line 88 of file UnicodeKeymap.hh.

Member Data Documentation

◆ NUM_COLS

constexpr unsigned openmsx::KeyMatrixPosition::NUM_COLS = 8
static

Columns are in the range [0..NUM_COLS).

Definition at line 21 of file UnicodeKeymap.hh.

Referenced by openmsx::UnicodeKeymap::getDeadkey().

◆ NUM_ROWCOL

constexpr unsigned openmsx::KeyMatrixPosition::NUM_ROWCOL = 1 << 7
static

Combined row and column values are in the range [0..NUM_ROWCOL).

Definition at line 23 of file UnicodeKeymap.hh.

Referenced by openmsx::UnicodeKeymap::getRelevantMods().

◆ NUM_ROWS

constexpr unsigned openmsx::KeyMatrixPosition::NUM_ROWS = 16
static

Rows are in the range [0..NUM_ROWS).

Definition at line 19 of file UnicodeKeymap.hh.

Referenced by openmsx::UnicodeKeymap::getDeadkey(), openmsx::Keyboard::getKeys(), and openmsx::Keyboard::transferHostKeyMatrix().


The documentation for this class was generated from the following file: