diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-29 11:06:33 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-01 08:30:18 +0200 |
commit | 5200a73627d13e2997f81b53f61e143e77e328ee (patch) | |
tree | f95c8346d061ecd0ad33d574895d18e169662785 /framework/source/uiconfiguration/uiconfigurationmanager.cxx | |
parent | b90d3d316dd9c720c83180b31f6bbd7003fead78 (diff) |
use more string_view in various
found by examining uses of OUString::copy() for likely places
Change-Id: I6ff20e7b273ad6005410b82719183c1122f8c018
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133617
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework/source/uiconfiguration/uiconfigurationmanager.cxx')
-rw-r--r-- | framework/source/uiconfiguration/uiconfigurationmanager.cxx | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx index b3b443b99d5c..3e7cbd74b44f 100644 --- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx @@ -53,6 +53,7 @@ #include <comphelper/servicehelper.hxx> #include <vcl/svapp.hxx> #include <sal/log.hxx> +#include <o3tl/string_view.hxx> #include <mutex> #include <string_view> @@ -220,11 +221,11 @@ sal_Int16 RetrieveTypeFromResourceURL( const OUString& aResourceURL ) if (( aResourceURL.startsWith( RESOURCEURL_PREFIX ) ) && ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE )) { - OUString aTmpStr = aResourceURL.copy( RESOURCEURL_PREFIX_SIZE ); - sal_Int32 nIndex = aTmpStr.indexOf( '/' ); - if (( nIndex > 0 ) && ( aTmpStr.getLength() > nIndex )) + std::u16string_view aTmpStr = aResourceURL.subView( RESOURCEURL_PREFIX_SIZE ); + size_t nIndex = aTmpStr.find( '/' ); + if (( nIndex > 0 ) && ( aTmpStr.size() > nIndex )) { - OUString aTypeStr( aTmpStr.copy( 0, nIndex )); + std::u16string_view aTypeStr( aTmpStr.substr( 0, nIndex )); for ( int i = 0; i < UIElementType::COUNT; i++ ) { if ( aTypeStr == UIELEMENTTYPENAMES[i] ) @@ -300,11 +301,11 @@ void UIConfigurationManager::impl_preloadUIElementTypeList( sal_Int16 nElementTy sal_Int32 nIndex = rElementName.lastIndexOf( '.' ); if (( nIndex > 0 ) && ( nIndex < rElementName.getLength() )) { - OUString aExtension( rElementName.copy( nIndex+1 )); - OUString aUIElementName( rElementName.copy( 0, nIndex )); + std::u16string_view aExtension( rElementName.subView( nIndex+1 )); + std::u16string_view aUIElementName( rElementName.subView( 0, nIndex )); - if (!aUIElementName.isEmpty() && - ( aExtension.equalsIgnoreAsciiCase("xml"))) + if (!aUIElementName.empty() && + ( o3tl::equalsIgnoreAsciiCase(aExtension, u"xml"))) { aUIElementData.aResourceURL = aResURLPrefix + aUIElementName; aUIElementData.aName = rElementName; |