summaryrefslogtreecommitdiff
path: root/linguistic
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-01-23 16:48:17 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-01-29 07:20:58 +0100
commit97b5bf4a39f33a3e51f1aa72339a5e88d1b9e9f3 (patch)
treeb23e9444a10068f0ba3f3ad61ea5d641aead9d5e /linguistic
parent03f427793b9f61649daa7b030e49e90495243034 (diff)
loplugin:useuniqueptr in SpellCheckerDispatcher
the call to ClearSvcList() was also unnecessary, the map will get cleared by the destructor anyway Change-Id: I24a077143c0cd57b0cfef721169c62f5b283b9c9 Reviewed-on: https://gerrit.libreoffice.org/48739 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'linguistic')
-rw-r--r--linguistic/source/spelldsp.cxx13
-rw-r--r--linguistic/source/spelldsp.hxx6
2 files changed, 8 insertions, 11 deletions
diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx
index 49009b70c3d5..6cd6c8003233 100644
--- a/linguistic/source/spelldsp.cxx
+++ b/linguistic/source/spelldsp.cxx
@@ -185,9 +185,6 @@ SpellCheckerDispatcher::SpellCheckerDispatcher( LngSvcMgr &rLngSvcMgr ) :
SpellCheckerDispatcher::~SpellCheckerDispatcher()
{
- ClearSvcList();
- delete m_pCache;
- delete m_pCharClass;
}
@@ -422,9 +419,9 @@ bool SpellCheckerDispatcher::isValid_Impl(
bRes = !xTmp->isNegative();
} else {
setCharClass(LanguageTag(nLanguage));
- CapType ct = capitalType(aChkWord, m_pCharClass);
+ CapType ct = capitalType(aChkWord, m_pCharClass.get());
if (ct == CapType::INITCAP || ct == CapType::ALLCAP) {
- Reference< XDictionaryEntry > xTmp2( lcl_GetRulingDictionaryEntry( makeLowerCase(aChkWord, m_pCharClass), nLanguage ) );
+ Reference< XDictionaryEntry > xTmp2( lcl_GetRulingDictionaryEntry( makeLowerCase(aChkWord, m_pCharClass.get()), nLanguage ) );
if (xTmp2.is()) {
bRes = !xTmp2->isNegative();
}
@@ -663,10 +660,10 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
else
{
setCharClass(LanguageTag(nLanguage));
- CapType ct = capitalType(aChkWord, m_pCharClass);
+ CapType ct = capitalType(aChkWord, m_pCharClass.get());
if (ct == CapType::INITCAP || ct == CapType::ALLCAP)
{
- Reference< XDictionaryEntry > xTmp2( lcl_GetRulingDictionaryEntry( makeLowerCase(aChkWord, m_pCharClass), nLanguage ) );
+ Reference< XDictionaryEntry > xTmp2( lcl_GetRulingDictionaryEntry( makeLowerCase(aChkWord, m_pCharClass.get()), nLanguage ) );
if (xTmp2.is())
{
if (xTmp2->isNegative()) // negative entry found
@@ -842,7 +839,7 @@ void SpellCheckerDispatcher::FlushSpellCache()
void SpellCheckerDispatcher::setCharClass(const LanguageTag& rLanguageTag)
{
if (!m_pCharClass)
- m_pCharClass = new CharClass(rLanguageTag);
+ m_pCharClass.reset( new CharClass(rLanguageTag) );
m_pCharClass->setLanguageTag(rLanguageTag);
}
diff --git a/linguistic/source/spelldsp.hxx b/linguistic/source/spelldsp.hxx
index 9d165dd87347..d84d11a4513a 100644
--- a/linguistic/source/spelldsp.hxx
+++ b/linguistic/source/spelldsp.hxx
@@ -58,8 +58,8 @@ class SpellCheckerDispatcher :
css::uno::Reference< css::linguistic2::XSearchableDictionaryList > m_xDicList;
LngSvcMgr &m_rMgr;
- mutable linguistic::SpellCache *m_pCache; // Spell Cache (holds known words)
- CharClass *m_pCharClass;
+ mutable std::unique_ptr<linguistic::SpellCache> m_pCache; // Spell Cache (holds known words)
+ std::unique_ptr<CharClass> m_pCharClass;
SpellCheckerDispatcher(const SpellCheckerDispatcher &) = delete;
SpellCheckerDispatcher & operator = (const SpellCheckerDispatcher &) = delete;
@@ -120,7 +120,7 @@ private:
inline linguistic::SpellCache & SpellCheckerDispatcher::GetCache() const
{
if (!m_pCache)
- m_pCache = new linguistic::SpellCache();
+ m_pCache.reset(new linguistic::SpellCache());
return *m_pCache;
}