diff options
author | Daniel Sikeler <d.sikeler94@gmail.com> | 2014-09-12 06:17:03 +0000 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-09-18 13:12:48 +0200 |
commit | 32d6415617b5815bb5d18719f6d2df74becc0997 (patch) | |
tree | 55c7b6d7c068bb6eee60aa0a7add60cc6595513b /stoc | |
parent | d311d85a4d501a0bfef20e610169f20de896a167 (diff) |
fdo#83512 Make use of OUStringHash and OStringHash
Change-Id: I33cafe68c798e3d54943ea1790fa4e73f85e525d
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'stoc')
-rw-r--r-- | stoc/source/corereflection/base.hxx | 4 | ||||
-rw-r--r-- | stoc/source/corereflection/lrucache.hxx | 41 | ||||
-rw-r--r-- | stoc/source/inspect/introspection.cxx | 22 | ||||
-rw-r--r-- | stoc/source/namingservice/namingservice.cxx | 15 | ||||
-rw-r--r-- | stoc/source/servicemanager/servicemanager.cxx | 21 |
5 files changed, 25 insertions, 78 deletions
diff --git a/stoc/source/corereflection/base.hxx b/stoc/source/corereflection/base.hxx index 909b182ead58..f49eb74bf6a5 100644 --- a/stoc/source/corereflection/base.hxx +++ b/stoc/source/corereflection/base.hxx @@ -78,9 +78,9 @@ inline typelib_TypeDescription * getTypeByName( const OUString & rName ) } typedef boost::unordered_map< OUString, css::uno::WeakReference< css::reflection::XIdlField >, - FctHashOUString, std::equal_to< OUString > > OUString2Field; + OUStringHash > OUString2Field; typedef boost::unordered_map< OUString, css::uno::WeakReference< css::reflection::XIdlMethod >, - FctHashOUString, std::equal_to< OUString > > OUString2Method; + OUStringHash > OUString2Method; class IdlReflectionServiceImpl diff --git a/stoc/source/corereflection/lrucache.hxx b/stoc/source/corereflection/lrucache.hxx index 740991d9e827..67f351b21033 100644 --- a/stoc/source/corereflection/lrucache.hxx +++ b/stoc/source/corereflection/lrucache.hxx @@ -32,7 +32,7 @@ <br> @author Daniel Boelzle */ -template< class t_Key, class t_Val, class t_KeyHash, class t_KeyEqual > +template< class t_Key, class t_Val, class t_KeyHash > class LRU_Cache { struct CacheEntry @@ -42,7 +42,7 @@ class LRU_Cache CacheEntry * pPred; CacheEntry * pSucc; }; - typedef ::boost::unordered_map< t_Key, CacheEntry *, t_KeyHash, t_KeyEqual > t_Key2Element; + typedef ::boost::unordered_map< t_Key, CacheEntry *, t_KeyHash > t_Key2Element; mutable ::osl::Mutex _aCacheMutex; sal_Int32 _nCachedElements; @@ -89,8 +89,8 @@ public: inline void clear(); }; -template< class t_Key, class t_Val, class t_KeyHash, class t_KeyEqual > -inline LRU_Cache< t_Key, t_Val, t_KeyHash, t_KeyEqual >::LRU_Cache( sal_Int32 nCachedElements ) +template< class t_Key, class t_Val, class t_KeyHash > +inline LRU_Cache< t_Key, t_Val, t_KeyHash >::LRU_Cache( sal_Int32 nCachedElements ) #ifdef __CACHE_DIAGNOSE : _nCachedElements( 4 ) #else @@ -113,14 +113,14 @@ inline LRU_Cache< t_Key, t_Val, t_KeyHash, t_KeyEqual >::LRU_Cache( sal_Int32 nC } } -template< class t_Key, class t_Val, class t_KeyHash, class t_KeyEqual > -inline LRU_Cache< t_Key, t_Val, t_KeyHash, t_KeyEqual >::~LRU_Cache() +template< class t_Key, class t_Val, class t_KeyHash > +inline LRU_Cache< t_Key, t_Val, t_KeyHash >::~LRU_Cache() { delete [] _pBlock; } -template< class t_Key, class t_Val, class t_KeyHash, class t_KeyEqual > -inline void LRU_Cache< t_Key, t_Val, t_KeyHash, t_KeyEqual >::toFront( CacheEntry * pEntry ) const +template< class t_Key, class t_Val, class t_KeyHash > +inline void LRU_Cache< t_Key, t_Val, t_KeyHash >::toFront( CacheEntry * pEntry ) const { if (pEntry != _pHead) { @@ -141,16 +141,16 @@ inline void LRU_Cache< t_Key, t_Val, t_KeyHash, t_KeyEqual >::toFront( CacheEntr } } -template< class t_Key, class t_Val, class t_KeyHash, class t_KeyEqual > -inline bool LRU_Cache< t_Key, t_Val, t_KeyHash, t_KeyEqual >::hasValue( const t_Key & rKey ) const +template< class t_Key, class t_Val, class t_KeyHash > +inline bool LRU_Cache< t_Key, t_Val, t_KeyHash >::hasValue( const t_Key & rKey ) const { ::osl::MutexGuard aGuard( _aCacheMutex ); const typename t_Key2Element::const_iterator iFind( _aKey2Element.find( rKey ) ); return (iFind != _aKey2Element.end()); } -template< class t_Key, class t_Val, class t_KeyHash, class t_KeyEqual > -inline t_Val LRU_Cache< t_Key, t_Val, t_KeyHash, t_KeyEqual >::getValue( const t_Key & rKey ) const +template< class t_Key, class t_Val, class t_KeyHash > +inline t_Val LRU_Cache< t_Key, t_Val, t_KeyHash >::getValue( const t_Key & rKey ) const { ::osl::MutexGuard aGuard( _aCacheMutex ); const typename t_Key2Element::const_iterator iFind( _aKey2Element.find( rKey ) ); @@ -168,8 +168,8 @@ inline t_Val LRU_Cache< t_Key, t_Val, t_KeyHash, t_KeyEqual >::getValue( const t return t_Val(); } -template< class t_Key, class t_Val, class t_KeyHash, class t_KeyEqual > -inline void LRU_Cache< t_Key, t_Val, t_KeyHash, t_KeyEqual >::setValue( +template< class t_Key, class t_Val, class t_KeyHash > +inline void LRU_Cache< t_Key, t_Val, t_KeyHash >::setValue( const t_Key & rKey, const t_Val & rValue ) { ::osl::MutexGuard aGuard( _aCacheMutex ); @@ -206,8 +206,8 @@ inline void LRU_Cache< t_Key, t_Val, t_KeyHash, t_KeyEqual >::setValue( } } -template< class t_Key, class t_Val, class t_KeyHash, class t_KeyEqual > -inline void LRU_Cache< t_Key, t_Val, t_KeyHash, t_KeyEqual >::clear() +template< class t_Key, class t_Val, class t_KeyHash > +inline void LRU_Cache< t_Key, t_Val, t_KeyHash >::clear() { ::osl::MutexGuard aGuard( _aCacheMutex ); _aKey2Element.clear(); @@ -223,16 +223,9 @@ inline void LRU_Cache< t_Key, t_Val, t_KeyHash, t_KeyEqual >::clear() } -struct FctHashOUString : public ::std::unary_function< const OUString &, size_t > -{ - size_t operator()( const OUString & rKey ) const - { return rKey.hashCode(); } -}; - /** Template instance for OUString keys, Any values.<br> */ -typedef LRU_Cache< OUString, css::uno::Any, - FctHashOUString, ::std::equal_to< OUString > > +typedef LRU_Cache< OUString, css::uno::Any, OUStringHash > LRU_CacheAnyByOUString; diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx index 482cb3fd3ca7..2051b08124f8 100644 --- a/stoc/source/inspect/introspection.cxx +++ b/stoc/source/inspect/introspection.cxx @@ -136,28 +136,11 @@ bool isDerivedFrom( Reference<XIdlClass> xToTestClass, Reference<XIdlClass> xDer // part of the new Instance-related ImplIntrospectionAccess // Hashtable for the search of names -struct hashName_Impl -{ - size_t operator()(const OUString& Str) const - { - return (size_t)Str.hashCode(); - } -}; - -struct eqName_Impl -{ - bool operator()(const OUString& Str1, const OUString& Str2) const - { - return ( Str1 == Str2 ); - } -}; - typedef boost::unordered_map < OUString, sal_Int32, - hashName_Impl, - eqName_Impl + OUStringHash > IntrospectionNameMap; @@ -168,8 +151,7 @@ typedef boost::unordered_map < OUString, OUString, - hashName_Impl, - eqName_Impl + OUStringHash > LowerToExactNameMap; diff --git a/stoc/source/namingservice/namingservice.cxx b/stoc/source/namingservice/namingservice.cxx index 171ee9b54ddc..b0b016a87c03 100644 --- a/stoc/source/namingservice/namingservice.cxx +++ b/stoc/source/namingservice/namingservice.cxx @@ -61,24 +61,11 @@ static OUString ns_getImplementationName() return OUString(IMPLNAME); } -struct equalOWString_Impl -{ - bool operator()(const OUString & s1, const OUString & s2) const - { return s1 == s2; } -}; - -struct hashOWString_Impl -{ - size_t operator()(const OUString & rName) const - { return rName.hashCode(); } -}; - typedef boost::unordered_map < OUString, Reference<XInterface >, - hashOWString_Impl, - equalOWString_Impl + OUStringHash > HashMap_OWString_Interface; diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx index d338fa45d303..45d64e13a20b 100644 --- a/stoc/source/servicemanager/servicemanager.cxx +++ b/stoc/source/servicemanager/servicemanager.cxx @@ -290,39 +290,24 @@ Any ImplementationEnumeration_Impl::nextElement() /***************************************************************************** Hash tables *****************************************************************************/ -struct equalOWString_Impl -{ - bool operator()(const OUString & s1, const OUString & s2) const - { return s1 == s2; } -}; - -struct hashOWString_Impl -{ - size_t operator()(const OUString & rName) const - { return rName.hashCode(); } -}; - typedef boost::unordered_set < OUString, - hashOWString_Impl, - equalOWString_Impl + OUStringHash > HashSet_OWString; typedef boost::unordered_multimap < OUString, Reference<XInterface >, - hashOWString_Impl, - equalOWString_Impl + OUStringHash > HashMultimap_OWString_Interface; typedef boost::unordered_map < OUString, Reference<XInterface >, - hashOWString_Impl, - equalOWString_Impl + OUStringHash > HashMap_OWString_Interface; /***************************************************************************** |