diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-09 09:55:12 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-10 12:59:38 +0200 |
commit | e4ff847fe0796420ba8023b70cad8589f5f19e9f (patch) | |
tree | 136786200de69f70dde4190c9725f35fe14b33e0 /sfx2/source | |
parent | 5a89496ffcfcd561b3e595e01f35e0302fa00841 (diff) |
loplugin:stringview check for getToken and trim
since we now have o3tl versions of those that work on
string_view.
Also improve those o3tl functions to support both string_view
and u16string_view
Change-Id: Iacab2996becec62aa78a5597c52d983bb784749a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132755
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/source')
-rw-r--r-- | sfx2/source/appl/newhelp.cxx | 9 | ||||
-rw-r--r-- | sfx2/source/bastyp/mieclip.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/autoredactdialog.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/doc/objmisc.cxx | 3 |
4 files changed, 10 insertions, 7 deletions
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index ff323c78cf78..e175b7458726 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -27,6 +27,7 @@ #include <sal/log.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> +#include <o3tl/string_view.hxx> #include <sfx2/strings.hrc> #include <helpids.h> @@ -220,7 +221,7 @@ void ContentTabPage_Impl::InitRoot() sal_Int32 nIdx = 0; OUString aTitle = aRow.getToken( 0, '\t', nIdx ); OUString aURL = aRow.getToken( 0, '\t', nIdx ); - sal_Unicode cFolder = aRow.getToken( 0, '\t', nIdx )[0]; + sal_Unicode cFolder = o3tl::getToken(aRow, 0, '\t', nIdx )[0]; bool bIsFolder = ( '1' == cFolder ); OUString sId; if (bIsFolder) @@ -259,7 +260,7 @@ IMPL_LINK(ContentTabPage_Impl, ExpandingHdl, const weld::TreeIter&, rIter, bool) sal_Int32 nIdx = 0; OUString aTitle = aRow.getToken( 0, '\t', nIdx ); OUString aURL = aRow.getToken( 0, '\t', nIdx ); - sal_Unicode cFolder = aRow.getToken( 0, '\t', nIdx )[0]; + sal_Unicode cFolder = o3tl::getToken(aRow, 0, '\t', nIdx )[0]; bool bIsFolder = ( '1' == cFolder ); if ( bIsFolder ) { @@ -940,7 +941,7 @@ SearchTabPage_Impl::SearchTabPage_Impl(weld::Widget* pParent, SfxHelpIndexWindow while ( nIdx > 0 ) { m_xSearchED->append_text( INetURLObject::decode( - aUserData.getToken(0, ';', nIdx), + o3tl::getToken(aUserData, 0, ';', nIdx), INetURLObject::DecodeMechanism::WithCharset ) ); } } @@ -2328,7 +2329,7 @@ IMPL_LINK_NOARG(SfxHelpWindow_Impl, OpenHdl, LinkParamNone*, void) { sal_Int32 nIdx{ 0 }; aId = aEntry.getToken( 0, '#', nIdx ); - aAnchor += aEntry.getToken( 0, '#', nIdx ); + aAnchor += o3tl::getToken(aEntry, 0, '#', nIdx ); } else aId = aEntry; diff --git a/sfx2/source/bastyp/mieclip.cxx b/sfx2/source/bastyp/mieclip.cxx index 4d6d74e1fca0..3036b4eb488e 100644 --- a/sfx2/source/bastyp/mieclip.cxx +++ b/sfx2/source/bastyp/mieclip.cxx @@ -43,7 +43,7 @@ SvStream* MSE40HTMLClipFormatObj::IsValid( SvStream& rStream ) rStream.ResetError(); if( rStream.ReadLine( sLine ) && - sLine.getToken( 0, ':', nIndex ) == "Version" ) + o3tl::getToken(sLine, 0, ':', nIndex ) == "Version" ) { while( rStream.ReadLine( sLine ) ) { diff --git a/sfx2/source/doc/autoredactdialog.cxx b/sfx2/source/doc/autoredactdialog.cxx index ea1fa8fb218c..c789538dd4fd 100644 --- a/sfx2/source/doc/autoredactdialog.cxx +++ b/sfx2/source/doc/autoredactdialog.cxx @@ -18,6 +18,7 @@ #include <vcl/svapp.hxx> #include <vcl/weld.hxx> #include <unotools/viewoptions.hxx> +#include <o3tl/string_view.hxx> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> @@ -149,7 +150,7 @@ OUString TargetsTable::GetNameProposal() const RedactionTarget* pTarget = weld::fromId<RedactionTarget*>(m_xControl->get_id(i)); const OUString& sName = pTarget->sName; sal_Int32 nIndex = 0; - if (sName.getToken(0, ' ', nIndex) == sDefaultTargetName) + if (o3tl::getToken(sName, 0, ' ', nIndex) == sDefaultTargetName) { sal_Int32 nCurrTargetId = sName.getToken(0, ' ', nIndex).toInt32(); nHighestTargetId = std::max<sal_Int32>(nHighestTargetId, nCurrTargetId); diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 33c5213d25b1..7d3e2cb8262b 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -27,6 +27,7 @@ #include <svtools/svparser.hxx> #include <cppuhelper/exc_hlp.hxx> #include <sal/log.hxx> +#include <o3tl/string_view.hxx> #include <com/sun/star/awt/XTopWindow.hpp> #include <com/sun/star/beans/XPropertySet.hpp> @@ -1469,7 +1470,7 @@ void SfxHeaderAttributes_Impl::SetAttribute( const SvKeyValue& rKV ) { sal_Int32 nIdx{ 0 }; const sal_Int32 nTime{ aValue.getToken( 0, ';', nIdx ).toInt32() }; - const OUString aURL{ comphelper::string::strip(aValue.getToken( 0, ';', nIdx ), ' ') }; + const OUString aURL{ comphelper::string::strip(o3tl::getToken(aValue, 0, ';', nIdx ), ' ') }; uno::Reference<document::XDocumentProperties> xDocProps( pDoc->getDocProperties()); if( aURL.startsWithIgnoreAsciiCase( "url=" ) ) |