diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-20 16:16:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-20 21:01:10 +0200 |
commit | b285ea8606b99e2b85125ddf84af0e5e634bdd86 (patch) | |
tree | c590edd441bc4335ff42d99d752e85c35a56dc10 /svl | |
parent | 966ae2345ce09b73c2d8ea47abb983030cc580bf (diff) |
flatten the vector in NfCurrencyTable
Change-Id: I4a024e2d8c9743374e58836f95aa1fcbdc406b5b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119288
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/numbers/currencytable.cxx | 6 | ||||
-rw-r--r-- | svl/source/numbers/zforlist.cxx | 16 |
2 files changed, 11 insertions, 11 deletions
diff --git a/svl/source/numbers/currencytable.cxx b/svl/source/numbers/currencytable.cxx index feef71b43b94..d5fd2efd4d93 100644 --- a/svl/source/numbers/currencytable.cxx +++ b/svl/source/numbers/currencytable.cxx @@ -17,12 +17,12 @@ NfCurrencyTable::iterator NfCurrencyTable::begin() NfCurrencyEntry& NfCurrencyTable::operator[] ( size_t i ) { - return *maData[i]; + return maData[i]; } const NfCurrencyEntry& NfCurrencyTable::operator[] ( size_t i ) const { - return *maData[i]; + return maData[i]; } size_t NfCurrencyTable::size() const @@ -30,7 +30,7 @@ size_t NfCurrencyTable::size() const return maData.size(); } -void NfCurrencyTable::insert(const iterator& it, std::unique_ptr<NfCurrencyEntry> p) +void NfCurrencyTable::insert(const iterator& it, NfCurrencyEntry p) { maData.insert(it, std::move(p)); } diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 0a2f699f81ec..f61dd50e901a 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -4087,7 +4087,7 @@ void SvNumberFormatter::ImpInitCurrencyTable() // First entry is SYSTEM: theCurrencyTable::get().insert( theCurrencyTable::get().begin(), - std::make_unique<NfCurrencyEntry>(*pLocaleData, LANGUAGE_SYSTEM)); + NfCurrencyEntry(*pLocaleData, LANGUAGE_SYSTEM)); sal_uInt16 nCurrencyPos = 1; const css::uno::Sequence< css::lang::Locale > xLoc = LocaleDataWrapper::getInstalledLocaleNames(); @@ -4115,14 +4115,14 @@ void SvNumberFormatter::ImpInitCurrencyTable() if ( pCurrencies[nDefault].Default ) break; } - std::unique_ptr<NfCurrencyEntry> pEntry; + std::optional<NfCurrencyEntry> pEntry; if ( nDefault < nCurrencyCount ) { - pEntry.reset(new NfCurrencyEntry(pCurrencies[nDefault], *pLocaleData, eLang)); + pEntry.emplace(pCurrencies[nDefault], *pLocaleData, eLang); } else { // first or ShellsAndPebbles - pEntry.reset(new NfCurrencyEntry(*pLocaleData, eLang)); + pEntry.emplace(*pLocaleData, eLang); } if (LocaleDataWrapper::areChecksEnabled()) { @@ -4140,7 +4140,7 @@ void SvNumberFormatter::ImpInitCurrencyTable() nMatchingSystemCurrencyPosition = nCurrencyPos; } rCurrencyTable.insert( - rCurrencyTable.begin() + nCurrencyPos++, std::move(pEntry)); + rCurrencyTable.begin() + nCurrencyPos++, std::move(*pEntry)); // all remaining currencies for each locale if ( nCurrencyCount > 1 ) { @@ -4151,12 +4151,12 @@ void SvNumberFormatter::ImpInitCurrencyTable() { rLegacyOnlyCurrencyTable.insert( rLegacyOnlyCurrencyTable.begin() + nLegacyOnlyCurrencyPos++, - std::make_unique<NfCurrencyEntry>( + NfCurrencyEntry( pCurrencies[nCurrency], *pLocaleData, eLang)); } else if ( nCurrency != nDefault ) { - pEntry.reset(new NfCurrencyEntry(pCurrencies[nCurrency], *pLocaleData, eLang)); + pEntry.emplace(pCurrencies[nCurrency], *pLocaleData, eLang); // no dupes bool bInsert = true; sal_uInt16 n = rCurrencyTable.size(); @@ -4188,7 +4188,7 @@ void SvNumberFormatter::ImpInitCurrencyTable() nMatchingSystemCurrencyPosition = nCurrencyPos; } rCurrencyTable.insert( - rCurrencyTable.begin() + nCurrencyPos++, std::move(pEntry)); + rCurrencyTable.begin() + nCurrencyPos++, std::move(*pEntry)); } } } |