From 28dc1e713cfc5b5ea38e15f032aba72d05e40b33 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 27 Jul 2022 17:56:28 +0200 Subject: tdf#119840 remove some OUString allocation Change-Id: I488db37b3a60feb351d1ecd46278f6d5c3cdde5b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137535 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sax/source/tools/fastattribs.cxx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sax/source') diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx index 81dabf727ebd..3522f38f3ef5 100644 --- a/sax/source/tools/fastattribs.cxx +++ b/sax/source/tools/fastattribs.cxx @@ -263,6 +263,13 @@ const char* FastAttributeList::getAsCharByIndex( sal_Int32 nTokenIndex ) const return mpChunk + nOffset; } +std::string_view FastAttributeList::getAsViewByIndex( sal_Int32 nTokenIndex ) const +{ + sal_Int32 nOffset = maAttributeValues[nTokenIndex]; + size_t nValueLen = maAttributeValues[nTokenIndex + 1] - maAttributeValues[nTokenIndex] - 1; + return { mpChunk + nOffset, nValueLen }; +} + OUString FastAttributeList::getValue( ::sal_Int32 Token ) { for (size_t i = 0, n = maAttributeTokens.size(); i < n; ++i) -- cgit v1.2.3