summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-29 11:06:33 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-05-01 08:30:18 +0200
commit5200a73627d13e2997f81b53f61e143e77e328ee (patch)
treef95c8346d061ecd0ad33d574895d18e169662785 /framework
parentb90d3d316dd9c720c83180b31f6bbd7003fead78 (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')
-rw-r--r--framework/source/jobs/jobdata.cxx2
-rw-r--r--framework/source/services/autorecovery.cxx5
-rw-r--r--framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx17
-rw-r--r--framework/source/uiconfiguration/uiconfigurationmanager.cxx17
-rw-r--r--framework/source/uielement/recentfilesmenucontroller.cxx9
-rw-r--r--framework/source/uielement/toolbarmanager.cxx5
6 files changed, 29 insertions, 26 deletions
diff --git a/framework/source/jobs/jobdata.cxx b/framework/source/jobs/jobdata.cxx
index 974f2630fe84..aad2bfcd4118 100644
--- a/framework/source/jobs/jobdata.cxx
+++ b/framework/source/jobs/jobdata.cxx
@@ -460,7 +460,7 @@ bool JobData::hasCorrectContext(const OUString& rModuleIdent) const
sal_Int32 nIndex = m_sContext.indexOf( rModuleIdent );
if ( nIndex >= 0 && ( nIndex+nModuleIdLen <= nContextLen ))
{
- OUString sContextModule = m_sContext.copy( nIndex, nModuleIdLen );
+ std::u16string_view sContextModule = m_sContext.subView( nIndex, nModuleIdLen );
return sContextModule == rModuleIdent;
}
}
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index 131c104dcba9..2ceffa8dceb7 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -74,6 +74,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <o3tl/safeint.hxx>
#include <o3tl/typed_flags_set.hxx>
+#include <o3tl/string_view.hxx>
#include <unotools/mediadescriptor.hxx>
#include <comphelper/multiinterfacecontainer3.hxx>
#include <comphelper/namedvaluecollection.hxx>
@@ -1837,8 +1838,8 @@ void AutoRecovery::implts_readConfig()
if (pItems[i].startsWith(sRECOVERY_ITEM_BASE_IDENTIFIER))
{
- OUString sID = pItems[i].copy(sRECOVERY_ITEM_BASE_IDENTIFIER.getLength());
- aInfo.ID = sID.toInt32();
+ std::u16string_view sID = pItems[i].subView(sRECOVERY_ITEM_BASE_IDENTIFIER.getLength());
+ aInfo.ID = o3tl::toInt32(sID);
/* SAFE */ {
osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
if (aInfo.ID > m_nIdPool)
diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
index 65ff144913f9..8e1e4dbb2660 100644
--- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
@@ -58,6 +58,7 @@
#include <comphelper/propertyvalue.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <comphelper/servicehelper.hxx>
+#include <o3tl/string_view.hxx>
#include <memory>
#include <mutex>
#include <string_view>
@@ -243,11 +244,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 < ui::UIElementType::COUNT; i++ )
{
if ( aTypeStr == UIELEMENTTYPENAMES[i] )
@@ -375,11 +376,11 @@ void ModuleUIConfigurationManager::impl_preloadUIElementTypeList( Layer eLayer,
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;
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;
diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx
index 74c66e90b9d3..2fbad67becd9 100644
--- a/framework/source/uielement/recentfilesmenucontroller.cxx
+++ b/framework/source/uielement/recentfilesmenucontroller.cxx
@@ -31,6 +31,7 @@
#include <vcl/graph.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
+#include <o3tl/string_view.hxx>
using namespace css;
using namespace com::sun::star::uno;
@@ -383,14 +384,14 @@ void SAL_CALL RecentFilesMenuController::dispatch(
return;
sal_Int32 nAddArgs = aURL.Complete.indexOf( '&', nEntryPos );
- OUString aEntryArg;
+ std::u16string_view aEntryArg;
if ( nAddArgs < 0 )
- aEntryArg = aURL.Complete.copy( nEntryPos );
+ aEntryArg = aURL.Complete.subView( nEntryPos );
else
- aEntryArg = aURL.Complete.copy( nEntryPos, nAddArgs-nEntryPos );
+ aEntryArg = aURL.Complete.subView( nEntryPos, nAddArgs-nEntryPos );
- sal_Int32 nEntry = aEntryArg.toInt32();
+ sal_Int32 nEntry = o3tl::toInt32(aEntryArg);
executeEntry( nEntry );
}
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index 42d6163dcf8b..6c88c57d8b27 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -633,9 +633,8 @@ void ToolBarManager::Init()
// set name for testtool, the useful part is after the last '/'
sal_Int32 idx = m_aResourceName.lastIndexOf('/');
idx++; // will become 0 if '/' not found: use full string
- OString aHelpIdAsString( ".HelpId:" );
- OUString aToolbarName = m_aResourceName.copy( idx );
- aHelpIdAsString += OUStringToOString( aToolbarName, RTL_TEXTENCODING_UTF8 );
+ std::u16string_view aToolbarName = m_aResourceName.subView( idx );
+ OString aHelpIdAsString = ".HelpId" + OUStringToOString( aToolbarName, RTL_TEXTENCODING_UTF8 );
m_pImpl->SetHelpId( aHelpIdAsString );
m_aAsyncUpdateControllersTimer.SetTimeout( 50 );