sdext/source/pdfimport/tree/genericelements.hxx |   19 ++++++-----------
 sdext/source/pdfimport/tree/style.hxx           |    1 
 sdext/source/pdfimport/tree/treevisiting.hxx    |   13 ------------
 svl/source/inc/poolio.hxx                       |    4 +--
 svl/source/items/itempool.cxx                   |   26 ++++++++++++------------
 5 files changed, 22 insertions(+), 41 deletions(-)

New commits:
commit 0c5d286cbe299be356797447cb2b6747c68a015e
Author: Noel Grandin <n...@peralex.com>
Date:   Wed Jun 17 15:41:45 2015 +0200

    rename some types in SfxPoolItemArray_Impl
    
    to make their purpose clearer
    
    Change-Id: I05597f5e69d2e471f08fec545467923378dded74

diff --git a/svl/source/inc/poolio.hxx b/svl/source/inc/poolio.hxx
index b9b5854..7e659430 100644
--- a/svl/source/inc/poolio.hxx
+++ b/svl/source/inc/poolio.hxx
@@ -72,13 +72,13 @@ typedef std::deque< SfxPoolVersion_ImplPtr > 
SfxPoolVersionArr_Impl;
 struct SfxPoolItemArray_Impl: public SfxPoolItemArrayBase_Impl
 {
     typedef std::vector<sal_uInt32> FreeList;
-    typedef std::unordered_map<SfxPoolItem*,sal_uInt32> Hash;
+    typedef std::unordered_map<SfxPoolItem*,sal_uInt32> PoolItemPtrToIndexMap;
 
 public:
     /// Track list of indices into our array that contain an empty slot
     FreeList maFree;
     /// Hash of SfxPoolItem pointer to index into our array that contains that 
slot
-    Hash     maHash;
+    PoolItemPtrToIndexMap     maPtrToIndex;
 
     SfxPoolItemArray_Impl () {}
 
diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx
index 019ab6f..c76d8f4 100644
--- a/svl/source/items/itempool.cxx
+++ b/svl/source/items/itempool.cxx
@@ -688,11 +688,11 @@ const SfxPoolItem& SfxItemPool::Put( const SfxPoolItem& 
rItem, sal_uInt16 nWhich
         // if is already in a pool, then it is worth checking if it is in this 
one.
         if ( IsPooledItem(&rItem) )
         {
-            SfxPoolItemArray_Impl::Hash::const_iterator it;
-            it = pItemArr->maHash.find(const_cast<SfxPoolItem *>(&rItem));
+            SfxPoolItemArray_Impl::PoolItemPtrToIndexMap::const_iterator it;
+            it = pItemArr->maPtrToIndex.find(const_cast<SfxPoolItem 
*>(&rItem));
 
             // 1. search for an identical pointer in the pool
-            if (it != pItemArr->maHash.end())
+            if (it != pItemArr->maPtrToIndex.end())
             {
                 AddRef(rItem);
                 return rItem;
@@ -755,17 +755,17 @@ const SfxPoolItem& SfxItemPool::Put( const SfxPoolItem& 
rItem, sal_uInt16 nWhich
     AddRef( *pNewItem, pImp->nInitRefCount );
 
     // 4. finally insert into the pointer array
-    assert( pItemArr->maHash.find(pNewItem) == pItemArr->maHash.end() );
+    assert( pItemArr->maPtrToIndex.find(pNewItem) == 
pItemArr->maPtrToIndex.end() );
     if ( !ppFreeIsSet )
     {
         sal_uInt32 nOffset = pItemArr->size();
-        pItemArr->maHash.insert(std::make_pair(pNewItem, nOffset));
+        pItemArr->maPtrToIndex.insert(std::make_pair(pNewItem, nOffset));
         pItemArr->push_back( pNewItem );
     }
     else
     {
         sal_uInt32 nOffset = std::distance(pItemArr->begin(), ppFree);
-        pItemArr->maHash.insert(std::make_pair(pNewItem, nOffset));
+        pItemArr->maPtrToIndex.insert(std::make_pair(pNewItem, nOffset));
         assert(*ppFree == NULL);
         *ppFree = pNewItem;
     }
@@ -776,7 +776,7 @@ const SfxPoolItem& SfxItemPool::Put( const SfxPoolItem& 
rItem, sal_uInt16 nWhich
 void SfxPoolItemArray_Impl::ReHash()
 {
     maFree.clear();
-    maHash.clear();
+    maPtrToIndex.clear();
 
     for (size_t nIdx = 0; nIdx < size(); ++nIdx)
     {
@@ -785,8 +785,8 @@ void SfxPoolItemArray_Impl::ReHash()
             maFree.push_back(nIdx);
         else
         {
-            maHash.insert(std::make_pair(pItem,nIdx));
-            assert(maHash.find(pItem) != maHash.end());
+            maPtrToIndex.insert(std::make_pair(pItem,nIdx));
+            assert(maPtrToIndex.find(pItem) != maPtrToIndex.end());
         }
     }
 }
@@ -835,9 +835,9 @@ void SfxItemPool::Remove( const SfxPoolItem& rItem )
     SfxPoolItemArray_Impl* pItemArr = pImp->maPoolItems[nIndex];
     SFX_ASSERT( pItemArr, rItem.Which(), "removing Item not in Pool" );
 
-    SfxPoolItemArray_Impl::Hash::iterator it;
-    it = pItemArr->maHash.find(const_cast<SfxPoolItem *>(&rItem));
-    if (it != pItemArr->maHash.end())
+    SfxPoolItemArray_Impl::PoolItemPtrToIndexMap::iterator it;
+    it = pItemArr->maPtrToIndex.find(const_cast<SfxPoolItem *>(&rItem));
+    if (it != pItemArr->maPtrToIndex.end())
     {
         sal_uInt32 nIdx = it->second;
         assert(nIdx < pItemArr->size());
@@ -858,7 +858,7 @@ void SfxItemPool::Remove( const SfxPoolItem& rItem )
             DELETEZ(p);
 
             // remove ourselves from the hash
-            pItemArr->maHash.erase(it);
+            pItemArr->maPtrToIndex.erase(it);
 
             // record that this slot is free
             pItemArr->maFree.push_back( nIdx );
commit 4c1926f34ec038b1566081f98b12f0a0d900d1cf
Author: Noel Grandin <n...@peralex.com>
Date:   Mon Jun 15 16:41:32 2015 +0200

    the ElementTreeVisitable interface is doing nothing useful
    
    Change-Id: I89e8fb90de8aadce89a8f5e353a923c972e1569f

diff --git a/sdext/source/pdfimport/tree/genericelements.hxx 
b/sdext/source/pdfimport/tree/genericelements.hxx
index c91d11d..f1b9d34 100644
--- a/sdext/source/pdfimport/tree/genericelements.hxx
+++ b/sdext/source/pdfimport/tree/genericelements.hxx
@@ -70,7 +70,7 @@ namespace pdfi
             css::uno::XComponentContext >  m_xContext;
     };
 
-    struct Element : public ElementTreeVisitable
+    struct Element
     {
     protected:
         Element( Element* pParent )
@@ -83,6 +83,11 @@ namespace pdfi
     public:
         virtual ~Element();
 
+        /**
+            To be implemented by every tree node that needs to be
+            visitable.
+         */
+        virtual void visitedBy( ElementTreeVisitor&, const std::list< Element* 
>::const_iterator& rParentIt ) = 0;
         /// Apply visitor to all children
         void applyToChildren( ElementTreeVisitor& );
         /// Union element geometry with given element
@@ -106,7 +111,6 @@ namespace pdfi
     struct ListElement : public Element
     {
         ListElement() : Element( NULL ) {}
-        // ElementTreeVisitable
         virtual void visitedBy( ElementTreeVisitor&, const std::list< Element* 
>::const_iterator& ) SAL_OVERRIDE;
     };
 
@@ -117,7 +121,6 @@ namespace pdfi
         HyperlinkElement( Element* pParent, const OUString& rURI )
         : Element( pParent ), URI( rURI ) {}
     public:
-        // ElementTreeVisitable
         virtual void visitedBy( ElementTreeVisitor&, const std::list< Element* 
>::const_iterator& ) SAL_OVERRIDE;
 
         OUString URI;
@@ -163,7 +166,6 @@ namespace pdfi
         : DrawElement( pParent, nGCId ) {}
 
     public:
-        // ElementTreeVisitable
         virtual void visitedBy( ElementTreeVisitor&, const std::list< Element* 
>::const_iterator& ) SAL_OVERRIDE;
     };
 
@@ -175,7 +177,6 @@ namespace pdfi
         : GraphicalElement( pParent, nGCId ), FontId( nFontId ) {}
 
     public:
-        // ElementTreeVisitable
         virtual void visitedBy( ElementTreeVisitor&, const std::list< Element* 
>::const_iterator& ) SAL_OVERRIDE;
 
         OUStringBuffer Text;
@@ -189,7 +190,6 @@ namespace pdfi
         ParagraphElement( Element* pParent ) : Element( pParent ), Type( 
Normal ), bRtl( false ) {}
 
     public:
-        // ElementTreeVisitable
         virtual void visitedBy( ElementTreeVisitor&, const std::list< Element* 
>::const_iterator& rParentIt ) SAL_OVERRIDE;
 
         // returns true only if only a single line is contained
@@ -213,7 +213,6 @@ namespace pdfi
                          const basegfx::B2DPolyPolygon& rPolyPoly,
                          sal_Int8 nAction );
     public:
-        // ElementTreeVisitable
         virtual void visitedBy( ElementTreeVisitor&, const std::list< Element* 
>::const_iterator& rParentIt ) SAL_OVERRIDE;
 
         void updateGeometry();
@@ -234,7 +233,6 @@ namespace pdfi
         : DrawElement( pParent, nGCId ), Image( nImage ) {}
 
     public:
-        // ElementTreeVisitable
         virtual void visitedBy( ElementTreeVisitor&, const std::list< Element* 
>::const_iterator& ) SAL_OVERRIDE;
 
         ImageId Image;
@@ -252,10 +250,9 @@ namespace pdfi
     private:
         // helper method for resolveHyperlinks
         bool resolveHyperlink( std::list<Element*>::iterator link_it, 
std::list<Element*>& rElements );
-        public:
+    public:
         virtual ~PageElement();
 
-        // ElementTreeVisitable
         virtual void visitedBy( ElementTreeVisitor&, const std::list< Element* 
>::const_iterator& rParentIt ) SAL_OVERRIDE;
 
         void emitPageAnchoredElements( EmitContext& rEmitContext );
@@ -282,9 +279,7 @@ namespace pdfi
     public:
         virtual ~DocumentElement();
 
-        // ElementTreeVisitable
         virtual void visitedBy( ElementTreeVisitor&, const std::list< Element* 
>::const_iterator& ) SAL_OVERRIDE;
-
     };
 
     // this class is the differentiator of document types: it will create
diff --git a/sdext/source/pdfimport/tree/style.hxx 
b/sdext/source/pdfimport/tree/style.hxx
index 2b2e0a1..d29cf8e 100644
--- a/sdext/source/pdfimport/tree/style.hxx
+++ b/sdext/source/pdfimport/tree/style.hxx
@@ -31,7 +31,6 @@ namespace pdfi
 {
     struct Element;
     struct EmitContext;
-    struct ElementTreeVisitable;
 
     class StyleContainer
     {
diff --git a/sdext/source/pdfimport/tree/treevisiting.hxx 
b/sdext/source/pdfimport/tree/treevisiting.hxx
index 35217f8..d19eafc 100644
--- a/sdext/source/pdfimport/tree/treevisiting.hxx
+++ b/sdext/source/pdfimport/tree/treevisiting.hxx
@@ -55,19 +55,6 @@ namespace pdfi
     };
     typedef boost::shared_ptr<ElementTreeVisitor> ElementTreeVisitorSharedPtr;
 
-    /** Visitee interface
-
-        To be implemented by every tree node that needs to be
-        visitable.
-     */
-    struct ElementTreeVisitable
-    {
-        virtual void visitedBy( ElementTreeVisitor&, const std::list< Element* 
>::const_iterator& rParentIt ) = 0;
-
-    protected:
-        ~ElementTreeVisitable() {}
-    };
-    typedef boost::shared_ptr<ElementTreeVisitable> 
ElementTreeVisitableSharedPtr;
 }
 
 #endif
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to