summaryrefslogtreecommitdiff
path: root/i18npool/source/characterclassification/characterclassificationImpl.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-01-22 14:04:06 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-02-02 11:12:15 +0100
commit23e9b1294471459d386152b1197cfe58514af5da (patch)
tree0c8705260a4f33810e4c69f09a09dca7031e0ea7 /i18npool/source/characterclassification/characterclassificationImpl.cxx
parentcc45c96770def8fb3cc8c6d6c3d385c592806ae9 (diff)
loplugin:useuniqueptr in i18npool
Change-Id: Iff39b9298bfad474c5c011b6355b8ebf5be06318 Reviewed-on: https://gerrit.libreoffice.org/49091 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'i18npool/source/characterclassification/characterclassificationImpl.cxx')
-rw-r--r--i18npool/source/characterclassification/characterclassificationImpl.cxx19
1 files changed, 9 insertions, 10 deletions
diff --git a/i18npool/source/characterclassification/characterclassificationImpl.cxx b/i18npool/source/characterclassification/characterclassificationImpl.cxx
index ccccbe432bf9..b9f008d26930 100644
--- a/i18npool/source/characterclassification/characterclassificationImpl.cxx
+++ b/i18npool/source/characterclassification/characterclassificationImpl.cxx
@@ -36,10 +36,6 @@ CharacterClassificationImpl::CharacterClassificationImpl(
}
CharacterClassificationImpl::~CharacterClassificationImpl() {
- // Clear lookuptable
- for (lookupTableItem* p : lookupTable)
- delete p;
- lookupTable.clear();
}
@@ -128,9 +124,10 @@ bool CharacterClassificationImpl::createLocaleSpecificCharacterClassification(co
{
// to share service between same Language but different Country code, like zh_CN and zh_SG
for (size_t l = 0; l < lookupTable.size(); l++) {
- cachedItem = lookupTable[l];
+ cachedItem = lookupTable[l].get();
if (serviceName == cachedItem->aName) {
- lookupTable.push_back( cachedItem = new lookupTableItem(rLocale, serviceName, cachedItem->xCI) );
+ lookupTable.emplace_back( new lookupTableItem(rLocale, serviceName, cachedItem->xCI) );
+ cachedItem = lookupTable.back().get();
return true;
}
}
@@ -142,7 +139,8 @@ bool CharacterClassificationImpl::createLocaleSpecificCharacterClassification(co
if ( xI.is() ) {
xCI.set( xI, UNO_QUERY );
if (xCI.is()) {
- lookupTable.push_back( cachedItem = new lookupTableItem(rLocale, serviceName, xCI) );
+ lookupTable.emplace_back( new lookupTableItem(rLocale, serviceName, xCI) );
+ cachedItem = lookupTable.back().get();
return true;
}
}
@@ -156,8 +154,8 @@ CharacterClassificationImpl::getLocaleSpecificCharacterClassification(const Loca
if (cachedItem && cachedItem->equals(rLocale))
return cachedItem->xCI;
else {
- for (lookupTableItem* i : lookupTable) {
- cachedItem = i;
+ for (auto & i : lookupTable) {
+ cachedItem = i.get();
if (cachedItem->equals(rLocale))
return cachedItem->xCI;
}
@@ -180,7 +178,8 @@ CharacterClassificationImpl::getLocaleSpecificCharacterClassification(const Loca
return cachedItem->xCI;
else if (xUCI.is())
{
- lookupTable.push_back( cachedItem = new lookupTableItem( rLocale, "Unicode", xUCI));
+ lookupTable.emplace_back( new lookupTableItem(rLocale, "Unicode", xUCI) );
+ cachedItem = lookupTable.back().get();
return cachedItem->xCI;
}
}