diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-09-21 11:07:00 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-09-21 14:21:28 +0200 |
commit | da730a3df0dd8a8b1ac0eca09ccc9bba04830802 (patch) | |
tree | a1181a2d9f70a43568919ba8e97f897977c64ce7 | |
parent | bdf346830b735aa484fba0df94be71fd1ea5cdfd (diff) |
use more string_view in svtools
Change-Id: Id0317c400d7bc868916b97cd1c7abae04c4a9e30
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140335
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | cui/source/options/doclinkdialog.cxx | 2 | ||||
-rw-r--r-- | fpicker/source/office/fileview.cxx | 6 | ||||
-rw-r--r-- | include/svtools/inettbc.hxx | 2 | ||||
-rw-r--r-- | include/svtools/popupmenucontrollerbase.hxx | 2 | ||||
-rw-r--r-- | include/svtools/rtfout.hxx | 2 | ||||
-rw-r--r-- | include/svtools/urlfilter.hxx | 2 | ||||
-rw-r--r-- | svtools/source/control/inettbc.cxx | 11 | ||||
-rw-r--r-- | svtools/source/svrtf/rtfout.cxx | 4 | ||||
-rw-r--r-- | svtools/source/uno/popupmenucontrollerbase.cxx | 19 |
9 files changed, 25 insertions, 25 deletions
diff --git a/cui/source/options/doclinkdialog.cxx b/cui/source/options/doclinkdialog.cxx index 4218a18a1a04..fac99002401c 100644 --- a/cui/source/options/doclinkdialog.cxx +++ b/cui/source/options/doclinkdialog.cxx @@ -51,7 +51,7 @@ namespace svx m_xURL->SetSmartProtocol(INetProtocol::File); m_xURL->DisableHistory(); - m_xURL->SetFilter("*.odb"); + m_xURL->SetFilter(u"*.odb"); m_xName->connect_changed( LINK(this, ODocumentLinkDialog, OnEntryModified) ); m_xURL->connect_changed( LINK(this, ODocumentLinkDialog, OnComboBoxModified) ); diff --git a/fpicker/source/office/fileview.cxx b/fpicker/source/office/fileview.cxx index e6ce2abc9405..ac8ea43b55cd 100644 --- a/fpicker/source/office/fileview.cxx +++ b/fpicker/source/office/fileview.cxx @@ -295,7 +295,7 @@ public: const FolderDescriptor& _rFolder, const FileViewAsyncAction* pAsyncDescriptor, const css::uno::Sequence< OUString >& rDenyList ); - void FilterFolderContent_Impl( const OUString &rFilter ); + void FilterFolderContent_Impl( std::u16string_view rFilter ); void CancelRunningAsyncAction(); void OpenFolder_Impl(); @@ -1286,9 +1286,9 @@ FileViewResult SvtFileView_Impl::GetFolderContent_Impl( return eFailure; } -void SvtFileView_Impl::FilterFolderContent_Impl( const OUString &rFilter ) +void SvtFileView_Impl::FilterFolderContent_Impl( std::u16string_view rFilter ) { - if ( rFilter.isEmpty() || ( rFilter == ALL_FILES_FILTER ) ) + if ( rFilter.empty() || ( rFilter == ALL_FILES_FILTER ) ) // when replacing names, there is always something to filter (no view of ".nametranslation.table") return; diff --git a/include/svtools/inettbc.hxx b/include/svtools/inettbc.hxx index 1789440f6799..6e613072bd64 100644 --- a/include/svtools/inettbc.hxx +++ b/include/svtools/inettbc.hxx @@ -101,7 +101,7 @@ public: return (!aPlaceHolder.isEmpty() && aPlaceHolder == sToMatch); } - void SetFilter(const OUString& _sFilter); + void SetFilter(std::u16string_view _sFilter); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svtools/popupmenucontrollerbase.hxx b/include/svtools/popupmenucontrollerbase.hxx index 6ce19444aa51..ef365a876592 100644 --- a/include/svtools/popupmenucontrollerbase.hxx +++ b/include/svtools/popupmenucontrollerbase.hxx @@ -105,7 +105,7 @@ namespace svt static void resetPopupMenu( css::uno::Reference< css::awt::XPopupMenu > const & rPopupMenu ); virtual void impl_setPopupMenu(); - static OUString determineBaseURL( const OUString& aURL ); + static OUString determineBaseURL( std::u16string_view aURL ); DECL_DLLPRIVATE_STATIC_LINK( PopupMenuControllerBase, ExecuteHdl_Impl, void*, void ); diff --git a/include/svtools/rtfout.hxx b/include/svtools/rtfout.hxx index 50b738836557..08d81514dc3d 100644 --- a/include/svtools/rtfout.hxx +++ b/include/svtools/rtfout.hxx @@ -29,7 +29,7 @@ class SvStream; namespace RTFOutFuncs { SVT_DLLPUBLIC SvStream& Out_String( - SvStream&, const OUString&, + SvStream&, std::u16string_view, rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252 ); } diff --git a/include/svtools/urlfilter.hxx b/include/svtools/urlfilter.hxx index e62902d34d4f..ff7c6429792f 100644 --- a/include/svtools/urlfilter.hxx +++ b/include/svtools/urlfilter.hxx @@ -36,7 +36,7 @@ public: return _rMatcher.Matches( m_rCompareString ); } - static void createWildCardFilterList(const OUString& _rFilterList,::std::vector< WildCard >& _rFilters); + static void createWildCardFilterList(std::u16string_view _rFilterList,::std::vector< WildCard >& _rFilters); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx index cfecf910f94b..0ffad5414c08 100644 --- a/svtools/source/control/inettbc.cxx +++ b/svtools/source/control/inettbc.cxx @@ -40,6 +40,7 @@ #include <comphelper/string.hxx> #include <salhelper/thread.hxx> #include <tools/debug.hxx> +#include <o3tl/string_view.hxx> #include <osl/file.hxx> #include <osl/mutex.hxx> #include <unotools/historyoptions.hxx> @@ -76,7 +77,7 @@ public: SvtURLBox_Impl( ) { - FilterMatch::createWildCardFilterList(OUString(),m_aFilters); + FilterMatch::createWildCardFilterList(u"",m_aFilters); } }; @@ -1079,22 +1080,22 @@ void SvtURLBox::DisableHistory() UpdatePicklistForSmartProtocol_Impl(); } -void SvtURLBox::SetFilter(const OUString& _sFilter) +void SvtURLBox::SetFilter(std::u16string_view _sFilter) { pImpl->m_aFilters.clear(); FilterMatch::createWildCardFilterList(_sFilter,pImpl->m_aFilters); } -void FilterMatch::createWildCardFilterList(const OUString& _rFilterList,::std::vector< WildCard >& _rFilters) +void FilterMatch::createWildCardFilterList(std::u16string_view _rFilterList,::std::vector< WildCard >& _rFilters) { - if( _rFilterList.getLength() ) + if( !_rFilterList.empty() ) { // filter is given sal_Int32 nIndex = 0; OUString sToken; do { - sToken = _rFilterList.getToken( 0, ';', nIndex ); + sToken = o3tl::getToken(_rFilterList, 0, ';', nIndex ); if ( !sToken.isEmpty() ) { _rFilters.emplace_back( sToken.toAsciiUpperCase() ); diff --git a/svtools/source/svrtf/rtfout.cxx b/svtools/source/svrtf/rtfout.cxx index b06a04eedfa0..7a8f0e252002 100644 --- a/svtools/source/svrtf/rtfout.cxx +++ b/svtools/source/svrtf/rtfout.cxx @@ -178,11 +178,11 @@ SvStream& Out_Char(SvStream& rStream, sal_Unicode c, } -SvStream& RTFOutFuncs::Out_String( SvStream& rStream, const OUString& rStr, +SvStream& RTFOutFuncs::Out_String( SvStream& rStream, std::u16string_view rStr, rtl_TextEncoding eDestEnc) { int nUCMode = 1; - for (sal_Int32 n = 0; n < rStr.getLength(); ++n) + for (size_t n = 0; n < rStr.size(); ++n) Out_Char(rStream, rStr[n], &nUCMode, eDestEnc); if (nUCMode != 1) rStream.WriteCharPtr( "\\uc1" ).WriteCharPtr( " " ); // #i47831# add an additional whitespace, so that "document whitespaces" are not ignored.; diff --git a/svtools/source/uno/popupmenucontrollerbase.cxx b/svtools/source/uno/popupmenucontrollerbase.cxx index 167548d0407c..b4a4cbdc8bda 100644 --- a/svtools/source/uno/popupmenucontrollerbase.cxx +++ b/svtools/source/uno/popupmenucontrollerbase.cxx @@ -276,21 +276,20 @@ void SAL_CALL PopupMenuControllerBase::removeStatusListener( rBHelper.removeListener( cppu::UnoType<decltype(xControl)>::get(), xControl ); } -OUString PopupMenuControllerBase::determineBaseURL( const OUString& aURL ) +OUString PopupMenuControllerBase::determineBaseURL( std::u16string_view aURL ) { // Just use the main part of the URL for popup menu controllers - sal_Int32 nSchemePart( 0 ); OUString aMainURL( "vnd.sun.star.popup:" ); - nSchemePart = aURL.indexOf( ':' ); - if (( nSchemePart > 0 ) && - ( aURL.getLength() > ( nSchemePart+1 ))) + size_t nSchemePart = aURL.find( ':' ); + if (( nSchemePart != std::u16string_view::npos && nSchemePart > 0 ) && + ( aURL.size() > ( nSchemePart+1 ))) { - sal_Int32 nQueryPart = aURL.indexOf( '?', nSchemePart ); - if ( nQueryPart > 0 ) - aMainURL += aURL.subView( nSchemePart, nQueryPart-nSchemePart ); - else if ( nQueryPart == -1 ) - aMainURL += aURL.subView( nSchemePart+1 ); + size_t nQueryPart = aURL.find( '?', nSchemePart ); + if ( nQueryPart != std::u16string_view::npos && nQueryPart > 0 ) + aMainURL += aURL.substr( nSchemePart, nQueryPart-nSchemePart ); + else if ( nQueryPart == std::u16string_view::npos ) + aMainURL += aURL.substr( nSchemePart+1 ); } return aMainURL; |