diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-09-07 23:10:33 +0300 |
---|---|---|
committer | Arkadiy Illarionov <qarkai@gmail.com> | 2019-10-21 19:41:43 +0200 |
commit | 00e2f118d7f4f070ebddf16b2cf4e89cf9d551a7 (patch) | |
tree | 2f48bf4455360d0f08d8096317ea31012debffbc /i18npool/source/indexentry/indexentrysupplier.cxx | |
parent | ad3e00237f48c52dbd2833f21f5e2f5acfdd4167 (diff) |
Simplify Sequence iterations in i18npool
Use range-based loops, STL and comphelper functions.
Change-Id: Ibbc1c14e921585819872f26e8def2a60594e6a63
Reviewed-on: https://gerrit.libreoffice.org/78754
Tested-by: Jenkins
Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
Diffstat (limited to 'i18npool/source/indexentry/indexentrysupplier.cxx')
-rw-r--r-- | i18npool/source/indexentry/indexentrysupplier.cxx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/i18npool/source/indexentry/indexentrysupplier.cxx b/i18npool/source/indexentry/indexentrysupplier.cxx index 44be37a66fe0..f98856ee2227 100644 --- a/i18npool/source/indexentry/indexentrysupplier.cxx +++ b/i18npool/source/indexentry/indexentrysupplier.cxx @@ -46,13 +46,12 @@ Sequence < OUString > SAL_CALL IndexEntrySupplier::getAlgorithmList( const Local sal_Bool SAL_CALL IndexEntrySupplier::loadAlgorithm( const Locale& rLocale, const OUString& SortAlgorithm, sal_Int32 collatorOptions ) { - Sequence < OUString > algorithmList = getAlgorithmList( rLocale ); - for (sal_Int32 i = 0; i < algorithmList.getLength(); i++) { - if (algorithmList[i] == SortAlgorithm) { - if (getLocaleSpecificIndexEntrySupplier(rLocale, SortAlgorithm).is()) - return xIES->loadAlgorithm(rLocale, SortAlgorithm, collatorOptions); - } - } + const Sequence < OUString > algorithmList = getAlgorithmList( rLocale ); + if (std::any_of(algorithmList.begin(), algorithmList.end(), + [this, &SortAlgorithm, &rLocale](const OUString& rAlgorithm) { + return rAlgorithm == SortAlgorithm + && getLocaleSpecificIndexEntrySupplier(rLocale, SortAlgorithm).is(); })) + return xIES->loadAlgorithm(rLocale, SortAlgorithm, collatorOptions); return false; } |