GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
KeyboardTranslator::Entry Class Reference

Represents an association between a key sequence pressed by the user and the character sequence and commands associated with it for a particular KeyboardTranslator. More...

#include "KeyboardTranslator.h"

Collaboration diagram for KeyboardTranslator::Entry:
Collaboration graph
[legend]

Public Member Functions

 Entry ()
 Constructs a new entry for a keyboard translator.
Command command () const
 Returns the commands associated with this entry.
QString conditionToString () const
 Returns the key code and modifiers associated with this entry as a QKeySequence.
QByteArray escapedText (bool expandWildCards=false, Qt::KeyboardModifiers modifiers=Qt::NoModifier) const
 Returns the character sequence associated with this entry, with any non-printable characters replaced with escape sequences.
bool isNull () const
 Returns true if this entry is null.
int keyCode () const
 Returns the character code ( from the Qt::Key enum ) associated with this entry.
bool matches (int keyCode, Qt::KeyboardModifiers modifiers, States flags) const
 Returns true if this entry matches the given key sequence, specified as a combination of keyCode , modifiers and state.
Qt::KeyboardModifiers modifierMask () const
 Returns the keyboard modifiers which are valid in this entry.
Qt::KeyboardModifiers modifiers () const
 Returns a bitwise-OR of the enabled keyboard modifiers associated with this entry.
bool operator== (const Entry &rhs) const
QString resultToString (bool expandWildCards=false, Qt::KeyboardModifiers modifiers=Qt::NoModifier) const
 Returns this entry's result ( ie.
void setCommand (Command command)
 Sets the command associated with this entry.
void setKeyCode (int keyCode)
 Sets the character code associated with this entry.
void setModifierMask (Qt::KeyboardModifiers modifiers)
 See modifierMask() and modifiers()
void setModifiers (Qt::KeyboardModifiers modifiers)
 See modifiers()
void setState (States state)
 See state()
void setStateMask (States mask)
 See stateMask()
void setText (const QByteArray &text)
 Sets the character sequence associated with this entry.
States state () const
 Returns a bitwise-OR of the enabled state flags associated with this entry.
States stateMask () const
 Returns the state flags which are valid in this entry.
QByteArray text (bool expandWildCards=false, Qt::KeyboardModifiers modifiers=Qt::NoModifier) const
 Returns the character sequence associated with this entry, optionally replacing wildcard '*' characters with numbers to indicate the keyboard modifiers being pressed.

Private Member Functions

void insertModifier (QString &item, int modifier) const
void insertState (QString &item, int state) const
QByteArray unescape (const QByteArray &text) const

Private Attributes

Command _command
int _keyCode
Qt::KeyboardModifiers _modifierMask
Qt::KeyboardModifiers _modifiers
States _state
States _stateMask
QByteArray _text

Detailed Description

Represents an association between a key sequence pressed by the user and the character sequence and commands associated with it for a particular KeyboardTranslator.

Definition at line 193 of file KeyboardTranslator.h.

Constructor & Destructor Documentation

KeyboardTranslator::Entry::Entry ( )

Constructs a new entry for a keyboard translator.

Definition at line 568 of file KeyboardTranslator.cpp.

Member Function Documentation

KeyboardTranslator::Command KeyboardTranslator::Entry::command ( void  ) const
inline

Returns the commands associated with this entry.

Definition at line 605 of file KeyboardTranslator.h.

Referenced by Vt102Emulation::sendKeyEvent(), and KeyboardTranslatorWriter::writeEntry().

QString KeyboardTranslator::Entry::conditionToString ( ) const

Returns the key code and modifiers associated with this entry as a QKeySequence.

Returns this entry's conditions ( ie. its key code, modifier and state criteria ) as a string.

Definition at line 774 of file KeyboardTranslator.cpp.

References KeyboardTranslator::AlternateScreenState, KeyboardTranslator::AnsiState, KeyboardTranslator::AnyModifierState, KeyboardTranslator::CursorKeysState, and KeyboardTranslator::NewLineState.

Referenced by KeyboardTranslatorWriter::writeEntry().

QByteArray KeyboardTranslator::Entry::escapedText ( bool  expandWildCards = false,
Qt::KeyboardModifiers  modifiers = Qt::NoModifier 
) const

Returns the character sequence associated with this entry, with any non-printable characters replaced with escape sequences.

eg. \E for Escape, \t for tab, \n for new line.

Parameters
expandWildCardsSee text()
modifiersSee text()

Definition at line 622 of file KeyboardTranslator.cpp.

void KeyboardTranslator::Entry::insertModifier ( QString &  item,
int  modifier 
) const
private

Definition at line 713 of file KeyboardTranslator.cpp.

void KeyboardTranslator::Entry::insertState ( QString &  item,
int  state 
) const
private
bool KeyboardTranslator::Entry::isNull ( ) const
inline

Returns true if this entry is null.

This is true for newly constructed entries which have no properties set.

Definition at line 596 of file KeyboardTranslator.h.

Referenced by KeyboardTranslator::replaceEntry().

int KeyboardTranslator::Entry::keyCode ( ) const
inline

Returns the character code ( from the Qt::Key enum ) associated with this entry.

Definition at line 581 of file KeyboardTranslator.h.

References _keyCode.

Referenced by KeyboardTranslator::addEntry(), KeyboardTranslator::removeEntry(), and KeyboardTranslator::replaceEntry().

bool KeyboardTranslator::Entry::matches ( int  keyCode,
Qt::KeyboardModifiers  modifiers,
States  flags 
) const

Returns true if this entry matches the given key sequence, specified as a combination of keyCode , modifiers and state.

Definition at line 589 of file KeyboardTranslator.cpp.

