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

Stephan Bergmann sbergman at redhat.com
Thu Apr 7 19:16:22 UTC 2016


 framework/inc/classes/protocolhandlercache.hxx        |   10 +++-------
 framework/source/fwi/classes/protocolhandlercache.cxx |   12 ++++++++----
 2 files changed, 11 insertions(+), 11 deletions(-)

New commits:
commit 9a2dea064082465ba912391f637d4710ad355a64
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Apr 7 21:15:55 2016 +0200

    dllexport class deriving from template means trouble with MSVC
    
    Change-Id: I9d170168eac26c52fd6ca8d22124e8ff78b81226

diff --git a/framework/inc/classes/protocolhandlercache.hxx b/framework/inc/classes/protocolhandlercache.hxx
index cb9c66a..61896c2 100644
--- a/framework/inc/classes/protocolhandlercache.hxx
+++ b/framework/inc/classes/protocolhandlercache.hxx
@@ -60,13 +60,9 @@ 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 std::unordered_map<OUString, OUString, OUStringHash>
-{
-    /* interface */
-    public:
-
-        PatternHash::iterator findPatternKey( const OUString& sURL );
-};
+typedef std::unordered_map<OUString, OUString, OUStringHash> PatternHash;
+FWI_DLLPUBLIC PatternHash::iterator findPatternKey(
+    PatternHash const & hash, const OUString& sURL);
 
 /**
     This hash holds protocol handler structs by her names.
diff --git a/framework/source/fwi/classes/protocolhandlercache.cxx b/framework/source/fwi/classes/protocolhandlercache.cxx
index ef48ef0..20b26f4 100644
--- a/framework/source/fwi/classes/protocolhandlercache.cxx
+++ b/framework/source/fwi/classes/protocolhandlercache.cxx
@@ -49,10 +49,12 @@ namespace framework{
     @return     An iterator which points to the found item inside the hash or PatternHash::end()
                 if no pattern match this given <var>sURL</var>.
  */
-PatternHash::iterator PatternHash::findPatternKey( const OUString& sURL )
+namespace {
+
+PatternHash::const_iterator findPatternKey(PatternHash const * hash, const OUString& sURL)
 {
-    PatternHash::iterator pItem = this->begin();
-    while( pItem!=this->end() )
+    auto pItem = hash->begin();
+    while( pItem!=hash->end() )
     {
         WildCard aPattern(pItem->first);
         if (aPattern.Matches(sURL))
@@ -62,6 +64,8 @@ PatternHash::iterator PatternHash::findPatternKey( const OUString& sURL )
     return pItem;
 }
 
+}
+
 /**
     @short      initialize static member of class HandlerCache
     @descr      We use a singleton pattern to implement this handler cache.
@@ -131,7 +135,7 @@ bool HandlerCache::search( const OUString& sURL, ProtocolHandler* pReturn ) cons
 
     SolarMutexGuard aGuard;
 
-    PatternHash::const_iterator pItem = m_pPattern->findPatternKey(sURL);
+    PatternHash::const_iterator pItem = findPatternKey(m_pPattern, sURL);
     if (pItem!=m_pPattern->end())
     {
         *pReturn = (*m_pHandler)[pItem->second];


More information about the Libreoffice-commits mailing list