diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2017-11-01 16:56:25 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2017-11-01 20:37:54 +0100 |
commit | a14892eda219b273726d2ca001955dfeb36360c3 (patch) | |
tree | 932bbf6f57c3c0175e2ac6386f143ba4ffd52e5d /lingucomponent/source/hyphenator | |
parent | 0b70e6b93b8cb2169fa372b555ae0c6b43a4ce43 (diff) |
Replace lists by vectors in lingucomponent
+ use loop ranges
Change-Id: I0ae81e3c10a6382d3f5719b2824a70d6e72b1462
Reviewed-on: https://gerrit.libreoffice.org/44169
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'lingucomponent/source/hyphenator')
-rw-r--r-- | lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx index 5503333c18ce..1a9c1d628a14 100644 --- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx +++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx @@ -47,7 +47,7 @@ #include <string.h> #include <cassert> -#include <list> +#include <vector> #include <set> #include <memory> @@ -117,7 +117,7 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales() // get list of dictionaries-to-use // (or better speaking: the list of dictionaries using the // new configuration entries). - std::list< SvtLinguConfigDictionaryEntry > aDics; + std::vector< SvtLinguConfigDictionaryEntry > aDics; uno::Sequence< OUString > aFormatList; aLinguCfg.GetSupportedDictionaryFormatsFor( "Hyphenators", "org.openoffice.lingu.LibHnjHyphenator", aFormatList ); @@ -146,10 +146,9 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales() // get supported locales from the dictionaries-to-use... sal_Int32 k = 0; std::set<OUString> aLocaleNamesSet; - std::list< SvtLinguConfigDictionaryEntry >::const_iterator aDictIt; - for (aDictIt = aDics.begin(); aDictIt != aDics.end(); ++aDictIt) + for (auto const& dict : aDics) { - uno::Sequence< OUString > aLocaleNames( aDictIt->aLocaleNames ); + uno::Sequence< OUString > aLocaleNames( dict.aLocaleNames ); sal_Int32 nLen2 = aLocaleNames.getLength(); for (k = 0; k < nLen2; ++k) { @@ -158,11 +157,10 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales() } // ... and add them to the resulting sequence aSuppLocales.realloc( aLocaleNamesSet.size() ); - std::set<OUString>::const_iterator aItB; k = 0; - for (aItB = aLocaleNamesSet.begin(); aItB != aLocaleNamesSet.end(); ++aItB) + for (auto const& localeName : aLocaleNamesSet) { - Locale aTmp( LanguageTag::convertToLocale( *aItB )); + Locale aTmp( LanguageTag::convertToLocale(localeName)); aSuppLocales[k++] = aTmp; } @@ -172,19 +170,19 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales() //! In the future the implementation should support using several dictionaries //! for one locale. numdict = 0; - for (aDictIt = aDics.begin(); aDictIt != aDics.end(); ++aDictIt) - numdict = numdict + aDictIt->aLocaleNames.getLength(); + for (auto const& dict : aDics) + numdict = numdict + dict.aLocaleNames.getLength(); // add dictionary information aDicts = new HDInfo[numdict]; k = 0; - for (aDictIt = aDics.begin(); aDictIt != aDics.end(); ++aDictIt) + for (auto const& dict : aDics) { - if (aDictIt->aLocaleNames.getLength() > 0 && - aDictIt->aLocations.getLength() > 0) + if (dict.aLocaleNames.getLength() > 0 && + dict.aLocations.getLength() > 0) { - uno::Sequence< OUString > aLocaleNames( aDictIt->aLocaleNames ); + uno::Sequence< OUString > aLocaleNames(dict.aLocaleNames); sal_Int32 nLocales = aLocaleNames.getLength(); // currently only one language per dictionary is supported in the actual implementation... @@ -192,7 +190,7 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales() // Once for each of its supported locales. for (sal_Int32 i = 0; i < nLocales; ++i) { - LanguageTag aLanguageTag( aDictIt->aLocaleNames[i] ); + LanguageTag aLanguageTag(dict.aLocaleNames[i]); aDicts[k].aPtr = nullptr; aDicts[k].eEnc = RTL_TEXTENCODING_DONTKNOW; aDicts[k].aLoc = aLanguageTag.getLocale(); @@ -200,7 +198,7 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales() // also both files have to be in the same directory and the // file names must only differ in the extension (.aff/.dic). // Thus we use the first location only and strip the extension part. - OUString aLocation = aDictIt->aLocations[0]; + OUString aLocation = dict.aLocations[0]; sal_Int32 nPos = aLocation.lastIndexOf( '.' ); aLocation = aLocation.copy( 0, nPos ); aDicts[k].aName = aLocation; |