From 7885c1cb80568930270e55b3ae450eccc66aca94 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 22 Sep 2021 17:17:16 +0200 Subject: Extend loplugin:stringviewparam to starts/endsWith: ucb Change-Id: I086d02ec4a2ea6d4b439ec34665d8271a67c63dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122472 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- ucb/source/ucp/tdoc/tdoc_content.cxx | 11 ++++++----- ucb/source/ucp/tdoc/tdoc_content.hxx | 10 +++++++--- ucb/source/ucp/tdoc/tdoc_provider.cxx | 4 ++-- ucb/source/ucp/tdoc/tdoc_provider.hxx | 8 ++++++-- 4 files changed, 21 insertions(+), 12 deletions(-) (limited to 'ucb/source/ucp/tdoc') diff --git a/ucb/source/ucp/tdoc/tdoc_content.cxx b/ucb/source/ucp/tdoc/tdoc_content.cxx index dcb800ee91c8..5a1335e1efc9 100644 --- a/ucb/source/ucp/tdoc/tdoc_content.cxx +++ b/ucb/source/ucp/tdoc/tdoc_content.cxx @@ -28,6 +28,7 @@ #include +#include #include #include #include @@ -1709,7 +1710,7 @@ void Content::notifyDocumentClosed() uno::Reference< ucb::XContent > -Content::queryChildContent( const OUString & rRelativeChildUri ) +Content::queryChildContent( std::u16string_view rRelativeChildUri ) { osl::Guard< osl::Mutex > aGuard( m_aMutex ); @@ -1717,10 +1718,10 @@ Content::queryChildContent( const OUString & rRelativeChildUri ) OUStringBuffer aBuf( aMyId ); if ( !aMyId.endsWith("/") ) aBuf.append( "/" ); - if ( !rRelativeChildUri.startsWith("/") ) + if ( !o3tl::starts_with(rRelativeChildUri, u"/") ) aBuf.append( rRelativeChildUri ); else - aBuf.append( rRelativeChildUri.subView(1) ); + aBuf.append( rRelativeChildUri.substr(1) ); uno::Reference< ucb::XContentIdentifier > xChildId = new ::ucbhelper::ContentIdentifier( aBuf.makeStringAndClear() ); @@ -1741,7 +1742,7 @@ Content::queryChildContent( const OUString & rRelativeChildUri ) } -void Content::notifyChildRemoved( const OUString & rRelativeChildUri ) +void Content::notifyChildRemoved( std::u16string_view rRelativeChildUri ) { osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex ); @@ -1765,7 +1766,7 @@ void Content::notifyChildRemoved( const OUString & rRelativeChildUri ) } -void Content::notifyChildInserted( const OUString & rRelativeChildUri ) +void Content::notifyChildInserted( std::u16string_view rRelativeChildUri ) { osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex ); diff --git a/ucb/source/ucp/tdoc/tdoc_content.hxx b/ucb/source/ucp/tdoc/tdoc_content.hxx index 56117b1b0853..9a920c1bb376 100644 --- a/ucb/source/ucp/tdoc/tdoc_content.hxx +++ b/ucb/source/ucp/tdoc/tdoc_content.hxx @@ -19,6 +19,10 @@ #pragma once +#include + +#include + #include #include #include "tdoc_provider.hxx" @@ -190,7 +194,7 @@ private: const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv ); css::uno::Reference< css::ucb::XContent > - queryChildContent( const OUString & rRelativeChildUri ); + queryChildContent( std::u16string_view rRelativeChildUri ); /// @throws css::ucb::CommandFailedException /// @throws css::task::DocumentPasswordRequest @@ -266,8 +270,8 @@ public: const OUString& rContentId ); void notifyDocumentClosed(); - void notifyChildRemoved( const OUString & rRelativeChildUri ); - void notifyChildInserted( const OUString & rRelativeChildUri ); + void notifyChildRemoved( std::u16string_view rRelativeChildUri ); + void notifyChildInserted( std::u16string_view rRelativeChildUri ); rtl::Reference< ContentProvider > getContentProvider() const { return rtl::Reference< ContentProvider >( m_pProvider ); } diff --git a/ucb/source/ucp/tdoc/tdoc_provider.cxx b/ucb/source/ucp/tdoc/tdoc_provider.cxx index 93d49ca2108b..23fd324a550b 100644 --- a/ucb/source/ucp/tdoc/tdoc_provider.cxx +++ b/ucb/source/ucp/tdoc/tdoc_provider.cxx @@ -229,7 +229,7 @@ ContentProvider::createDocumentContent( // virtual -void ContentProvider::notifyDocumentClosed( const OUString & rDocId ) +void ContentProvider::notifyDocumentClosed( std::u16string_view rDocId ) { osl::MutexGuard aGuard( getContentListMutex() ); @@ -287,7 +287,7 @@ void ContentProvider::notifyDocumentClosed( const OUString & rDocId ) // virtual -void ContentProvider::notifyDocumentOpened( const OUString & rDocId ) +void ContentProvider::notifyDocumentOpened( std::u16string_view rDocId ) { osl::MutexGuard aGuard( getContentListMutex() ); diff --git a/ucb/source/ucp/tdoc/tdoc_provider.hxx b/ucb/source/ucp/tdoc/tdoc_provider.hxx index 406252ff23d3..44bc239f7c6e 100644 --- a/ucb/source/ucp/tdoc/tdoc_provider.hxx +++ b/ucb/source/ucp/tdoc/tdoc_provider.hxx @@ -19,6 +19,10 @@ #pragma once +#include + +#include + #include #include #include @@ -129,8 +133,8 @@ public: queryDocumentModel( const OUString & rUri ) const; // interface OfficeDocumentsEventListener - void notifyDocumentOpened( const OUString & rDocId ); - void notifyDocumentClosed( const OUString & rDocId ); + void notifyDocumentOpened( std::u16string_view rDocId ); + void notifyDocumentClosed( std::u16string_view rDocId ); private: rtl::Reference< OfficeDocumentsManager > m_xDocsMgr; -- cgit