diff options
author | Fawrsk <fawrsk@gmail.com> | 2023-01-07 00:38:12 -0400 |
---|---|---|
committer | Fawrsk <fawrsk@gmail.com> | 2023-01-07 00:38:12 -0400 |
commit | 9e743c99fb69db5694c388ae33656c62e3fa0b8e (patch) | |
tree | c981c998d0439d8bd48ce98123c19de8a9a27753 /indra/llcommon/llkeybind.cpp | |
parent | d0f115ae093e8268da2a3245d6cb2f3bcc544f1c (diff) |
Cleanup for loops in llcommon to use C++11 range based for loops
Diffstat (limited to 'indra/llcommon/llkeybind.cpp')
-rw-r--r-- | indra/llcommon/llkeybind.cpp | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/indra/llcommon/llkeybind.cpp b/indra/llcommon/llkeybind.cpp index 12e57ae94b..b89160cc55 100644 --- a/indra/llcommon/llkeybind.cpp +++ b/indra/llcommon/llkeybind.cpp @@ -207,9 +207,9 @@ bool LLKeyBind::operator!=(const LLKeyBind& rhs) bool LLKeyBind::isEmpty() const { - for (data_vector_t::const_iterator iter = mData.begin(); iter != mData.end(); iter++) + for (const LLKeyData& key_data : mData) { - if (!iter->isEmpty()) return false; + if (!key_data.isEmpty()) return false; } return true; } @@ -225,12 +225,11 @@ LLKeyBind::data_vector_t::const_iterator LLKeyBind::endNonEmpty() const LLSD LLKeyBind::asLLSD() const { LLSD data; - auto end{ endNonEmpty() }; - for (auto it = mData.begin(); it < end; ++it) + for (const LLKeyData& key_data : mData) { // append intermediate entries even if empty to not affect visual // representation - data.append(it->asLLSD()); + data.append(key_data.asLLSD()); } return data; } @@ -243,9 +242,9 @@ bool LLKeyBind::canHandle(EMouseClickType mouse, KEY key, MASK mask) const return false; } - for (data_vector_t::const_iterator iter = mData.begin(); iter != mData.end(); iter++) + for (const LLKeyData& key_data : mData) { - if (iter->canHandle(mouse, key, mask)) + if (key_data.canHandle(mouse, key, mask)) { return true; } @@ -267,12 +266,12 @@ bool LLKeyBind::hasKeyData(EMouseClickType mouse, KEY key, MASK mask, bool ignor { if (mouse != CLICK_NONE || key != KEY_NONE) { - for (data_vector_t::const_iterator iter = mData.begin(); iter != mData.end(); iter++) + for (const LLKeyData& key_data : mData) { - if (iter->mKey == key - && iter->mMask == mask - && iter->mMouse == mouse - && iter->mIgnoreMasks == ignore) + if (key_data.mKey == key + && key_data.mMask == mask + && key_data.mMouse == mouse + && key_data.mIgnoreMasks == ignore) { return true; } @@ -354,16 +353,16 @@ void LLKeyBind::replaceKeyData(const LLKeyData& data, U32 index) { // if both click and key are none (isEmpty()), we are inserting a placeholder, we don't want to reset anything // otherwise reset identical key - for (data_vector_t::iterator iter = mData.begin(); iter != mData.end(); iter++) + for (LLKeyData& key_data : mData) { - if (iter->mKey == data.mKey - && iter->mMouse == data.mMouse - && iter->mIgnoreMasks == data.mIgnoreMasks - && iter->mMask == data.mMask) + if (key_data.mKey == data.mKey + && key_data.mMouse == data.mMouse + && key_data.mIgnoreMasks == data.mIgnoreMasks + && key_data.mMask == data.mMask) { // Replacing only fully equal combinations even in case 'ignore' is set // Reason: Simplicity and user might decide to do a 'move' command as W and Shift+Ctrl+W, and 'run' as Shift+W - iter->reset(); + key_data.reset(); break; } } |