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>
This commit is contained in:
Noel Grandin 2022-09-21 11:07:00 +02:00
parent bdf346830b
commit da730a3df0
9 changed files with 25 additions and 25 deletions

View file

@ -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) );

View file

@ -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;

View file

@ -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: */

View file

@ -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 );

View file

@ -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 );
}

View file

@ -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: */

View file

@ -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() );

View file

@ -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.;

View file

@ -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;