diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-10-19 17:18:17 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-10-23 08:15:35 +0200 |
commit | 87a9979c8938b800aab6e35903d60d24892e7f2e (patch) | |
tree | 6beb01f22537e63df24c023ab65d391a7bee0cf6 /include | |
parent | d76c4e5c9aaf8bd27ec97679bcaeba5b18aca493 (diff) |
overload std::hash for OUString and OString
no need to explicitly specify it anymore
Change-Id: I6ad9259cce77201fdd75152533f5151aae83e9ec
Reviewed-on: https://gerrit.libreoffice.org/43567
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
23 files changed, 70 insertions, 34 deletions
diff --git a/include/basic/codecompletecache.hxx b/include/basic/codecompletecache.hxx index 00151e83e3c5..c2b6502e1d55 100644 --- a/include/basic/codecompletecache.hxx +++ b/include/basic/codecompletecache.hxx @@ -28,9 +28,9 @@ #include <unordered_map> #include <vector> -typedef std::unordered_map< OUString, OUString, OUStringHash > CodeCompleteVarTypes; +typedef std::unordered_map< OUString, OUString > CodeCompleteVarTypes; /* variable name, type */ -typedef std::unordered_map< OUString, CodeCompleteVarTypes, OUStringHash > CodeCompleteVarScopes; +typedef std::unordered_map< OUString, CodeCompleteVarTypes > CodeCompleteVarScopes; /* procedure, CodeCompleteVarTypes */ class BASIC_DLLPUBLIC CodeCompleteOptions diff --git a/include/codemaker/generatedtypeset.hxx b/include/codemaker/generatedtypeset.hxx index 21c9d0b1ba2a..e9859f37c999 100644 --- a/include/codemaker/generatedtypeset.hxx +++ b/include/codemaker/generatedtypeset.hxx @@ -61,7 +61,7 @@ private: GeneratedTypeSet(GeneratedTypeSet &) = delete; void operator =(const GeneratedTypeSet&) = delete; - std::unordered_set< OString, OStringHash > m_set; + std::unordered_set< OString > m_set; }; } diff --git a/include/comphelper/PropertyInfoHash.hxx b/include/comphelper/PropertyInfoHash.hxx index da1dddf7e313..1e1374f317dc 100644 --- a/include/comphelper/PropertyInfoHash.hxx +++ b/include/comphelper/PropertyInfoHash.hxx @@ -44,11 +44,9 @@ namespace comphelper } typedef std::unordered_map < OUString, - ::comphelper::PropertyInfo const *, - OUStringHash > PropertyInfoHash; + ::comphelper::PropertyInfo const * > PropertyInfoHash; typedef std::unordered_map < OUString, - ::comphelper::PropertyData*, - OUStringHash > PropertyDataHash; + ::comphelper::PropertyData* > PropertyDataHash; #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/comphelper/sequenceashashmap.hxx b/include/comphelper/sequenceashashmap.hxx index b4b2991948ae..35cdabc9aa76 100644 --- a/include/comphelper/sequenceashashmap.hxx +++ b/include/comphelper/sequenceashashmap.hxx @@ -40,7 +40,7 @@ namespace comphelper{ such name sequences very easy ... */ -using SequenceAsHashMapBase = std::unordered_map<OUString, css::uno::Any, OUStringHash>; +using SequenceAsHashMapBase = std::unordered_map<OUString, css::uno::Any>; class SAL_WARN_UNUSED COMPHELPER_DLLPUBLIC SequenceAsHashMap { diff --git a/include/formula/FormulaCompiler.hxx b/include/formula/FormulaCompiler.hxx index 64e727bbab61..852e996dad79 100644 --- a/include/formula/FormulaCompiler.hxx +++ b/include/formula/FormulaCompiler.hxx @@ -66,8 +66,8 @@ struct FormulaArrayStack }; -typedef std::unordered_map< OUString, OpCode, OUStringHash > OpCodeHashMap; -typedef std::unordered_map< OUString, OUString, OUStringHash > ExternalHashMap; +typedef std::unordered_map< OUString, OpCode > OpCodeHashMap; +typedef std::unordered_map< OUString, OUString > ExternalHashMap; class FORMULA_DLLPUBLIC FormulaCompiler { diff --git a/include/rtl/string.hxx b/include/rtl/string.hxx index c116250aa396..6ea56c3f48e2 100644 --- a/include/rtl/string.hxx +++ b/include/rtl/string.hxx @@ -1912,6 +1912,27 @@ using ::rtl::OStringHash; using ::rtl::OStringLiteral; #endif +/// @cond INTERNAL +/** + Make OString hashable by default for use in STL containers. + + @since LibreOffice 6.0 +*/ +#if defined LIBO_INTERNAL_ONLY +namespace std { + +template<> +struct hash<::rtl::OString> +{ + std::size_t operator()(::rtl::OString const & s) const + { return std::size_t(s.hashCode()); } +}; + +} + +#endif +/// @endcond + #endif // INCLUDED_RTL_STRING_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx index c6ce9a73eb99..96afdc438c83 100644 --- a/include/rtl/ustring.hxx +++ b/include/rtl/ustring.hxx @@ -3703,6 +3703,27 @@ using ::rtl::OUStringLiteral; using ::rtl::OUStringLiteral1; #endif +/// @cond INTERNAL +/** + Make OUString hashable by default for use in STL containers. + + @since LibreOffice 6.0 +*/ +#if defined LIBO_INTERNAL_ONLY +namespace std { + +template<> +struct hash<::rtl::OUString> +{ + std::size_t operator()(::rtl::OUString const & s) const + { return std::size_t(s.hashCode()); } +}; + +} + +#endif +/// @endcond + #endif /* _RTL_USTRING_HXX */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/sidebar/Theme.hxx b/include/sfx2/sidebar/Theme.hxx index ba71420b9f92..31e9a3f3c4a1 100644 --- a/include/sfx2/sidebar/Theme.hxx +++ b/include/sfx2/sidebar/Theme.hxx @@ -189,7 +189,7 @@ private: bool mbIsHighContrastMode; bool mbIsHighContrastModeSetManually; - typedef std::unordered_map<rtl::OUString,ThemeItem, rtl::OUStringHash> PropertyNameToIdMap; + typedef std::unordered_map<rtl::OUString,ThemeItem> PropertyNameToIdMap; PropertyNameToIdMap maPropertyNameToIdMap; typedef std::vector<rtl::OUString> PropertyIdToNameMap; PropertyIdToNameMap maPropertyIdToNameMap; diff --git a/include/svl/IndexedStyleSheets.hxx b/include/svl/IndexedStyleSheets.hxx index e6ae8d18730b..58b3c26a6d63 100644 --- a/include/svl/IndexedStyleSheets.hxx +++ b/include/svl/IndexedStyleSheets.hxx @@ -178,7 +178,7 @@ private: * * @internal * Must be an unordered map. A regular map is too slow for some files. */ - typedef std::unordered_multimap<rtl::OUString, unsigned, rtl::OUStringHash> MapType; + typedef std::unordered_multimap<rtl::OUString, unsigned> MapType; /** A map which stores the positions of style sheets by their name */ MapType mPositionsByName; diff --git a/include/svtools/framestatuslistener.hxx b/include/svtools/framestatuslistener.hxx index 4b521e6e7c6e..f2d4d7594285 100644 --- a/include/svtools/framestatuslistener.hxx +++ b/include/svtools/framestatuslistener.hxx @@ -81,8 +81,7 @@ class SVT_DLLPUBLIC FrameStatusListener : public css::frame::XStatusListener, }; typedef std::unordered_map< OUString, - css::uno::Reference< css::frame::XDispatch >, - OUStringHash > URLToDispatchMap; + css::uno::Reference< css::frame::XDispatch > > URLToDispatchMap; bool m_bDisposed : 1; css::uno::Reference< css::frame::XFrame > m_xFrame; diff --git a/include/svtools/statusbarcontroller.hxx b/include/svtools/statusbarcontroller.hxx index 2df6ac6f1de7..1def30e49f8c 100644 --- a/include/svtools/statusbarcontroller.hxx +++ b/include/svtools/statusbarcontroller.hxx @@ -101,8 +101,7 @@ class SVT_DLLPUBLIC StatusbarController : }; typedef std::unordered_map< OUString, - css::uno::Reference< css::frame::XDispatch >, - OUStringHash > URLToDispatchMap; + css::uno::Reference< css::frame::XDispatch > > URLToDispatchMap; // methods to support status forwarder, known by the old sfx2 toolbox controller implementation void addStatusListener( const OUString& aCommandURL ); diff --git a/include/svtools/toolboxcontroller.hxx b/include/svtools/toolboxcontroller.hxx index a0f3c6bbc8d1..ce6079103c21 100644 --- a/include/svtools/toolboxcontroller.hxx +++ b/include/svtools/toolboxcontroller.hxx @@ -150,8 +150,7 @@ class SVT_DLLPUBLIC ToolboxController : DECL_STATIC_LINK( ToolboxController, ExecuteHdl_Impl, void*, void ); typedef std::unordered_map< OUString, - css::uno::Reference< css::frame::XDispatch >, - OUStringHash > URLToDispatchMap; + css::uno::Reference< css::frame::XDispatch > > URLToDispatchMap; // methods to support status forwarder, known by the old sfx2 toolbox controller implementation void addStatusListener( const OUString& aCommandURL ); diff --git a/include/svx/ShapeTypeHandler.hxx b/include/svx/ShapeTypeHandler.hxx index 9a62f6141e38..53bcd538b836 100644 --- a/include/svx/ShapeTypeHandler.hxx +++ b/include/svx/ShapeTypeHandler.hxx @@ -167,8 +167,7 @@ private: /** This hash map allows the fast look up of a type descriptor for a given service name. */ - typedef std::unordered_map<OUString,ShapeTypeId, - OUStringHash> tServiceNameToSlotId; + typedef std::unordered_map<OUString,ShapeTypeId> tServiceNameToSlotId; mutable tServiceNameToSlotId maServiceNameToSlotId; /** Determine the slot id of the specified shape type. With this id diff --git a/include/svx/sdasitm.hxx b/include/svx/sdasitm.hxx index 8bf5eab3e8b9..3af42c9c19ba 100644 --- a/include/svx/sdasitm.hxx +++ b/include/svx/sdasitm.hxx @@ -41,7 +41,7 @@ private: size_t operator()( const SdrCustomShapeGeometryItem::PropertyPair& ) const; }; typedef std::unordered_map <PropertyPair, sal_Int32, PropertyPairHash> PropertyPairHashMap; - typedef std::unordered_map<OUString, sal_Int32, OUStringHash> PropertyHashMap; + typedef std::unordered_map<OUString, sal_Int32> PropertyHashMap; PropertyHashMap aPropHashMap; PropertyPairHashMap aPropPairHashMap; diff --git a/include/toolkit/controls/eventcontainer.hxx b/include/toolkit/controls/eventcontainer.hxx index 859b06ee45a3..65d0418bdc27 100644 --- a/include/toolkit/controls/eventcontainer.hxx +++ b/include/toolkit/controls/eventcontainer.hxx @@ -36,7 +36,7 @@ class ScriptEventContainer : public ::cppu::WeakImplHelper< css::container::XNameContainer, css::container::XContainer > { - std::unordered_map< OUString, css::uno::Any, OUStringHash> + std::unordered_map< OUString, css::uno::Any> mHashMap; css::uno::Type mType; diff --git a/include/tools/inetmime.hxx b/include/tools/inetmime.hxx index 1c51a4f6a382..75af8b41f1d3 100644 --- a/include/tools/inetmime.hxx +++ b/include/tools/inetmime.hxx @@ -71,7 +71,7 @@ struct INetContentTypeParameter there will only be one item for the complete parameter, with the attribute name lacking any section suffix. */ -typedef std::unordered_map<OString, INetContentTypeParameter, OStringHash> +typedef std::unordered_map<OString, INetContentTypeParameter> INetContentTypeParameterList; diff --git a/include/unotools/fontcfg.hxx b/include/unotools/fontcfg.hxx index 4b388b79ed79..98aa19676294 100644 --- a/include/unotools/fontcfg.hxx +++ b/include/unotools/fontcfg.hxx @@ -108,7 +108,7 @@ class UNOTOOLS_DLLPUBLIC DefaultFontConfiguration mutable css::uno::Reference< css::container::XNameAccess > xAccess; }; - std::unordered_map< OUString, LocaleAccess, OUStringHash > m_aConfig; + std::unordered_map< OUString, LocaleAccess > m_aConfig; OUString tryLocale( const OUString& rBcp47, const OUString& rType ) const; @@ -153,8 +153,8 @@ private: LocaleSubst() : bConfigRead( false ) {} }; - std::unordered_map< OUString, LocaleSubst, OUStringHash > m_aSubst; - typedef std::unordered_set< OUString, OUStringHash > UniqueSubstHash; + std::unordered_map< OUString, LocaleSubst > m_aSubst; + typedef std::unordered_set< OUString > UniqueSubstHash; mutable UniqueSubstHash maSubstHash; void fillSubstVector( const css::uno::Reference< css::container::XNameAccess >& rFont, diff --git a/include/vbahelper/vbaeventshelperbase.hxx b/include/vbahelper/vbaeventshelperbase.hxx index b5c09d83d37f..042ad7439b8f 100644 --- a/include/vbahelper/vbaeventshelperbase.hxx +++ b/include/vbahelper/vbaeventshelperbase.hxx @@ -216,7 +216,7 @@ protected: private: typedef std::map< sal_Int32, EventHandlerInfo > EventHandlerInfoMap; - typedef std::unordered_map< OUString, ModulePathMap, OUStringHash > EventHandlerPathMap; + typedef std::unordered_map< OUString, ModulePathMap > EventHandlerPathMap; EventHandlerInfoMap maEventInfos; EventHandlerPathMap maEventPaths; diff --git a/include/vcl/configsettings.hxx b/include/vcl/configsettings.hxx index 39824188b9b9..50bba28396a0 100644 --- a/include/vcl/configsettings.hxx +++ b/include/vcl/configsettings.hxx @@ -28,7 +28,7 @@ namespace vcl { - typedef std::unordered_map< OUString, OUString, OUStringHash > OUStrMap; + typedef std::unordered_map< OUString, OUString > OUStrMap; class SmallOUStrMap : public OUStrMap { public: SmallOUStrMap() : OUStrMap(1) {} }; @@ -37,7 +37,7 @@ namespace vcl class VCL_DLLPUBLIC SettingsConfigItem : public ::utl::ConfigItem { private: - std::unordered_map< OUString, SmallOUStrMap, OUStringHash > m_aSettings; + std::unordered_map< OUString, SmallOUStrMap > m_aSettings; virtual void Notify( const css::uno::Sequence< OUString >& rPropertyNames ) override; diff --git a/include/vcl/ppdparser.hxx b/include/vcl/ppdparser.hxx index 227c617961d2..a3a04b86fdff 100644 --- a/include/vcl/ppdparser.hxx +++ b/include/vcl/ppdparser.hxx @@ -61,7 +61,7 @@ class VCL_DLLPUBLIC PPDKey friend class PPDParser; friend class CPDManager; - typedef std::unordered_map< OUString, PPDValue, OUStringHash > hash_type; + typedef std::unordered_map< OUString, PPDValue > hash_type; typedef std::vector< PPDValue* > value_type; OUString m_aKey; @@ -123,7 +123,7 @@ class VCL_DLLPUBLIC PPDParser friend class CPDManager; friend class PPDCache; - typedef std::unordered_map< OUString, PPDKey*, OUStringHash > hash_type; + typedef std::unordered_map< OUString, PPDKey* > hash_type; typedef std::vector< PPDKey* > value_type; void insertKey( const OUString& rKey, PPDKey* pKey ); diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index 94e5b9dd6ba0..e25eaa5dd044 100644 --- a/include/vcl/print.hxx +++ b/include/vcl/print.hxx @@ -566,7 +566,7 @@ public: class VCL_DLLPUBLIC PrinterOptionsHelper { protected: - std::unordered_map< OUString, css::uno::Any, OUStringHash > + std::unordered_map< OUString, css::uno::Any > m_aPropertyMap; std::vector< css::beans::PropertyValue > m_aUIProperties; diff --git a/include/xmloff/nmspmap.hxx b/include/xmloff/nmspmap.hxx index 7dd1c002d9fc..f14c82200081 100644 --- a/include/xmloff/nmspmap.hxx +++ b/include/xmloff/nmspmap.hxx @@ -61,7 +61,7 @@ struct QNamePairHash }; typedef std::unordered_map < QNamePair, OUString, QNamePairHash > QNameCache; -typedef std::unordered_map < OUString, ::rtl::Reference <NameSpaceEntry >, OUStringHash > NameSpaceHash; +typedef std::unordered_map < OUString, ::rtl::Reference <NameSpaceEntry > > NameSpaceHash; typedef std::map < sal_uInt16, ::rtl::Reference < NameSpaceEntry > > NameSpaceMap; class XMLOFF_DLLPUBLIC SvXMLNamespaceMap diff --git a/include/xmloff/prstylei.hxx b/include/xmloff/prstylei.hxx index 636e4042f1e6..1fbda3c11f77 100644 --- a/include/xmloff/prstylei.hxx +++ b/include/xmloff/prstylei.hxx @@ -35,7 +35,7 @@ namespace com { namespace sun { namespace star { namespace beans { class XPropertySet; } } } } -typedef std::unordered_set<OUString, OUStringHash> OldFillStyleDefinitionSet; +typedef std::unordered_set<OUString> OldFillStyleDefinitionSet; class XMLOFF_DLLPUBLIC XMLPropStyleContext : public SvXMLStyleContext { |