[Libreoffice-commits] core.git: framework/inc framework/source

Stephan Bergmann sbergman at redhat.com
Thu Apr 7 16:15:17 UTC 2016


 framework/inc/classes/filtercachedata.hxx                 |    6 ++--
 framework/inc/classes/protocolhandlercache.hxx            |    4 +-
 framework/inc/stdtypes.h                                  |   21 --------------
 framework/inc/uiconfiguration/graphicnameaccess.hxx       |    2 -
 framework/inc/uielement/commandinfo.hxx                   |    2 -
 framework/inc/uielement/toolbarmanager.hxx                |    2 -
 framework/source/dispatch/dispatchinformationprovider.cxx |    7 ++--
 framework/source/fwi/classes/protocolhandlercache.cxx     |    4 --
 framework/source/inc/accelerators/acceleratorcache.hxx    |    2 -
 framework/source/inc/accelerators/keymapping.hxx          |    2 -
 framework/source/services/frame.cxx                       |    4 +-
 framework/source/services/pathsettings.cxx                |    2 -
 12 files changed, 17 insertions(+), 41 deletions(-)

New commits:
commit f57c9921de4d64fbe27e80e2e7c13dea23853089
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Apr 7 18:14:32 2016 +0200

    Get rid of BaseHash wrapper (to unbreak Windows build)
    
    Change-Id: Ieae7d6af7a4753958ebf2aeae9d2ae6fafe5efe9

diff --git a/framework/inc/classes/filtercachedata.hxx b/framework/inc/classes/filtercachedata.hxx
index f671678..928ce99 100644
--- a/framework/inc/classes/filtercachedata.hxx
+++ b/framework/inc/classes/filtercachedata.hxx
@@ -85,7 +85,7 @@ struct FileType
             sMediaType.clear();
             sClipboardFormat.clear();
             nDocumentIconID     = 0;
-            lUINames.free   ();
+            lUINames.clear();
             framework::free(lURLPattern);
             framework::free(lExtensions);
         }
@@ -147,7 +147,7 @@ struct Filter
             nFlags              = 0;
             nFileFormatVersion  = 0;
             sTemplateName.clear();
-            lUINames.free();
+            lUINames.clear();
             framework::free(lUserData);
         }
 
@@ -244,7 +244,7 @@ struct Loader
         inline void impl_clear()
         {
             sName.clear();
-            lUINames.free();
+            lUINames.clear();
             framework::free(lTypes);
         }
 
diff --git a/framework/inc/classes/protocolhandlercache.hxx b/framework/inc/classes/protocolhandlercache.hxx
index 9537677..cb9c66a 100644
--- a/framework/inc/classes/protocolhandlercache.hxx
+++ b/framework/inc/classes/protocolhandlercache.hxx
@@ -60,7 +60,7 @@ struct FWI_DLLPUBLIC ProtocolHandler
     uno implementation names as value. Overloading of the index operator makes it possible
     to search for a key by using a full qualified URL on list of all possible pattern keys.
 */
