diff options
author | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2016-11-30 16:22:11 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-11-30 21:46:11 +0000 |
commit | 61f61e7723380d3eff0eee21effe0d4dc3f7dad3 (patch) | |
tree | 97c7ab07048a8ab58b1b9f15bd34259992ba07c2 | |
parent | 4430ace32a8dfd534d5e1c64ec7855edad11e5c4 (diff) |
don't hold vector as pointer here ...
and make impl types private
Change-Id: I7ead64bac38da3d813e0b47fa124970937c36617
Reviewed-on: https://gerrit.libreoffice.org/31438
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | include/svl/poolcach.hxx | 18 | ||||
-rw-r--r-- | svl/source/items/poolcach.cxx | 9 |
2 files changed, 11 insertions, 16 deletions
diff --git a/include/svl/poolcach.hxx b/include/svl/poolcach.hxx index 6c55fae31b2c..cfb148d30bd3 100644 --- a/include/svl/poolcach.hxx +++ b/include/svl/poolcach.hxx @@ -27,19 +27,17 @@ class SfxItemSet; class SfxPoolItem; class SfxSetItem; -struct SfxItemModifyImpl -{ - const SfxSetItem *pOrigItem; - SfxSetItem *pPoolItem; -}; - -typedef std::vector<SfxItemModifyImpl> SfxItemModifyArr_Impl; - - class SVL_DLLPUBLIC SfxItemPoolCache { + struct SfxItemModifyImpl + { + const SfxSetItem *pOrigItem; + SfxSetItem *pPoolItem; + }; + typedef std::vector<SfxItemModifyImpl> SfxItemModifyArr_Impl; + SfxItemPool *pPool; - SfxItemModifyArr_Impl *pCache; + SfxItemModifyArr_Impl m_aCache; const SfxItemSet *pSetToPut; const SfxPoolItem *pItemToPut; diff --git a/svl/source/items/poolcach.cxx b/svl/source/items/poolcach.cxx index 947aee32795d..c43d1d50973e 100644 --- a/svl/source/items/poolcach.cxx +++ b/svl/source/items/poolcach.cxx @@ -27,7 +27,6 @@ SfxItemPoolCache::SfxItemPoolCache( SfxItemPool *pItemPool, const SfxPoolItem *pPutItem ): pPool(pItemPool), - pCache(new SfxItemModifyArr_Impl), pSetToPut( nullptr ), pItemToPut( &pItemPool->Put(*pPutItem) ) { @@ -38,7 +37,6 @@ SfxItemPoolCache::SfxItemPoolCache( SfxItemPool *pItemPool, SfxItemPoolCache::SfxItemPoolCache( SfxItemPool *pItemPool, const SfxItemSet *pPutSet ): pPool(pItemPool), - pCache(new SfxItemModifyArr_Impl), pSetToPut( pPutSet ), pItemToPut( nullptr ) { @@ -48,11 +46,10 @@ SfxItemPoolCache::SfxItemPoolCache( SfxItemPool *pItemPool, SfxItemPoolCache::~SfxItemPoolCache() { - for (SfxItemModifyImpl & rImpl : *pCache) { + for (SfxItemModifyImpl & rImpl : m_aCache) { pPool->Remove( *rImpl.pPoolItem ); pPool->Remove( *rImpl.pOrigItem ); } - delete pCache; pCache = nullptr; if ( pItemToPut ) pPool->Remove( *pItemToPut ); @@ -66,7 +63,7 @@ const SfxSetItem& SfxItemPoolCache::ApplyTo( const SfxSetItem &rOrigItem ) "original not in pool" ); // Find whether this Transformations ever occurred - for (SfxItemModifyImpl & rMapEntry : *pCache) + for (SfxItemModifyImpl & rMapEntry : m_aCache) { if ( rMapEntry.pOrigItem == &rOrigItem ) { @@ -102,7 +99,7 @@ const SfxSetItem& SfxItemPoolCache::ApplyTo( const SfxSetItem &rOrigItem ) SfxItemModifyImpl aModify; aModify.pOrigItem = &rOrigItem; aModify.pPoolItem = const_cast<SfxSetItem*>(pNewPoolItem); - pCache->push_back( aModify ); + m_aCache.push_back( aModify ); DBG_ASSERT( !pItemToPut || &pNewPoolItem->GetItemSet().Get( pItemToPut->Which() ) == pItemToPut, |