diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2019-10-06 12:51:15 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-06 18:51:37 +0200 |
commit | 4b28b77eddfe48e709180f1ab81ac0d996796471 (patch) | |
tree | cea69cf628cd91d55e42afaf712b5bae4c0755a2 /include/xmlreader | |
parent | 0a6b9df8c8fc8e97ac627081485613e336051208 (diff) |
we can use Span for the cache key here
Change-Id: I77894e3c5e3d68cb2a12abcc0b09f2c042664ba0
Reviewed-on: https://gerrit.libreoffice.org/80315
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/xmlreader')
-rw-r--r-- | include/xmlreader/span.hxx | 13 | ||||
-rw-r--r-- | include/xmlreader/xmlreader.hxx | 12 |
2 files changed, 19 insertions, 6 deletions
diff --git a/include/xmlreader/span.hxx b/include/xmlreader/span.hxx index 038241ef1133..f56059b96274 100644 --- a/include/xmlreader/span.hxx +++ b/include/xmlreader/span.hxx @@ -77,6 +77,19 @@ struct SAL_WARN_UNUSED OOO_DLLPUBLIC_XMLREADER Span { } rtl::OUString convertFromUtf8() const; + + std::size_t hashCode() const; +}; + +} + +namespace std { + +template<> +struct hash<::xmlreader::Span> +{ + std::size_t operator()(::xmlreader::Span const & s) const + { return s.hashCode(); } }; } diff --git a/include/xmlreader/xmlreader.hxx b/include/xmlreader/xmlreader.hxx index a7f7dbb6d1ce..a553baeb6c3a 100644 --- a/include/xmlreader/xmlreader.hxx +++ b/include/xmlreader/xmlreader.hxx @@ -77,8 +77,8 @@ private: // elements_ and attributes_): struct NamespaceData { - Span const prefix; - int const nsId; + Span prefix; + int nsId; NamespaceData(): nsId(-1) {} @@ -90,9 +90,9 @@ private: typedef std::vector< NamespaceData > NamespaceList; struct ElementData { - Span const name; - NamespaceList::size_type const inheritedNamespaces; - int const defaultNamespaceId; + Span name; + NamespaceList::size_type inheritedNamespaces; + int defaultNamespaceId; ElementData( Span const & theName, @@ -173,7 +173,7 @@ private: void * fileAddress_; NamespaceIris namespaceIris_; NamespaceList namespaces_; - mutable std::unordered_map<OUString, int> cacheNSIds_; + mutable std::unordered_map<Span, int> cacheNSIds_; ElementStack elements_; char const * pos_; char const * end_; |