LibreOffice Module framework (master) 1
Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
framework::AcceleratorCache Class Reference

implements a cache for any accelerator configuration. More...

#include <acceleratorcache.hxx>

Public Types

typedef ::std::vector< css::awt::KeyEvent > TKeyList
 commands -> keys More...
 

Public Member Functions

bool hasKey (const css::awt::KeyEvent &aKey) const
 checks if the specified key exists. More...
 
bool hasCommand (const OUString &sCommand) const
 
TKeyList getAllKeys () const
 
void setKeyCommandPair (const css::awt::KeyEvent &aKey, const OUString &sCommand)
 add a new or change an existing key-command pair of this container. More...
 
TKeyList getKeysByCommand (const OUString &sCommand) const
 returns the list of keys, which are registered for this command. More...
 
OUString getCommandByKey (const css::awt::KeyEvent &aKey) const
 
void removeKey (const css::awt::KeyEvent &aKey)
 
void removeCommand (const OUString &sCommand)
 

Private Types

typedef std::unordered_map< OUString, TKeyListTCommand2Keys
 
typedef std::unordered_map< css::awt::KeyEvent, OUString, KeyEventHashCode, KeyEventEqualsFuncTKey2Commands
 keys -> commands More...
 

Private Attributes

TCommand2Keys m_lCommand2Keys
 map commands to keys in relation 1:n. More...
 
TKey2Commands m_lKey2Commands
 map keys to commands in relation 1:1. More...
 

Detailed Description

implements a cache for any accelerator configuration.

@descr It's implemented threadsafe, supports copy-on-write pattern and a flush mechanism to support concurrent access to the same configuration.

copy-on-write ... How? Do the following:

Definition at line 43 of file acceleratorcache.hxx.

Member Typedef Documentation

◆ TCommand2Keys

typedef std::unordered_map<OUString, TKeyList> framework::AcceleratorCache::TCommand2Keys
private

Definition at line 54 of file acceleratorcache.hxx.

◆ TKey2Commands

typedef std::unordered_map< css::awt::KeyEvent , OUString , KeyEventHashCode , KeyEventEqualsFunc > framework::AcceleratorCache::TKey2Commands
private

keys -> commands

Definition at line 62 of file acceleratorcache.hxx.

◆ TKeyList

typedef ::std::vector< css::awt::KeyEvent > framework::AcceleratorCache::TKeyList

commands -> keys

Definition at line 50 of file acceleratorcache.hxx.

Member Function Documentation

◆ getAllKeys()

AcceleratorCache::TKeyList framework::AcceleratorCache::getAllKeys ( ) const

◆ getCommandByKey()

OUString framework::AcceleratorCache::getCommandByKey ( const css::awt::KeyEvent &  aKey) const

◆ getKeysByCommand()

AcceleratorCache::TKeyList framework::AcceleratorCache::getKeysByCommand ( const OUString &  sCommand) const

◆ hasCommand()

bool framework::AcceleratorCache::hasCommand ( const OUString &  sCommand) const

◆ hasKey()

bool framework::AcceleratorCache::hasKey ( const css::awt::KeyEvent &  aKey) const

◆ removeCommand()

void framework::AcceleratorCache::removeCommand ( const OUString &  sCommand)

◆ removeKey()

void framework::AcceleratorCache::removeKey ( const css::awt::KeyEvent &  aKey)

◆ setKeyCommandPair()

void framework::AcceleratorCache::setKeyCommandPair ( const css::awt::KeyEvent &  aKey,
const OUString &  sCommand 
)

Member Data Documentation

◆ m_lCommand2Keys

TCommand2Keys framework::AcceleratorCache::m_lCommand2Keys
private

map commands to keys in relation 1:n.

First key is interpreted as preferred one!

Definition at line 66 of file acceleratorcache.hxx.

Referenced by getKeysByCommand(), hasCommand(), removeKey(), and setKeyCommandPair().

◆ m_lKey2Commands

TKey2Commands framework::AcceleratorCache::m_lKey2Commands
private

map keys to commands in relation 1:1.

Definition at line 69 of file acceleratorcache.hxx.

Referenced by getAllKeys(), getCommandByKey(), hasKey(), removeKey(), and setKeyCommandPair().


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