[Libreoffice-commits] core.git: include/svl svl/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jul 20 19:01:47 UTC 2021
include/svl/currencytable.hxx | 4 ++--
include/svl/zforlist.hxx | 5 +----
svl/source/numbers/currencytable.cxx | 6 +++---
svl/source/numbers/zforlist.cxx | 16 ++++++++--------
4 files changed, 14 insertions(+), 17 deletions(-)
New commits:
commit b285ea8606b99e2b85125ddf84af0e5e634bdd86
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Jul 20 16:16:34 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jul 20 21:01:10 2021 +0200
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 at collabora.co.uk>
diff --git a/include/svl/currencytable.hxx b/include/svl/currencytable.hxx
index 2214b1903a6a..f7573f48b80b 100644
--- a/include/svl/currencytable.hxx
+++ b/include/svl/currencytable.hxx
@@ -18,7 +18,7 @@
class SVL_DLLPUBLIC NfCurrencyTable
{
- typedef std::vector<std::unique_ptr<NfCurrencyEntry>> DataType;
+ typedef std::vector<NfCurrencyEntry> DataType;
DataType maData;
NfCurrencyTable(NfCurrencyTable const&) = delete;
@@ -36,7 +36,7 @@ public:
size_t size() const;
- void insert(const iterator& it, std::unique_ptr<NfCurrencyEntry> p);
+ void insert(const iterator& it, NfCurrencyEntry p);
};
#endif
diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx
index c3d82d7b109a..b929e6255277 100644
--- a/include/svl/zforlist.hxx
+++ b/include/svl/zforlist.hxx
@@ -302,7 +302,7 @@ typedef ::std::set< LanguageType > NfInstalledLocales;
/** Language/country dependent currency entries
*/
-class UNLESS_MERGELIBS(SVL_DLLPUBLIC) NfCurrencyEntry
+class UNLESS_MERGELIBS(SVL_DLLPUBLIC) NfCurrencyEntry final
{
OUString aSymbol; /// currency symbol
OUString aBankSymbol; /// currency abbreviation
@@ -312,9 +312,6 @@ class UNLESS_MERGELIBS(SVL_DLLPUBLIC) NfCurrencyEntry
sal_uInt16 nDigits; /// count of decimal digits
sal_Unicode cZeroChar; /// which character is used for zeros as last decimal digits
- NfCurrencyEntry( const NfCurrencyEntry& ) = delete;
- NfCurrencyEntry& operator=( const NfCurrencyEntry& ) = delete;
-
private:
// nDecimalFormat := 0, 1, 2
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));
}
}
}
More information about the Libreoffice-commits
mailing list