References KeyboardTranslator::AnyModifierState.

Referenced by KeyboardTranslator::findEntry().

Qt::KeyboardModifiers KeyboardTranslator::Entry::modifierMask ( ) const
inline

Returns the keyboard modifiers which are valid in this entry.

See modifiers()

Definition at line 594 of file KeyboardTranslator.h.

Referenced by Vt102Emulation::sendKeyEvent().

Qt::KeyboardModifiers KeyboardTranslator::Entry::modifiers ( ) const
inline

Returns a bitwise-OR of the enabled keyboard modifiers associated with this entry.

If a modifier is set in modifierMask() but not in modifiers(), this means that the entry only matches when that modifier is NOT pressed.

If a modifier is not set in modifierMask() then the entry matches whether the modifier is pressed or not.

Definition at line 588 of file KeyboardTranslator.h.

Referenced by Vt102Emulation::sendKeyEvent().

bool KeyboardTranslator::Entry::operator== ( const Entry rhs) const

Definition at line 578 of file KeyboardTranslator.cpp.

References _command, _keyCode, _modifierMask, _modifiers, _state, _stateMask, and _text.

QString KeyboardTranslator::Entry::resultToString ( bool  expandWildCards = false,
Qt::KeyboardModifiers  modifiers = Qt::NoModifier 
) const
void KeyboardTranslator::Entry::setCommand ( Command  command)
inline

Sets the command associated with this entry.

Definition at line 601 of file KeyboardTranslator.h.

Referenced by KeyboardTranslatorReader::readNext().

void KeyboardTranslator::Entry::setKeyCode ( int  keyCode)
inline

Sets the character code associated with this entry.

Definition at line 582 of file KeyboardTranslator.h.

Referenced by KeyboardTranslatorReader::readNext().

void KeyboardTranslator::Entry::setModifierMask ( Qt::KeyboardModifiers  modifiers)
inline

See modifierMask() and modifiers()

Definition at line 590 of file KeyboardTranslator.h.

Referenced by KeyboardTranslatorReader::readNext().

void KeyboardTranslator::Entry::setModifiers ( Qt::KeyboardModifiers  modifiers)
inline

See modifiers()

Definition at line 584 of file KeyboardTranslator.h.

Referenced by KeyboardTranslatorReader::readNext().

void KeyboardTranslator::Entry::setState ( States  state)
inline

See state()

Definition at line 636 of file KeyboardTranslator.h.

References state.

Referenced by KeyboardTranslatorReader::readNext().

void KeyboardTranslator::Entry::setStateMask ( States  mask)
inline

See stateMask()

Definition at line 642 of file KeyboardTranslator.h.

Referenced by KeyboardTranslatorReader::readNext().

void KeyboardTranslator::Entry::setText ( const QByteArray &  text)
inline

Sets the character sequence associated with this entry.

Definition at line 607 of file KeyboardTranslator.h.

Referenced by KeyboardTranslatorReader::readNext().

KeyboardTranslator::States KeyboardTranslator::Entry::state ( void  ) const
inline

Returns a bitwise-OR of the enabled state flags associated with this entry.

If flag is set in stateMask() but not in state(), this means that the entry only matches when the terminal is NOT in that state.

If a state is not set in stateMask() then the entry matches whether the terminal is in that state or not.

Definition at line 640 of file KeyboardTranslator.h.

Referenced by Vt102Emulation::sendKeyEvent().

KeyboardTranslator::States KeyboardTranslator::Entry::stateMask ( ) const
inline

Returns the state flags which are valid in this entry.

See state()

Definition at line 646 of file KeyboardTranslator.h.

Referenced by Vt102Emulation::sendKeyEvent().

QByteArray KeyboardTranslator::Entry::text ( bool  expandWildCards = false,
Qt::KeyboardModifiers  modifiers = Qt::NoModifier 
) const
inline

Returns the character sequence associated with this entry, optionally replacing wildcard '*' characters with numbers to indicate the keyboard modifiers being pressed.

TODO: The numbers used to replace '*' characters are taken from the Konsole/KDE 3 code. Document them.

Parameters
expandWildCardsSpecifies whether wild cards (occurrences of the '*' character) in the entry should be replaced with a number to indicate the modifier keys being pressed.
modifiersThe keyboard modifiers being pressed.

Definition at line 615 of file KeyboardTranslator.h.

References oneOrZero().

Referenced by Vt102Emulation::getErase(), and Vt102Emulation::sendKeyEvent().

QByteArray KeyboardTranslator::Entry::unescape ( const QByteArray &  text) const
private

Definition at line 659 of file KeyboardTranslator.cpp.

Member Data Documentation

Command KeyboardTranslator::Entry::_command
private

Definition at line 326 of file KeyboardTranslator.h.

Referenced by operator==().

int KeyboardTranslator::Entry::_keyCode
private

Definition at line 320 of file KeyboardTranslator.h.

Referenced by keyCode(), and operator==().

Qt::KeyboardModifiers KeyboardTranslator::Entry::_modifierMask
private

Definition at line 322 of file KeyboardTranslator.h.

Referenced by operator==().

Qt::KeyboardModifiers KeyboardTranslator::Entry::_modifiers
private

Definition at line 321 of file KeyboardTranslator.h.

Referenced by operator==().

States KeyboardTranslator::Entry::_state
private

Definition at line 323 of file KeyboardTranslator.h.

Referenced by operator==().

States KeyboardTranslator::Entry::_stateMask
private

Definition at line 324 of file KeyboardTranslator.h.

Referenced by operator==().

QByteArray KeyboardTranslator::Entry::_text
private

Definition at line 327 of file KeyboardTranslator.h.

Referenced by operator==().


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