diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2018-03-18 12:36:02 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2018-03-25 15:14:44 +0200 |
commit | f365b17bf170c8ed1baae299a2d719774fcc4305 (patch) | |
tree | 312378ff5e6ef487ab65d7a1d011307486941c56 /linguistic | |
parent | accessibility: simplify OCommonAccessibleText (diff) | |
download | core-f365b17bf170c8ed1baae299a2d719774fcc4305.tar.gz core-f365b17bf170c8ed1baae299a2d719774fcc4305.zip |
Use for-range loops in some modules
jvmaccess, jvmfwk, l10ntools, libreofficekit and linguistic
Change-Id: I9d290d1098b25ccb3aee19d2df18c18f4aa65105
Reviewed-on: https://gerrit.libreoffice.org/51495
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 'linguistic')
-rw-r--r-- | linguistic/source/convdic.cxx | 18 | ||||
-rw-r--r-- | linguistic/source/convdicxml.cxx | 16 | ||||
-rw-r--r-- | linguistic/source/gciterator.cxx | 6 | ||||
-rw-r--r-- | linguistic/source/hyphdsp.cxx | 5 | ||||
-rw-r--r-- | linguistic/source/lngsvcmgr.cxx | 15 | ||||
-rw-r--r-- | linguistic/source/spelldsp.cxx | 5 | ||||
-rw-r--r-- | linguistic/source/thesdsp.cxx | 5 |
7 files changed, 27 insertions, 43 deletions
diff --git a/linguistic/source/convdic.cxx b/linguistic/source/convdic.cxx index 555244ada44a..755ffb72c060 100644 --- a/linguistic/source/convdic.cxx +++ b/linguistic/source/convdic.cxx @@ -449,18 +449,16 @@ uno::Sequence< OUString > SAL_CALL ConvDic::getConversionEntries( aFromLeft : *pFromRight; uno::Sequence< OUString > aRes( rConvMap.size() ); OUString *pRes = aRes.getArray(); - ConvMap::iterator aIt = rConvMap.begin(); sal_Int32 nIdx = 0; - while (aIt != rConvMap.end()) + for (auto const& elem : rConvMap) { - OUString aCurEntry( (*aIt).first ); + OUString aCurEntry( elem.first ); // skip duplicate entries ( duplicate = duplicate entries // respective to the evaluated side (FROM_LEFT or FROM_RIGHT). // Thus if FROM_LEFT is evaluated for pairs (A,B) and (A,C) // only one entry for A will be returned in the result) if (nIdx == 0 || !lcl_SeqHasEntry( pRes, nIdx, aCurEntry )) pRes[ nIdx++ ] = aCurEntry; - ++aIt; } aRes.realloc( nIdx ); @@ -510,25 +508,21 @@ sal_Int16 SAL_CALL ConvDic::getMaxCharCount( ConversionDirection eDirection ) if (!bMaxCharCountIsValid) { nMaxLeftCharCount = 0; - ConvMap::iterator aIt = aFromLeft.begin(); - while (aIt != aFromLeft.end()) + for (auto const& elem : aFromLeft) { - sal_Int16 nTmp = static_cast<sal_Int16>((*aIt).first.getLength()); + sal_Int16 nTmp = static_cast<sal_Int16>(elem.first.getLength()); if (nTmp > nMaxLeftCharCount) nMaxLeftCharCount = nTmp; - ++aIt; } nMaxRightCharCount = 0; if (pFromRight.get()) { - aIt = pFromRight->begin(); - while (aIt != pFromRight->end()) + for (auto const& elem : *pFromRight) { - sal_Int16 nTmp = static_cast<sal_Int16>((*aIt).first.getLength()); + sal_Int16 nTmp = static_cast<sal_Int16>(elem.first.getLength()); if (nTmp > nMaxRightCharCount) nMaxRightCharCount = nTmp; - ++aIt; } } diff --git a/linguistic/source/convdicxml.cxx b/linguistic/source/convdicxml.cxx index 97a1d6a56268..51ba74467120 100644 --- a/linguistic/source/convdicxml.cxx +++ b/linguistic/source/convdicxml.cxx @@ -326,14 +326,12 @@ void ConvDicXMLExport::ExportContent_() { // acquire sorted list of all keys ConvMapKeySet aKeySet; - ConvMap::iterator aIt; - for (aIt = rDic.aFromLeft.begin(); aIt != rDic.aFromLeft.end(); ++aIt) - aKeySet.insert( (*aIt).first ); + for (auto const& elem : rDic.aFromLeft) + aKeySet.insert( elem.first ); - ConvMapKeySet::iterator aKeyIt; - for (aKeyIt = aKeySet.begin(); aKeyIt != aKeySet.end(); ++aKeyIt) + for (auto const& elem : aKeySet) { - OUString aLeftText( *aKeyIt ); + OUString aLeftText(elem); AddAttribute( XML_NAMESPACE_TCD, "left-text", aLeftText ); if (rDic.pConvPropType.get()) // property-type list available? { @@ -350,10 +348,10 @@ void ConvDicXMLExport::ExportContent_() "entry" , true, true ); pair< ConvMap::iterator, ConvMap::iterator > aRange = - rDic.aFromLeft.equal_range( *aKeyIt ); - for (aIt = aRange.first; aIt != aRange.second; ++aIt) + rDic.aFromLeft.equal_range(elem); + for (auto aIt = aRange.first; aIt != aRange.second; ++aIt) { - DBG_ASSERT( *aKeyIt == (*aIt).first, "key <-> entry mismatch" ); + DBG_ASSERT( elem == (*aIt).first, "key <-> entry mismatch" ); OUString aRightText( (*aIt).second ); SvXMLElementExport aEntryRightText( *this, XML_NAMESPACE_TCD, "right-text" , true, false ); diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx index 4ecfffa8603b..144aaa599b85 100644 --- a/linguistic/source/gciterator.cxx +++ b/linguistic/source/gciterator.cxx @@ -797,13 +797,11 @@ sal_Int32 GrammarCheckingIterator::GetSuggestedEndOfSentence( void SAL_CALL GrammarCheckingIterator::resetIgnoreRules( ) { - GCReferences_t::iterator aIt( m_aGCReferencesByService.begin() ); - while (aIt != m_aGCReferencesByService.end()) + for (auto const& elem : m_aGCReferencesByService) { - uno::Reference< linguistic2::XProofreader > xGC( aIt->second ); + uno::Reference< linguistic2::XProofreader > xGC(elem.second); if (xGC.is()) xGC->resetIgnoreRules(); - ++aIt; } } diff --git a/linguistic/source/hyphdsp.cxx b/linguistic/source/hyphdsp.cxx index bb1bdfebdef5..425d29124500 100644 --- a/linguistic/source/hyphdsp.cxx +++ b/linguistic/source/hyphdsp.cxx @@ -251,10 +251,9 @@ Sequence< Locale > SAL_CALL HyphenatorDispatcher::getLocales() Sequence< Locale > aLocales( static_cast< sal_Int32 >(aSvcMap.size()) ); Locale *pLocales = aLocales.getArray(); - HyphSvcByLangMap_t::const_iterator aIt; - for (aIt = aSvcMap.begin(); aIt != aSvcMap.end(); ++aIt) + for (auto const& elem : aSvcMap) { - *pLocales++ = LanguageTag::convertToLocale( aIt->first ); + *pLocales++ = LanguageTag::convertToLocale(elem.first); } return aLocales; } diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx index e5dc4b1d4829..8c8aba8fdca6 100644 --- a/linguistic/source/lngsvcmgr.cxx +++ b/linguistic/source/lngsvcmgr.cxx @@ -131,11 +131,10 @@ static uno::Sequence< lang::Locale > GetAvailLocales( sal_Int32 nLanguages = static_cast< sal_Int32 >(aLanguages.size()); aRes.realloc( nLanguages ); lang::Locale *pRes = aRes.getArray(); - std::set< LanguageType >::const_iterator aIt( aLanguages.begin() ); - for (i = 0; aIt != aLanguages.end(); ++aIt, ++i) + i=0; + for (auto const& language : aLanguages) { - LanguageType nLang = *aIt; - pRes[i] = LanguageTag::convertToLocale( nLang ); + pRes[i++] = LanguageTag::convertToLocale(language); } } @@ -745,16 +744,14 @@ void LngSvcMgr::UpdateAll() OUString aSubNodeName( OUString::createFromAscii(pSubNodeName) ); list_entry_map_t &rCurMap = (i == 0) ? aCurSvcs[k] : aLastFoundSvcs[k]; - list_entry_map_t::const_iterator aIt( rCurMap.begin() ); sal_Int32 nVals = static_cast< sal_Int32 >( rCurMap.size() ); Sequence< PropertyValue > aNewValues( nVals ); PropertyValue *pNewValue = aNewValues.getArray(); - while (aIt != rCurMap.end()) + for (auto const& elem : rCurMap) { - pNewValue->Name = aSubNodeName + "/" + (*aIt).first; - pNewValue->Value <<= (*aIt).second; + pNewValue->Name = aSubNodeName + "/" + elem.first; + pNewValue->Value <<= elem.second; ++pNewValue; - ++aIt; } OSL_ENSURE( pNewValue - aNewValues.getArray() == nVals, "possible mismatch of sequence size and property number" ); diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx index 7d1ac95fc32c..b3a795f7f75c 100644 --- a/linguistic/source/spelldsp.cxx +++ b/linguistic/source/spelldsp.cxx @@ -192,10 +192,9 @@ Sequence< Locale > SAL_CALL SpellCheckerDispatcher::getLocales() Sequence< Locale > aLocales( static_cast< sal_Int32 >(m_aSvcMap.size()) ); Locale *pLocales = aLocales.getArray(); - SpellSvcByLangMap_t::const_iterator aIt; - for (aIt = m_aSvcMap.begin(); aIt != m_aSvcMap.end(); ++aIt) + for (auto const& elem : m_aSvcMap) { - *pLocales++ = LanguageTag::convertToLocale( aIt->first ); + *pLocales++ = LanguageTag::convertToLocale(elem.first); } return aLocales; } diff --git a/linguistic/source/thesdsp.cxx b/linguistic/source/thesdsp.cxx index d81fbf4f79ef..9b34cf300204 100644 --- a/linguistic/source/thesdsp.cxx +++ b/linguistic/source/thesdsp.cxx @@ -83,10 +83,9 @@ Sequence< Locale > SAL_CALL Sequence< Locale > aLocales( static_cast< sal_Int32 >(aSvcMap.size()) ); Locale *pLocales = aLocales.getArray(); - ThesSvcByLangMap_t::const_iterator aIt; - for (aIt = aSvcMap.begin(); aIt != aSvcMap.end(); ++aIt) + for (auto const& elem : aSvcMap) { - *pLocales++ = LanguageTag::convertToLocale( aIt->first ); + *pLocales++ = LanguageTag::convertToLocale(elem.first); } return aLocales; } |