diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2018-09-29 19:35:12 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-29 21:14:35 +0200 |
commit | 65b00f316517b0f570b6aff30e70d95d4d543c03 (patch) | |
tree | 57793ade4859169f33ee5d8672872d53b51ba1c5 /winaccessibility | |
parent | 618d474f059a75c2ac04df16c830d71a88690118 (diff) |
Simplify containers iterations in w*
Use range-based loop or replace with STL functions.
Change-Id: Ie1e169f9d2d44e188180164bd1f93af43740425d
Reviewed-on: https://gerrit.libreoffice.org/61141
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'winaccessibility')
-rw-r--r-- | winaccessibility/source/service/AccObjectWinManager.cxx | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/winaccessibility/source/service/AccObjectWinManager.cxx b/winaccessibility/source/service/AccObjectWinManager.cxx index 73c43cf2c111..6528249e0f2f 100644 --- a/winaccessibility/source/service/AccObjectWinManager.cxx +++ b/winaccessibility/source/service/AccObjectWinManager.cxx @@ -443,14 +443,12 @@ int AccObjectWinManager::UpdateAccSelection(XAccessible* pXAcc) NotifyWinEvent(EVENT_OBJECT_SELECTIONADD,pAccObj->GetParentHWND(), OBJID_CLIENT,pAccChildObj->GetResID()); } - IAccSelectionList::iterator iter = oldSelection.begin(); - while(iter!=oldSelection.end()) + for (const auto& rEntry : oldSelection) { - pAccObj->GetSelection().erase(iter->first); - pAccChildObj = iter->second; + pAccObj->GetSelection().erase(rEntry.first); + pAccChildObj = rEntry.second; if(pAccChildObj != nullptr) NotifyWinEvent(EVENT_OBJECT_SELECTIONREMOVE,pAccObj->GetParentHWND(), OBJID_CLIENT,pAccChildObj->GetResID()); - ++iter; } return 0; @@ -475,16 +473,10 @@ void AccObjectWinManager::DeleteAccChildNode( AccObject* pObj ) */ void AccObjectWinManager::DeleteFromHwndXAcc(XAccessible const * pXAcc ) { - XHWNDToXAccHash::iterator iter = HwndXAcc.begin(); - while(iter!=HwndXAcc.end()) - { - if(iter->second == pXAcc ) - { - HwndXAcc.erase(iter); - return; - } - ++iter; - } + auto iter = std::find_if(HwndXAcc.begin(), HwndXAcc.end(), + [&pXAcc](XHWNDToXAccHash::value_type& rEntry) { return rEntry.second == pXAcc; }); + if (iter != HwndXAcc.end()) + HwndXAcc.erase(iter); } /** |