diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2021-09-22 17:17:16 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2021-09-22 20:00:17 +0200 |
commit | 7885c1cb80568930270e55b3ae450eccc66aca94 (patch) | |
tree | 2aaa0168aedb422dd5c82745024691f952077380 /ucb/source/ucp/tdoc | |
parent | d1e14030e81ff2bbe4bcb3706a9f21672a368074 (diff) |
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 <sbergman@redhat.com>
Diffstat (limited to 'ucb/source/ucp/tdoc')
-rw-r--r-- | ucb/source/ucp/tdoc/tdoc_content.cxx | 11 | ||||
-rw-r--r-- | ucb/source/ucp/tdoc/tdoc_content.hxx | 10 | ||||
-rw-r--r-- | ucb/source/ucp/tdoc/tdoc_provider.cxx | 4 | ||||
-rw-r--r-- | ucb/source/ucp/tdoc/tdoc_provider.hxx | 8 |
4 files changed, 21 insertions, 12 deletions
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 <string_view> +#include <o3tl/string_view.hxx> #include <tools/diagnose_ex.h> #include <rtl/ustrbuf.hxx> #include <com/sun/star/beans/IllegalTypeException.hpp> @@ -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 <sal/config.h> + +#include <string_view> + #include <ucbhelper/contenthelper.hxx> #include <com/sun/star/ucb/XContentCreator.hpp> #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 <sal/config.h> + +#include <string_view> + #include <rtl/ref.hxx> #include <com/sun/star/frame/XTransientDocumentsDocumentContentFactory.hpp> #include <com/sun/star/frame/XTransientDocumentsDocumentContentIdentifierFactory.hpp> @@ -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; |