diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-06-27 23:29:01 +0300 |
---|---|---|
committer | Arkadiy Illarionov <qarkai@gmail.com> | 2019-06-28 17:33:40 +0200 |
commit | 1e084caf573255a93ce86053d584976f317074df (patch) | |
tree | 9340232dd2ae3b3f38f4c8e996f93587adbb7fb8 /unotools/source/config/lingucfg.cxx | |
parent | 41cf4e6604bfb9b51ce54c5ea64d77249c7545d7 (diff) |
Simplify Sequence iterations in unotools
Use range-based loops or replace with STL functions
Change-Id: I220c5cd5dcc19fc35e1ad729ae69246f4a79ce2d
Reviewed-on: https://gerrit.libreoffice.org/74825
Tested-by: Jenkins
Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
Diffstat (limited to 'unotools/source/config/lingucfg.cxx')
-rw-r--r-- | unotools/source/config/lingucfg.cxx | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx index a1c07d61489c..1d62a2f3013e 100644 --- a/unotools/source/config/lingucfg.cxx +++ b/unotools/source/config/lingucfg.cxx @@ -970,9 +970,8 @@ bool SvtLinguConfig::GetDictionaryEntry( if (bSuccess) { // get file URL's for the locations - for (sal_Int32 i = 0; i < aLocations.getLength(); ++i) + for (OUString& rLocation : aLocations) { - OUString &rLocation = aLocations[i]; if (!lcl_GetFileUrlFromOrigin( rLocation, rLocation )) bSuccess = false; } @@ -1018,33 +1017,27 @@ std::vector< SvtLinguConfigDictionaryEntry > SvtLinguConfig::GetActiveDictionari { uno::Sequence< OUString > aElementNames; GetElementNamesFor( aG_Dictionaries, aElementNames ); - sal_Int32 nLen = aElementNames.getLength(); - const OUString *pElementNames = aElementNames.getConstArray(); const uno::Sequence< OUString > aDisabledDics( GetDisabledDictionaries() ); SvtLinguConfigDictionaryEntry aDicEntry; - for (sal_Int32 i = 0; i < nLen; ++i) + for (const OUString& rElementName : aElementNames) { // does dictionary match the format we are looking for? - if (GetDictionaryEntry( pElementNames[i], aDicEntry ) && + if (GetDictionaryEntry( rElementName, aDicEntry ) && aDicEntry.aFormatName == rFormatName) { // check if it is active or not - bool bDicIsActive = true; - for (sal_Int32 k = 0; bDicIsActive && k < aDisabledDics.getLength(); ++k) - { - if (aDisabledDics[k] == pElementNames[i]) - bDicIsActive = false; - } + bool bDicIsActive = std::none_of(aDisabledDics.begin(), aDisabledDics.end(), + [&rElementName](const OUString& rDic) { return rDic == rElementName; }); if (bDicIsActive) { DBG_ASSERT( !aDicEntry.aFormatName.isEmpty(), "FormatName not set" ); - DBG_ASSERT( aDicEntry.aLocations.getLength(), + DBG_ASSERT( aDicEntry.aLocations.hasElements(), "Locations not set" ); - DBG_ASSERT( aDicEntry.aLocaleNames.getLength(), + DBG_ASSERT( aDicEntry.aLocaleNames.hasElements(), "Locales not set" ); aRes.push_back( aDicEntry ); } |