-class FWI_DLLPUBLIC PatternHash : public BaseHash< OUString >
+class FWI_DLLPUBLIC PatternHash : public std::unordered_map<OUString, OUString, OUStringHash>
 {
     /* interface */
     public:
@@ -71,7 +71,7 @@ class FWI_DLLPUBLIC PatternHash : public BaseHash< OUString >
 /**
     This hash holds protocol handler structs by her names.
 */
-typedef BaseHash< ProtocolHandler > HandlerHash;
+typedef std::unordered_map<OUString, ProtocolHandler, OUStringHash> HandlerHash;
 
 /**
     @short          this hash makes it easy to find a protocol handler by using his uno implementation name.
diff --git a/framework/inc/stdtypes.h b/framework/inc/stdtypes.h
index 407ecfa..b87247e 100644
--- a/framework/inc/stdtypes.h
+++ b/framework/inc/stdtypes.h
@@ -88,29 +88,10 @@ void free(std::vector<T>& vec)
 }
 
 /**
-    Basic hash based on a std::unordered_map() which provides key=[OUString] and value=[template type] pairs
-    It implements some additional funtionality which can be useful but
-    is missing at the normal hash implementation.
-*/
-template< class TType >
-class BaseHash : public std::unordered_map< OUString                    ,
-                                            TType                              ,
-                                            OUStringHash >
-{
-    public:
-
-        // the only way to free used memory really!
-        void free()
-        {
-            BaseHash().swap( *this );// get rid of reserved capacity
-        }
-};
-
-/**
     Basic OUString hash.
     Key and values are OUStrings.
 */
-typedef BaseHash< OUString > OUStringHashMap;
+typedef std::unordered_map<OUString, OUString, OUStringHash> OUStringHashMap;
 
 /**
     It can be used to map names (e.g. of properties) to her corresponding handles.
diff --git a/framework/inc/uiconfiguration/graphicnameaccess.hxx b/framework/inc/uiconfiguration/graphicnameaccess.hxx
index b299b84..b18ab5c 100644
--- a/framework/inc/uiconfiguration/graphicnameaccess.hxx
+++ b/framework/inc/uiconfiguration/graphicnameaccess.hxx
@@ -52,7 +52,7 @@ namespace framework
                 throw(css::uno::RuntimeException, std::exception) override;
 
         private:
-            typedef BaseHash< css::uno::Reference< css::graphic::XGraphic > > NameGraphicHashMap;
+            typedef std::unordered_map<OUString, css::uno::Reference< css::graphic::XGraphic >, OUStringHash> NameGraphicHashMap;
             NameGraphicHashMap              m_aNameToElementMap;
             css::uno::Sequence< OUString >  m_aSeq;
     };
diff --git a/framework/inc/uielement/commandinfo.hxx b/framework/inc/uielement/commandinfo.hxx
index a6db494..a322c85 100644
--- a/framework/inc/uielement/commandinfo.hxx
+++ b/framework/inc/uielement/commandinfo.hxx
@@ -35,7 +35,7 @@ struct CommandInfo
     sal_Int16                   nImageInfo;
 };
 
-typedef BaseHash< CommandInfo > CommandToInfoMap;
+typedef std::unordered_map<OUString, CommandInfo, OUStringHash> CommandToInfoMap;
 
 } // namespace framework
 
diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx
index cd912f1..be165b4 100644
--- a/framework/inc/uielement/toolbarmanager.hxx
+++ b/framework/inc/uielement/toolbarmanager.hxx
@@ -153,7 +153,7 @@ class ToolBarManager : public ToolbarManager_Base
     protected:
         typedef std::unordered_map< sal_uInt16, css::uno::Reference< css::frame::XStatusListener > >  ToolBarControllerMap;
         typedef ::std::vector< css::uno::Reference< css::frame::XSubToolbarController > >             SubToolBarControllerVector;
-        typedef BaseHash< SubToolBarControllerVector >                                                SubToolBarToSubToolBarControllerMap;
+        typedef std::unordered_map<OUString, SubToolBarControllerVector, OUStringHash>                                                SubToolBarToSubToolBarControllerMap;
 
         typedef std::unordered_map< sal_uInt16, css::uno::Reference< css::container::XIndexAccess > > MenuDescriptionMap;
 
diff --git a/framework/source/dispatch/dispatchinformationprovider.cxx b/framework/source/dispatch/dispatchinformationprovider.cxx
index 9d0464f..86a8661 100644
--- a/framework/source/dispatch/dispatchinformationprovider.cxx
+++ b/framework/source/dispatch/dispatchinformationprovider.cxx
@@ -79,7 +79,7 @@ css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL DispatchInformati
     sal_Int32                                                                             c1        = lProvider.getLength();
     sal_Int32                                                                             i1        = 0;
 
-    BaseHash< css::frame::DispatchInformation > lInfos;
+    std::unordered_map<OUString, css::frame::DispatchInformation, OUStringHash> lInfos;
 
     for (i1=0; i1<c1; ++i1)
     {
@@ -96,7 +96,7 @@ css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL DispatchInformati
             for (i2=0; i2<c2; ++i2)
             {
                 const css::frame::DispatchInformation&                            rInfo = lProviderInfos[i2];
-                      BaseHash< css::frame::DispatchInformation >::const_iterator pInfo = lInfos.find(rInfo.Command);
+                      auto pInfo = lInfos.find(rInfo.Command);
                 if (pInfo == lInfos.end())
                     lInfos[rInfo.Command] = rInfo;
             }
@@ -111,8 +111,7 @@ css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL DispatchInformati
     i1 = 0;
 
     css::uno::Sequence< css::frame::DispatchInformation >       lReturn(c1);
-    BaseHash< css::frame::DispatchInformation >::const_iterator pStepp;
-    for (  pStepp  = lInfos.begin();
+    for (auto pStepp  = lInfos.begin();
            pStepp != lInfos.end  () && i1<c1;
          ++pStepp, ++i1                      )
     {
diff --git a/framework/source/fwi/classes/protocolhandlercache.cxx b/framework/source/fwi/classes/protocolhandlercache.cxx
index ebbc6e8..ef48ef0 100644
--- a/framework/source/fwi/classes/protocolhandlercache.cxx
+++ b/framework/source/fwi/classes/protocolhandlercache.cxx
@@ -108,8 +108,6 @@ HandlerCache::~HandlerCache()
     if( m_nRefCount==1)
     {
         m_pConfig->setCache(nullptr);
-        m_pHandler->free();
-        m_pPattern->free();
 
         delete m_pConfig;
         delete m_pHandler;
@@ -164,8 +162,6 @@ void HandlerCache::takeOver(HandlerHash* pHandler, PatternHash* pPattern)
     m_pHandler = pHandler;
     m_pPattern = pPattern;
 
-    pOldHandler->free();
-    pOldPattern->free();
     delete pOldHandler;
     delete pOldPattern;
 }
diff --git a/framework/source/inc/accelerators/acceleratorcache.hxx b/framework/source/inc/accelerators/acceleratorcache.hxx
index 07c0cf8..2f59e4f 100644
--- a/framework/source/inc/accelerators/acceleratorcache.hxx
+++ b/framework/source/inc/accelerators/acceleratorcache.hxx
@@ -52,7 +52,7 @@ class AcceleratorCache
             commands -> keys
         */
         typedef ::std::vector< css::awt::KeyEvent > TKeyList;
-        typedef BaseHash< TKeyList > TCommand2Keys;
+        typedef std::unordered_map<OUString, TKeyList, OUStringHash> TCommand2Keys;
 
         /** TODO document me
             keys -> commands
diff --git a/framework/source/inc/accelerators/keymapping.hxx b/framework/source/inc/accelerators/keymapping.hxx
index d51046f..4edc268 100644
--- a/framework/source/inc/accelerators/keymapping.hxx
+++ b/framework/source/inc/accelerators/keymapping.hxx
@@ -52,7 +52,7 @@ class KeyMapping
         };
 
         /** @short  hash structure to map identifier to key codes. */
-        typedef BaseHash< sal_Int16 > Identifier2CodeHash;
+        typedef std::unordered_map<OUString, sal_Int16, OUStringHash> Identifier2CodeHash;
 
         /** @short  hash structure to map key codes to identifier. */
         typedef std::unordered_map< sal_Int16                    ,
diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx
index b24bf35..6a96a39 100644
--- a/framework/source/services/frame.cxx
+++ b/framework/source/services/frame.cxx
@@ -492,7 +492,7 @@ private:
 
     WindowCommandDispatch*                                                  m_pWindowCommandDispatch;
 
-    typedef BaseHash< css::beans::Property > TPropInfoHash;
+    typedef std::unordered_map<OUString, css::beans::Property, OUStringHash> TPropInfoHash;
     TPropInfoHash m_lProps;
 
     ListenerHash m_lSimpleChangeListener;
@@ -3108,7 +3108,7 @@ void SAL_CALL Frame::impl_disablePropertySet()
 
     m_lSimpleChangeListener.disposeAndClear(aEvent);
     m_lVetoChangeListener.disposeAndClear(aEvent);
-    m_lProps.free();
+    m_lProps.clear();
 }
 
 bool Frame::impl_existsVeto(const css::beans::PropertyChangeEvent& aEvent)
diff --git a/framework/source/services/pathsettings.cxx b/framework/source/services/pathsettings.cxx
index 552b2e8..149987d 100644
--- a/framework/source/services/pathsettings.cxx
+++ b/framework/source/services/pathsettings.cxx
@@ -136,7 +136,7 @@ class PathSettings : private cppu::BaseMutex
             bool bIsReadonly;
     };
 
-    typedef BaseHash< PathSettings::PathInfo > PathHash;
+    typedef std::unordered_map<OUString, PathSettings::PathInfo, OUStringHash> PathHash;
 
     enum EChangeOp
     {


More information about the Libreoffice-commits mailing list