diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-05-12 16:07:58 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-06-11 20:32:49 +0200 |
commit | 79d58ee14da8fbf636fb087453834abb7173d3fc (patch) | |
tree | 2eda9470235311bdfaf542ceeaf8237406458015 /xmloff/source/style/xmlnumfe.cxx | |
parent | c88f76035cd1d088cc06067270677618340fd839 (diff) |
Simplify Sequence iterations in xmloff/source/{style..xforms}
Use range-based loops or replace with comphelper or STL functions
Change-Id: Ie268d80b9c01d38c745c14a81c219d9930860562
Reviewed-on: https://gerrit.libreoffice.org/72189
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff/source/style/xmlnumfe.cxx')
-rw-r--r-- | xmloff/source/style/xmlnumfe.cxx | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx index 98a8e72f17ce..80f8511499b3 100644 --- a/xmloff/source/style/xmlnumfe.cxx +++ b/xmloff/source/style/xmlnumfe.cxx @@ -194,11 +194,9 @@ uno::Sequence<sal_Int32> SvXMLNumUsedList_Impl::GetWasUsed() void SvXMLNumUsedList_Impl::SetWasUsed(const uno::Sequence<sal_Int32>& rWasUsed) { DBG_ASSERT(nWasUsedCount == 0, "WasUsed should be empty"); - sal_Int32 nCount(rWasUsed.getLength()); - const sal_Int32* pWasUsed = rWasUsed.getConstArray(); - for (sal_Int32 i = 0; i < nCount; i++, pWasUsed++) + for (const auto nWasUsed : rWasUsed) { - std::pair<SvXMLuInt32Set::const_iterator, bool> aPair = aWasUsed.insert( *pWasUsed ); + std::pair<SvXMLuInt32Set::const_iterator, bool> aPair = aWasUsed.insert( nWasUsed ); if (aPair.second) nWasUsedCount++; } @@ -929,16 +927,10 @@ static OUString lcl_GetDefaultCalendar( SvNumberFormatter const * pFormatter, La lang::Locale aLocale( LanguageTag::convertToLocale( nLang ) ); uno::Sequence<OUString> aCals = pCalendar->getAllCalendars( aLocale ); - sal_Int32 nCnt = aCals.getLength(); - bool bFound = false; - for ( sal_Int32 j=0; j < nCnt && !bFound; j++ ) - { - if ( aCals[j] != "gregorian" ) - { - aCalendar = aCals[j]; - bFound = true; - } - } + auto pCal = std::find_if(aCals.begin(), aCals.end(), + [](const OUString& rCal) { return rCal != "gregorian"; }); + if (pCal != aCals.end()) + aCalendar = *pCal; } return aCalendar; } |