diff options
Diffstat (limited to 'vcl/source/window/builder.cxx')
-rw-r--r-- | vcl/source/window/builder.cxx | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 03eee84e4a97..a57984c61925 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -160,11 +160,10 @@ namespace weld if (pList) { // return unit's default string (ie, the first one ) - for (auto it = pList->begin(); it != pList->end(); ++it) - { - if (it->second == rUnit) - return it->first; - } + auto it = std::find_if(pList->begin(), pList->end(), + [&rUnit](std::pair<OUString, FieldUnit>& rItem) { return rItem.second == rUnit; }); + if (it != pList->end()) + return it->first; } return OUString(); @@ -3850,15 +3849,12 @@ void VclBuilder::set_response(const OString& sID, short nResponse) void VclBuilder::delete_by_name(const OString& sID) { - for (std::vector<WinAndId>::iterator aI = m_aChildren.begin(), - aEnd = m_aChildren.end(); aI != aEnd; ++aI) + auto aI = std::find_if(m_aChildren.begin(), m_aChildren.end(), + [&sID](WinAndId& rItem) { return rItem.m_sID == sID; }); + if (aI != m_aChildren.end()) { - if (aI->m_sID == sID) - { - aI->m_pWindow.disposeAndClear(); - m_aChildren.erase(aI); - break; - } + aI->m_pWindow.disposeAndClear(); + m_aChildren.erase(aI); } } @@ -3870,15 +3866,10 @@ void VclBuilder::delete_by_window(vcl::Window *pWindow) void VclBuilder::drop_ownership(const vcl::Window *pWindow) { - for (std::vector<WinAndId>::iterator aI = m_aChildren.begin(), - aEnd = m_aChildren.end(); aI != aEnd; ++aI) - { - if (aI->m_pWindow == pWindow) - { - m_aChildren.erase(aI); - break; - } - } + auto aI = std::find_if(m_aChildren.begin(), m_aChildren.end(), + [&pWindow](WinAndId& rItem) { return rItem.m_pWindow == pWindow; }); + if (aI != m_aChildren.end()) + m_aChildren.erase(aI); } OString VclBuilder::get_by_window(const vcl::Window *pWindow) const |