[Libreoffice-commits] core.git: include/svl svl/source
Jochen Nitschke
j.nitschke+logerrit at ok.de
Wed Nov 30 21:46:37 UTC 2016
include/svl/poolcach.hxx | 18 ++++++++----------
svl/source/items/poolcach.cxx | 9 +++------
2 files changed, 11 insertions(+), 16 deletions(-)
New commits:
commit 61f61e7723380d3eff0eee21effe0d4dc3f7dad3
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date: Wed Nov 30 16:22:11 2016 +0100
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 at libreoffice.org>
Reviewed-by: Michael Stahl <mstahl at redhat.com>
diff --git a/include/svl/poolcach.hxx b/include/svl/poolcach.hxx
index 6c55fae..cfb148d 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 947aee32..c43d1d5 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,
More information about the Libreoffice-commits
mailing list