summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-12 12:43:11 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-13 08:38:53 +0200
commitfdfd517a6f75e394ddcb1e195decbfed33ba56b9 (patch)
treee3bff14e5531affcd908415b4e85d7ceac4aa1fd /cui
parente568c9dca8b93b96a8a130a8fb6f1bba1a33d6ea (diff)
loplugin:stringviewparam whitelist some more functions
for which we have o3tl:: equivalents Change-Id: I4670fd8b703ac47214be213f41e88d1c6ede7032 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132913 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/dialogs/cuifmsearch.cxx7
-rw-r--r--cui/source/dialogs/multipat.cxx13
-rw-r--r--cui/source/inc/cuifmsearch.hxx2
-rw-r--r--cui/source/inc/multipat.hxx4
-rw-r--r--cui/source/inc/optpath.hxx2
-rw-r--r--cui/source/options/optaboutconfig.cxx5
-rw-r--r--cui/source/options/optaboutconfig.hxx2
-rw-r--r--cui/source/options/optpath.cxx10
8 files changed, 24 insertions, 21 deletions
diff --git a/cui/source/dialogs/cuifmsearch.cxx b/cui/source/dialogs/cuifmsearch.cxx
index 18f9cae66536..f1af2838c4b8 100644
--- a/cui/source/dialogs/cuifmsearch.cxx
+++ b/cui/source/dialogs/cuifmsearch.cxx
@@ -31,6 +31,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
#include <svx/svxdlg.hxx>
+#include <o3tl/string_view.hxx>
using namespace css::uno;
using namespace css::i18n;
@@ -159,7 +160,7 @@ FmSearchDialog::~FmSearchDialog()
m_pSearchEngine.reset();
}
-void FmSearchDialog::Init(const OUString& strVisibleFields, const OUString& sInitialText)
+void FmSearchDialog::Init(std::u16string_view strVisibleFields, const OUString& sInitialText)
{
//the initialization of all the Controls
m_prbSearchForText->connect_toggled(LINK(this, FmSearchDialog, OnToggledSearchRadio));
@@ -203,11 +204,11 @@ void FmSearchDialog::Init(const OUString& strVisibleFields, const OUString& sIni
m_plbPosition->set_active(MATCHING_ANYWHERE);
// the field listbox
- if (!strVisibleFields.isEmpty())
+ if (!strVisibleFields.empty())
{
sal_Int32 nPos {0};
do {
- m_plbField->append_text(strVisibleFields.getToken(0, ';', nPos));
+ m_plbField->append_text(OUString(o3tl::getToken(strVisibleFields, 0, ';', nPos)));
} while (nPos>=0);
}
diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx
index 545fb594ef9b..085d21f995de 100644
--- a/cui/source/dialogs/multipat.cxx
+++ b/cui/source/dialogs/multipat.cxx
@@ -34,6 +34,7 @@
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <unotools/pathoptions.hxx>
+#include <o3tl/string_view.hxx>
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::ui::dialogs;
@@ -262,16 +263,16 @@ OUString SvxPathSelectDialog::GetPath() const
return sNewPath.makeStringAndClear();
}
-void SvxMultiPathDialog::SetPath( const OUString& rPath )
+void SvxMultiPathDialog::SetPath( std::u16string_view rPath )
{
- if ( !rPath.isEmpty() )
+ if ( !rPath.empty() )
{
const sal_Unicode cDelim = SVT_SEARCHPATH_DELIMITER;
int nCount = 0;
sal_Int32 nIndex = 0;
do
{
- const OUString sPath = rPath.getToken( 0, cDelim, nIndex );
+ const OUString sPath( o3tl::getToken(rPath, 0, cDelim, nIndex ) );
OUString sSystemPath;
bool bIsSystemPath =
osl::FileBase::getSystemPathFromFileURL(sPath, sSystemPath) == osl::FileBase::E_None;
@@ -292,14 +293,14 @@ void SvxMultiPathDialog::SetPath( const OUString& rPath )
SelectHdl_Impl(*m_xRadioLB);
}
-void SvxPathSelectDialog::SetPath(const OUString& rPath)
+void SvxPathSelectDialog::SetPath(std::u16string_view rPath)
{
- if ( !rPath.isEmpty() )
+ if ( !rPath.empty() )
{
sal_Int32 nIndex = 0;
do
{
- const OUString sPath = rPath.getToken( 0, SVT_SEARCHPATH_DELIMITER, nIndex );
+ const OUString sPath( o3tl::getToken(rPath, 0, SVT_SEARCHPATH_DELIMITER, nIndex ) );
OUString sSystemPath;
bool bIsSystemPath =
osl::FileBase::getSystemPathFromFileURL(sPath, sSystemPath) == osl::FileBase::E_None;
diff --git a/cui/source/inc/cuifmsearch.hxx b/cui/source/inc/cuifmsearch.hxx
index 46284c6d8d4d..29484ef8f69c 100644
--- a/cui/source/inc/cuifmsearch.hxx
+++ b/cui/source/inc/cuifmsearch.hxx
@@ -133,7 +133,7 @@ public:
inline void SetActiveField(const OUString& strField);
private:
- void Init(const OUString& strVisibleFields, const OUString& strInitialText);
+ void Init(std::u16string_view strVisibleFields, const OUString& strInitialText);
// only to be used out of the constructors
void OnFound(const css::uno::Any& aCursorPos, sal_Int16 nFieldPos);
diff --git a/cui/source/inc/multipat.hxx b/cui/source/inc/multipat.hxx
index 0cedd954a1a6..258e446e80f8 100644
--- a/cui/source/inc/multipat.hxx
+++ b/cui/source/inc/multipat.hxx
@@ -40,7 +40,7 @@ public:
virtual ~SvxMultiPathDialog() override;
OUString GetPath() const;
- void SetPath(const OUString& rPath);
+ void SetPath(std::u16string_view rPath);
void SetTitle(const OUString& rTitle) { m_xDialog->set_title(rTitle); }
};
@@ -59,7 +59,7 @@ public:
SvxPathSelectDialog(weld::Window* pParent);
OUString GetPath() const;
- void SetPath( const OUString& rPath );
+ void SetPath( std::u16string_view rPath );
void SetTitle(const OUString& rTitle) { m_xDialog->set_title(rTitle); }
};
diff --git a/cui/source/inc/optpath.hxx b/cui/source/inc/optpath.hxx
index c3b9aafbbae5..acc7696527ed 100644
--- a/cui/source/inc/optpath.hxx
+++ b/cui/source/inc/optpath.hxx
@@ -56,7 +56,7 @@ private:
void GetPathList( SvtPathOptions::Paths _nPathHandle, OUString& _rInternalPath,
OUString& _rUserPath, OUString& _rWritablePath, bool& _rReadOnly );
void SetPathList( SvtPathOptions::Paths _nPathHandle,
- const OUString& _rUserPath, const OUString& _rWritablePath );
+ std::u16string_view _rUserPath, const OUString& _rWritablePath );
public:
SvxPathTabPage( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet );
diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx
index 226839d20c98..6cd26a097a6c 100644
--- a/cui/source/options/optaboutconfig.cxx
+++ b/cui/source/options/optaboutconfig.cxx
@@ -32,6 +32,7 @@
#include <vcl/event.hxx>
#include <sal/log.hxx>
#include <tools/diagnose_ex.h>
+#include <o3tl/string_view.hxx>
#include <algorithm>
#include <memory>
@@ -531,14 +532,14 @@ void CuiAboutConfigTabPage::AddToModifiedVector( const std::shared_ptr< Prop_Imp
//property is not modified before
}
-std::vector< OUString > CuiAboutConfigTabPage::commaStringToSequence( const OUString& rCommaSepString )
+std::vector< OUString > CuiAboutConfigTabPage::commaStringToSequence( std::u16string_view rCommaSepString )
{
std::vector<OUString> tempVector;
sal_Int32 index = 0;
do
{
- OUString word = rCommaSepString.getToken(0, u',', index);
+ OUString word( o3tl::getToken(rCommaSepString, 0, u',', index) );
word = word.trim();
if( !word.isEmpty())
tempVector.push_back(word);
diff --git a/cui/source/options/optaboutconfig.hxx b/cui/source/options/optaboutconfig.hxx
index 69a207da6712..64443bcff8cc 100644
--- a/cui/source/options/optaboutconfig.hxx
+++ b/cui/source/options/optaboutconfig.hxx
@@ -52,7 +52,7 @@ private:
bool m_bSorted;
void AddToModifiedVector( const std::shared_ptr< Prop_Impl >& rProp );
- static std::vector< OUString > commaStringToSequence( const OUString& rCommaSepString );
+ static std::vector< OUString > commaStringToSequence( std::u16string_view rCommaSepString );
void InsertEntry(const prefBoxEntry& rEntry);
DECL_LINK(StandardHdl_Impl, weld::Button&, void);
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx
index 1272a52f091d..4d9359534f06 100644
--- a/cui/source/options/optpath.cxx
+++ b/cui/source/options/optpath.cxx
@@ -136,16 +136,16 @@ static OUString getCfgName_Impl( SvtPathOptions::Paths _nHandle )
#define MULTIPATH_DELIMITER ';'
-static OUString Convert_Impl( const OUString& rValue )
+static OUString Convert_Impl( std::u16string_view rValue )
{
- if (rValue.isEmpty())
+ if (rValue.empty())
return OUString();
sal_Int32 nPos = 0;
OUStringBuffer aReturn;
for (;;)
{
- OUString aValue = rValue.getToken( 0, MULTIPATH_DELIMITER, nPos );
+ OUString aValue( o3tl::getToken(rValue, 0, MULTIPATH_DELIMITER, nPos ) );
INetURLObject aObj( aValue );
if ( aObj.GetProtocol() == INetProtocol::File )
aReturn.append(aObj.PathToFileName());
@@ -659,7 +659,7 @@ void SvxPathTabPage::GetPathList(
void SvxPathTabPage::SetPathList(
- SvtPathOptions::Paths _nPathHandle, const OUString& _rUserPath, const OUString& _rWritablePath )
+ SvtPathOptions::Paths _nPathHandle, std::u16string_view _rUserPath, const OUString& _rWritablePath )
{
OUString sCfgName = getCfgName_Impl( _nPathHandle );
@@ -678,7 +678,7 @@ void SvxPathTabPage::SetPathList(
OUString* pArray = aPathSeq.getArray();
sal_Int32 nPos = 0;
for ( sal_Int32 i = 0; i < nCount; ++i )
- pArray[i] = _rUserPath.getToken( 0, MULTIPATH_DELIMITER, nPos );
+ pArray[i] = o3tl::getToken(_rUserPath, 0, MULTIPATH_DELIMITER, nPos );
Any aValue( aPathSeq );
pImpl->m_xPathSettings->setPropertyValue(
sCfgName + POSTFIX_USER, aValue);