From 452a8e4abe0c416d664078baddff67c1561025ec Mon Sep 17 00:00:00 2001 From: Arkadiy Illarionov Date: Sat, 15 Jun 2019 17:13:48 +0300 Subject: Simplify Sequence iterations in vcl Use range-based loops or replace with comphelper or STL functions Change-Id: If046738084c2d13cc1eaea6a03aaf60b63f62767 Reviewed-on: https://gerrit.libreoffice.org/74104 Tested-by: Jenkins Reviewed-by: Noel Grandin --- vcl/source/control/edit.cxx | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'vcl/source/control/edit.cxx') diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index a1b1af252dc5..57d037546c5f 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -2924,18 +2924,12 @@ void Edit::dragEnter( const css::datatransfer::dnd::DropTargetDragEnterEvent& rD } // search for string data type const Sequence< css::datatransfer::DataFlavor >& rFlavors( rDTDE.SupportedDataFlavors ); - sal_Int32 nEle = rFlavors.getLength(); - mpDDInfo->bIsStringSupported = false; - for( sal_Int32 i = 0; i < nEle; i++ ) - { - sal_Int32 nIndex = 0; - const OUString aMimetype = rFlavors[i].MimeType.getToken( 0, ';', nIndex ); - if ( aMimetype == "text/plain" ) - { - mpDDInfo->bIsStringSupported = true; - break; - } - } + mpDDInfo->bIsStringSupported = std::any_of(rFlavors.begin(), rFlavors.end(), + [](const css::datatransfer::DataFlavor& rFlavor) { + sal_Int32 nIndex = 0; + const OUString aMimetype = rFlavor.MimeType.getToken( 0, ';', nIndex ); + return aMimetype == "text/plain"; + }); } void Edit::dragExit( const css::datatransfer::dnd::DropTargetEvent& ) -- cgit v1.2.3