chore: KeyMap, use auto where possible
This commit is contained in:
parent
9dedf25ecc
commit
955f9652fb
1 changed files with 6 additions and 6 deletions
|
|
@ -206,7 +206,7 @@ void KeyMap::finish()
|
||||||
m_numGroups = findNumGroups();
|
m_numGroups = findNumGroups();
|
||||||
|
|
||||||
// make sure every key has the same number of groups
|
// make sure every key has the same number of groups
|
||||||
for (KeyIDMap::iterator i = m_keyIDMap.begin(); i != m_keyIDMap.end(); ++i) {
|
for (auto i = m_keyIDMap.begin(); i != m_keyIDMap.end(); ++i) {
|
||||||
i->second.resize(m_numGroups);
|
i->second.resize(m_numGroups);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -216,7 +216,7 @@ void KeyMap::finish()
|
||||||
|
|
||||||
void KeyMap::foreachKey(ForeachKeyCallback cb, void *userData)
|
void KeyMap::foreachKey(ForeachKeyCallback cb, void *userData)
|
||||||
{
|
{
|
||||||
for (KeyIDMap::iterator i = m_keyIDMap.begin(); i != m_keyIDMap.end(); ++i) {
|
for (auto i = m_keyIDMap.begin(); i != m_keyIDMap.end(); ++i) {
|
||||||
KeyGroupTable &groupTable = i->second;
|
KeyGroupTable &groupTable = i->second;
|
||||||
for (size_t group = 0; group < groupTable.size(); ++group) {
|
for (size_t group = 0; group < groupTable.size(); ++group) {
|
||||||
KeyEntryList &entryList = groupTable[group];
|
KeyEntryList &entryList = groupTable[group];
|
||||||
|
|
@ -371,7 +371,7 @@ KeyModifierMask KeyMap::getCommandModifiers() const
|
||||||
void KeyMap::collectButtons(const ModifierToKeys &mods, ButtonToKeyMap &keys)
|
void KeyMap::collectButtons(const ModifierToKeys &mods, ButtonToKeyMap &keys)
|
||||||
{
|
{
|
||||||
keys.clear();
|
keys.clear();
|
||||||
for (ModifierToKeys::const_iterator i = mods.begin(); i != mods.end(); ++i) {
|
for (auto i = mods.begin(); i != mods.end(); ++i) {
|
||||||
keys.insert(std::make_pair(i->second.m_button, &i->second));
|
keys.insert(std::make_pair(i->second.m_button, &i->second));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -434,7 +434,7 @@ void KeyMap::initModifierKey(KeyItem &item)
|
||||||
int32_t KeyMap::findNumGroups() const
|
int32_t KeyMap::findNumGroups() const
|
||||||
{
|
{
|
||||||
size_t max = 0;
|
size_t max = 0;
|
||||||
for (KeyIDMap::const_iterator i = m_keyIDMap.begin(); i != m_keyIDMap.end(); ++i) {
|
for (auto i = m_keyIDMap.begin(); i != m_keyIDMap.end(); ++i) {
|
||||||
if (i->second.size() > max) {
|
if (i->second.size() > max) {
|
||||||
max = i->second.size();
|
max = i->second.size();
|
||||||
}
|
}
|
||||||
|
|
@ -686,7 +686,7 @@ const KeyMap::KeyItem *KeyMap::keyForModifier(KeyButton button, int32_t group, i
|
||||||
// this is important when a shift button is modified by shift; we
|
// this is important when a shift button is modified by shift; we
|
||||||
// must use the other shift button to do the shifting.
|
// must use the other shift button to do the shifting.
|
||||||
const ModifierKeyItemList &items = m_modifierKeys[group * kKeyModifierNumBits + modifierBit];
|
const ModifierKeyItemList &items = m_modifierKeys[group * kKeyModifierNumBits + modifierBit];
|
||||||
for (ModifierKeyItemList::const_iterator i = items.begin(); i != items.end(); ++i) {
|
for (auto i = items.begin(); i != items.end(); ++i) {
|
||||||
if ((*i)->m_button != button) {
|
if ((*i)->m_button != button) {
|
||||||
return (*i);
|
return (*i);
|
||||||
}
|
}
|
||||||
|
|
@ -797,7 +797,7 @@ bool KeyMap::keysToRestoreModifiers(
|
||||||
}
|
}
|
||||||
|
|
||||||
// press wanted keys
|
// press wanted keys
|
||||||
for (ModifierToKeys::const_iterator i = desiredModifiers.begin(); i != desiredModifiers.end(); ++i) {
|
for (auto i = desiredModifiers.begin(); i != desiredModifiers.end(); ++i) {
|
||||||
KeyButton button = i->second.m_button;
|
KeyButton button = i->second.m_button;
|
||||||
if (button != keyItem.m_button && oldKeys.count(button) == 0) {
|
if (button != keyItem.m_button && oldKeys.count(button) == 0) {
|
||||||
EKeystroke type = kKeystrokePress;
|
EKeystroke type = kKeystrokePress;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue