summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-04-19 12:06:34 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-04-19 15:04:33 +0200
commit6a0a0a4d78bb8850bf4a304b83784d3822895efe (patch)
tree2800dce4daa42965a010336456117733830e2694
parent832b23d9376019619929764606276aacde1e329a (diff)
use more string_view in comphelper::string
Change-Id: I5d27824694e38de540e5f1fcd8704f8777f65140 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114261 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--comphelper/qa/string/test_string.cxx10
-rw-r--r--comphelper/source/misc/string.cxx92
-rw-r--r--cui/source/inc/optdict.hxx2
-rw-r--r--cui/source/options/optdict.cxx6
-rw-r--r--dbaccess/source/core/misc/dsntypes.cxx6
-rw-r--r--dbaccess/source/inc/dsntypes.hxx6
-rw-r--r--dbaccess/source/ui/app/AppDetailPageHelper.cxx2
-rw-r--r--dbaccess/source/ui/dlg/ConnectionHelper.cxx6
-rw-r--r--dbaccess/source/ui/dlg/ConnectionHelper.hxx6
-rw-r--r--dbaccess/source/ui/dlg/generalpage.cxx2
-rw-r--r--dbaccess/source/ui/dlg/generalpage.hxx2
-rw-r--r--editeng/source/outliner/outliner.cxx2
-rw-r--r--formula/source/ui/dlg/parawin.cxx2
-rw-r--r--formula/source/ui/dlg/parawin.hxx2
-rw-r--r--include/comphelper/string.hxx28
-rw-r--r--include/vcl/imap.hxx4
-rw-r--r--linguistic/source/dicimp.cxx2
-rw-r--r--sc/inc/dpobject.hxx2
-rw-r--r--sc/inc/dputil.hxx2
-rw-r--r--sc/source/core/data/dpobject.cxx2
-rw-r--r--sc/source/core/data/dputil.cxx2
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx8
-rw-r--r--starmath/inc/cursor.hxx2
-rw-r--r--starmath/inc/dialog.hxx6
-rw-r--r--starmath/source/cursor.cxx2
-rw-r--r--starmath/source/dialog.cxx2
-rw-r--r--sw/source/core/doc/docfld.cxx2
-rw-r--r--sw/source/core/inc/docfld.hxx2
-rw-r--r--sw/source/filter/html/htmlfldw.cxx2
-rw-r--r--vcl/source/treelist/imap2.cxx4
30 files changed, 110 insertions, 108 deletions
diff --git a/comphelper/qa/string/test_string.cxx b/comphelper/qa/string/test_string.cxx
index 10b69fbf8243..0619b873e0fb 100644
--- a/comphelper/qa/string/test_string.cxx
+++ b/comphelper/qa/string/test_string.cxx
@@ -75,11 +75,11 @@ void TestString::testDecimalStringToNumber()
void TestString::testIsdigitAsciiString()
{
- CPPUNIT_ASSERT_EQUAL(true, comphelper::string::isdigitAsciiString(OString("1234")));
+ CPPUNIT_ASSERT_EQUAL(true, comphelper::string::isdigitAsciiString("1234"));
- CPPUNIT_ASSERT_EQUAL(false, comphelper::string::isdigitAsciiString(OString("1A34")));
+ CPPUNIT_ASSERT_EQUAL(false, comphelper::string::isdigitAsciiString("1A34"));
- CPPUNIT_ASSERT_EQUAL(true, comphelper::string::isdigitAsciiString(OString()));
+ CPPUNIT_ASSERT_EQUAL(true, comphelper::string::isdigitAsciiString(""));
}
using namespace ::com::sun::star;
@@ -360,13 +360,13 @@ void TestString::testTokenCount()
nOut = ::comphelper::string::getTokenCount(aIn, 'X');
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), nOut);
- nOut = ::comphelper::string::getTokenCount(OString(), 'X');
+ nOut = ::comphelper::string::getTokenCount("", 'X');
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), nOut);
}
void TestString::testReverseString()
{
- OString aOut = ::comphelper::string::reverseString(OString("ABC"));
+ OString aOut = ::comphelper::string::reverseString("ABC");
CPPUNIT_ASSERT_EQUAL(OString("CBA"), aOut);
}
diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx
index 32b365c09022..1867728381b6 100644
--- a/comphelper/source/misc/string.cxx
+++ b/comphelper/source/misc/string.cxx
@@ -47,30 +47,30 @@ namespace
template <typename T, typename C> T tmpl_stripStart(const T &rIn,
const C cRemove)
{
- if (rIn.isEmpty())
+ if (rIn.empty())
return rIn;
- sal_Int32 i = 0;
+ std::string_view::size_type i = 0;
- while (i < rIn.getLength())
+ while (i < rIn.size())
{
if (rIn[i] != cRemove)
break;
++i;
}
- return rIn.copy(i);
+ return rIn.substr(i);
}
}
-OString stripStart(const OString &rIn, char c)
+OString stripStart(std::string_view rIn, char c)
{
- return tmpl_stripStart<OString, char>(rIn, c);
+ return OString(tmpl_stripStart<std::string_view, char>(rIn, c));
}
-OUString stripStart(const OUString &rIn, sal_Unicode c)
+OUString stripStart(std::u16string_view rIn, sal_Unicode c)
{
- return tmpl_stripStart<OUString, sal_Unicode>(rIn, c);
+ return OUString(tmpl_stripStart<std::u16string_view, sal_Unicode>(rIn, c));
}
namespace
@@ -78,10 +78,10 @@ namespace
template <typename T, typename C> T tmpl_stripEnd(const T &rIn,
const C cRemove)
{
- if (rIn.isEmpty())
+ if (rIn.empty())
return rIn;
- sal_Int32 i = rIn.getLength();
+ std::u16string_view::size_type i = rIn.size();
while (i > 0)
{
@@ -90,41 +90,43 @@ namespace
--i;
}
- return rIn.copy(0, i);
+ return rIn.substr(0, i);
}
}
-OString stripEnd(const OString &rIn, char c)
+OString stripEnd(std::string_view rIn, char c)
{
- return tmpl_stripEnd<OString, char>(rIn, c);
+ return OString(tmpl_stripEnd<std::string_view, char>(rIn, c));
}
-OUString stripEnd(const OUString &rIn, sal_Unicode c)
+OUString stripEnd(std::u16string_view rIn, sal_Unicode c)
{
- return tmpl_stripEnd<OUString, sal_Unicode>(rIn, c);
+ return OUString(tmpl_stripEnd<std::u16string_view, sal_Unicode>(rIn, c));
}
-OString strip(const OString &rIn, char c)
+OString strip(std::string_view rIn, char c)
{
- return stripEnd(stripStart(rIn, c), c);
+ auto x = tmpl_stripStart<std::string_view, char>(rIn, c);
+ return stripEnd(x, c);
}
-OUString strip(const OUString &rIn, sal_Unicode c)
+OUString strip(std::u16string_view rIn, sal_Unicode c)
{
- return stripEnd(stripStart(rIn, c), c);
+ auto x = tmpl_stripStart<std::u16string_view, sal_Unicode>(rIn, c);
+ return stripEnd(x, c);
}
namespace
{
- template <typename T, typename C> sal_Int32 tmpl_getTokenCount(const T &rIn,
+ template <typename T, typename C> sal_Int32 tmpl_getTokenCount( T rIn,
C cTok)
{
// Empty String: TokenCount by Definition is 0
- if (rIn.isEmpty())
+ if (rIn.empty())
return 0;
sal_Int32 nTokCount = 1;
- for (sal_Int32 i = 0; i < rIn.getLength(); ++i)
+ for (std::u16string_view::size_type i = 0; i < rIn.size(); ++i)
{
if (rIn[i] == cTok)
++nTokCount;
@@ -133,14 +135,14 @@ namespace
}
}
-sal_Int32 getTokenCount(const OString &rIn, char cTok)
+sal_Int32 getTokenCount(std::string_view rIn, char cTok)
{
- return tmpl_getTokenCount<OString, char>(rIn, cTok);
+ return tmpl_getTokenCount<std::string_view, char>(rIn, cTok);
}
-sal_Int32 getTokenCount(const OUString &rIn, sal_Unicode cTok)
+sal_Int32 getTokenCount(std::u16string_view rIn, sal_Unicode cTok)
{
- return tmpl_getTokenCount<OUString, sal_Unicode>(rIn, cTok);
+ return tmpl_getTokenCount<std::u16string_view, sal_Unicode>(rIn, cTok);
}
static sal_uInt32 decimalStringToNumber(
@@ -370,49 +372,49 @@ NaturalStringSorter::NaturalStringSorter(
m_xBI = i18n::BreakIterator::create( rContext );
}
-bool isdigitAsciiString(const OString &rString)
+bool isdigitAsciiString(std::string_view rString)
{
return std::all_of(
- rString.getStr(), rString.getStr() + rString.getLength(),
+ rString.data(), rString.data() + rString.size(),
[](unsigned char c){ return rtl::isAsciiDigit(c); });
}
-bool isdigitAsciiString(const OUString &rString)
+bool isdigitAsciiString(std::u16string_view rString)
{
return std::all_of(
- rString.getStr(), rString.getStr() + rString.getLength(),
+ rString.data(), rString.data() + rString.size(),
[](sal_Unicode c){ return rtl::isAsciiDigit(c); });
}
namespace
{
- template <typename T, typename O> T tmpl_reverseString(const T &rIn)
+ template <typename T, typename I, typename O> T tmpl_reverseString(I rIn)
{
- if (rIn.isEmpty())
- return rIn;
+ if (rIn.empty())
+ return T();
- sal_Int32 i = rIn.getLength();
- O sBuf(i);
+ std::u16string_view::size_type i = rIn.size();
+ O sBuf(static_cast<sal_Int32>(i));
while (i)
sBuf.append(rIn[--i]);
return sBuf.makeStringAndClear();
}
}
-OUString reverseString(const OUString &rStr)
+OUString reverseString(std::u16string_view rStr)
{
- return tmpl_reverseString<OUString, OUStringBuffer>(rStr);
+ return tmpl_reverseString<OUString, std::u16string_view, OUStringBuffer>(rStr);
}
-OString reverseString(const OString &rStr)
+OString reverseString(std::string_view rStr)
{
- return tmpl_reverseString<OString, OStringBuffer>(rStr);
+ return tmpl_reverseString<OString, std::string_view, OStringBuffer>(rStr);
}
-sal_Int32 indexOfAny(OUString const& rIn,
+sal_Int32 indexOfAny(std::u16string_view rIn,
sal_Unicode const*const pChars, sal_Int32 const nPos)
{
- for (sal_Int32 i = nPos; i < rIn.getLength(); ++i)
+ for (std::u16string_view::size_type i = nPos; i < rIn.size(); ++i)
{
sal_Unicode const c = rIn[i];
for (sal_Unicode const* pChar = pChars; *pChar; ++pChar)
@@ -426,12 +428,12 @@ sal_Int32 indexOfAny(OUString const& rIn,
return -1;
}
-OUString removeAny(OUString const& rIn,
+OUString removeAny(std::u16string_view rIn,
sal_Unicode const*const pChars)
{
OUStringBuffer buf;
bool isFound(false);
- for (sal_Int32 i = 0; i < rIn.getLength(); ++i)
+ for (std::u16string_view::size_type i = 0; i < rIn.size(); ++i)
{
sal_Unicode const c = rIn[i];
bool removeC(false);
@@ -449,7 +451,7 @@ OUString removeAny(OUString const& rIn,
{
if (i > 0)
{
- buf.append(rIn.subView(0, i));
+ buf.append(rIn.substr(0, i));
}
isFound = true;
}
@@ -459,7 +461,7 @@ OUString removeAny(OUString const& rIn,
buf.append(c);
}
}
- return isFound ? buf.makeStringAndClear() : rIn;
+ return isFound ? buf.makeStringAndClear() : OUString(rIn);
}
OUString setToken(const OUString& rIn, sal_Int32 nToken, sal_Unicode cTok,
diff --git a/cui/source/inc/optdict.hxx b/cui/source/inc/optdict.hxx
index 1449e9457ad9..e2dcf55953a8 100644
--- a/cui/source/inc/optdict.hxx
+++ b/cui/source/inc/optdict.hxx
@@ -99,7 +99,7 @@ private:
css::linguistic2::XDictionary > const &xDic );
void RemoveDictEntry(int nEntry);
- int GetLBInsertPos(const OUString &rDicWord);
+ int GetLBInsertPos(std::u16string_view rDicWord);
public:
SvxEditDictionaryDialog(weld::Window* pParent, std::u16string_view rName);
diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx
index 55bfd4b72224..0a7a4ba74c5c 100644
--- a/cui/source/options/optdict.cxx
+++ b/cui/source/options/optdict.cxx
@@ -43,7 +43,7 @@ using namespace linguistic;
// static function -------------------------------------------------------
-static OUString getNormDicEntry_Impl(const OUString &rText)
+static OUString getNormDicEntry_Impl(std::u16string_view rText)
{
OUString aTmp(comphelper::string::stripEnd(rText, '.'));
// non-standard hyphenation
@@ -73,7 +73,7 @@ enum CDE_RESULT { CDE_EQUAL, CDE_SIMILAR, CDE_DIFFERENT };
}
-static CDE_RESULT cmpDicEntry_Impl( const OUString &rText1, const OUString &rText2 )
+static CDE_RESULT cmpDicEntry_Impl( std::u16string_view rText1, std::u16string_view rText2 )
{
CDE_RESULT eRes = CDE_DIFFERENT;
@@ -355,7 +355,7 @@ void SvxEditDictionaryDialog::SetLanguage_Impl(LanguageType nLanguage)
m_xLangLB->set_active_id(nLanguage);
}
-int SvxEditDictionaryDialog::GetLBInsertPos(const OUString &rDicWord)
+int SvxEditDictionaryDialog::GetLBInsertPos(std::u16string_view rDicWord)
{
IntlWrapper aIntlWrapper(SvtSysLocale().GetUILanguageTag());
const CollatorWrapper* pCollator = aIntlWrapper.getCollator();
diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx
index 494994c347da..aca8aacb560b 100644
--- a/dbaccess/source/core/misc/dsntypes.cxx
+++ b/dbaccess/source/core/misc/dsntypes.cxx
@@ -77,7 +77,7 @@ OUString ODsnTypeCollection::getTypeDisplayName(std::u16string_view _sURL) const
return m_aDriverConfig.getDriverTypeDisplayName(_sURL);
}
-OUString ODsnTypeCollection::cutPrefix(const OUString& _sURL) const
+OUString ODsnTypeCollection::cutPrefix(std::u16string_view _sURL) const
{
OUString sRet;
OUString sOldPattern;
@@ -292,7 +292,7 @@ OUString ODsnTypeCollection::getEmbeddedDatabase()
}
-DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const
+DATASOURCE_TYPE ODsnTypeCollection::determineType(std::u16string_view _rDsn) const
{
OUString sDsn(comphelper::string::stripEnd(_rDsn, '*'));
sal_Int32 nSeparator = sDsn.indexOf(u':');
@@ -403,7 +403,7 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const
return DST_UNKNOWN;
}
-void ODsnTypeCollection::fillPageIds(const OUString& _sURL,std::vector<sal_Int16>& _rOutPathIds) const
+void ODsnTypeCollection::fillPageIds(std::u16string_view _sURL,std::vector<sal_Int16>& _rOutPathIds) const
{
DATASOURCE_TYPE eType = determineType(_sURL);
switch(eType)
diff --git a/dbaccess/source/inc/dsntypes.hxx b/dbaccess/source/inc/dsntypes.hxx
index 629759ccfd47..b7642c66f20c 100644
--- a/dbaccess/source/inc/dsntypes.hxx
+++ b/dbaccess/source/inc/dsntypes.hxx
@@ -121,7 +121,7 @@ public:
OUString getTypeDisplayName(std::u16string_view _sURL) const;
/// on a given string, cut the type prefix and return the result
- OUString cutPrefix(const OUString& _sURL) const;
+ OUString cutPrefix(std::u16string_view _sURL) const;
/// on a given string, return the type prefix
OUString getPrefix(const OUString& _sURL) const;
@@ -175,9 +175,9 @@ public:
/// get access to the (last + 1st) element of the types collection
inline TypeIterator end() const;
- void fillPageIds(const OUString& _sURL,std::vector<sal_Int16>& _rOutPathIds) const;
+ void fillPageIds(std::u16string_view _sURL,std::vector<sal_Int16>& _rOutPathIds) const;
- DATASOURCE_TYPE determineType(const OUString& _rDsn) const;
+ DATASOURCE_TYPE determineType(std::u16string_view _rDsn) const;
sal_Int32 getIndexOf(std::u16string_view _sURL) const;
sal_Int32 size() const;
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index 1ab3c0ad29bf..f13926e3d204 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
@@ -884,7 +884,7 @@ bool OAppDetailPageHelper::isPreviewEnabled() const
namespace
{
- OUString stripTrailingDots(const OUString& rStr)
+ OUString stripTrailingDots(std::u16string_view rStr)
{
return comphelper::string::stripEnd(rStr, '.');
}
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
index 4339d3bc3e08..722ee44a87ca 100644
--- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
@@ -364,7 +364,7 @@ namespace dbaui
return true;
}
- void OConnectionHelper::impl_setURL( const OUString& _rURL, bool _bPrefix )
+ void OConnectionHelper::impl_setURL( std::u16string_view _rURL, bool _bPrefix )
{
OUString sURL( comphelper::string::stripEnd(_rURL, '*') );
OSL_ENSURE( m_pCollection, "OConnectionHelper::impl_setURL: have no interpreter for the URLs!" );
@@ -436,7 +436,7 @@ namespace dbaui
return sURL;
}
- void OConnectionHelper::setURL( const OUString& _rURL )
+ void OConnectionHelper::setURL( std::u16string_view _rURL )
{
impl_setURL( _rURL, true );
}
@@ -446,7 +446,7 @@ namespace dbaui
return impl_getURL();
}
- void OConnectionHelper::setURLNoPrefix( const OUString& _rURL )
+ void OConnectionHelper::setURLNoPrefix( std::u16string_view _rURL )
{
impl_setURL( _rURL, false );
}
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.hxx b/dbaccess/source/ui/dlg/ConnectionHelper.hxx
index 7129e1f5600b..5b765dfa50b1 100644
--- a/dbaccess/source/ui/dlg/ConnectionHelper.hxx
+++ b/dbaccess/source/ui/dlg/ConnectionHelper.hxx
@@ -65,7 +65,7 @@ namespace dbaui
//void setURL( const OUString& _rURL, OConnectionURLEdit* _m_pConnection );
OUString getURLNoPrefix( ) const;
- void setURLNoPrefix( const OUString& _rURL );
+ void setURLNoPrefix( std::u16string_view _rURL );
/** checks if the path is existence
@param _rURL
@@ -84,7 +84,7 @@ namespace dbaui
void askForFileName(::sfx2::FileDialogHelper& _aFileOpen);
protected:
- void setURL( const OUString& _rURL );
+ void setURL( std::u16string_view _rURL );
virtual bool checkTestConnection();
private:
@@ -93,7 +93,7 @@ namespace dbaui
DECL_LINK(GetFocusHdl, weld::Widget&, void);
DECL_LINK(LoseFocusHdl, weld::Widget&, void);
OUString impl_getURL() const;
- void impl_setURL( const OUString& _rURL, bool _bPrefix );
+ void impl_setURL( std::u16string_view _rURL, bool _bPrefix );
void implUpdateURLDependentStates() const;
};
diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx
index d02ac934fba7..5de35c10c539 100644
--- a/dbaccess/source/ui/dlg/generalpage.cxx
+++ b/dbaccess/source/ui/dlg/generalpage.cxx
@@ -297,7 +297,7 @@ namespace dbaui
// representative for all MySQl databases)
// Also, embedded databases (embedded HSQL, at the moment), are not to appear in the list of
// databases to connect to.
- bool OGeneralPage::approveDatasourceType( const OUString& _sURLPrefix, OUString& _inout_rDisplayName )
+ bool OGeneralPage::approveDatasourceType( std::u16string_view _sURLPrefix, OUString& _inout_rDisplayName )
{
return approveDatasourceType( m_pCollection->determineType(_sURLPrefix), _inout_rDisplayName );
}
diff --git a/dbaccess/source/ui/dlg/generalpage.hxx b/dbaccess/source/ui/dlg/generalpage.hxx
index 452817a056cf..810fd44d0682 100644
--- a/dbaccess/source/ui/dlg/generalpage.hxx
+++ b/dbaccess/source/ui/dlg/generalpage.hxx
@@ -46,7 +46,7 @@ namespace dbaui
Link<OGeneralPage&,void> m_aTypeSelectHandler; /// to be called if a new type is selected
bool m_bInitTypeList : 1;
- bool approveDatasourceType( const OUString& _sURLPrefix, OUString& _inout_rDisplayName );
+ bool approveDatasourceType( std::u16string_view _sURLPrefix, OUString& _inout_rDisplayName );
void insertDatasourceTypeEntryData( const OUString& _sType, const OUString& sDisplayName );
protected:
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 34ef7f981121..de072f8c96c0 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -526,7 +526,7 @@ bool Outliner::ImpConvertEdtToOut( sal_Int32 nPara )
}
sal_Int32 nPos = nHeadingNumberStart ? nHeadingNumberStart : nNumberingNumberStart;
- OUString aLevel = comphelper::string::stripStart(aName.copy(nPos), ' ');
+ OUString aLevel = comphelper::string::stripStart(aName.subView(nPos), ' ');
nTabs = aLevel.toInt32();
if( nTabs )
nTabs--; // Level 0 = "heading 1"
diff --git a/formula/source/ui/dlg/parawin.cxx b/formula/source/ui/dlg/parawin.cxx
index 35a925a10848..1eaba4d1982f 100644
--- a/formula/source/ui/dlg/parawin.cxx
+++ b/formula/source/ui/dlg/parawin.cxx
@@ -285,7 +285,7 @@ OUString ParaWin::GetActiveArgName() const
}
-void ParaWin::SetArgument(sal_uInt16 no, const OUString& aString)
+void ParaWin::SetArgument(sal_uInt16 no, std::u16string_view aString)
{
if (no < aParaArray.size())
aParaArray[no] = comphelper::string::stripStart(aString, ' ');
diff --git a/formula/source/ui/dlg/parawin.hxx b/formula/source/ui/dlg/parawin.hxx
index db3a02a89ee6..b2fe7ece621e 100644
--- a/formula/source/ui/dlg/parawin.hxx
+++ b/formula/source/ui/dlg/parawin.hxx
@@ -124,7 +124,7 @@ public:
OUString GetActiveArgName() const;
OUString GetArgument(sal_uInt16 no);
- void SetArgument(sal_uInt16 no, const OUString& aString);
+ void SetArgument(sal_uInt16 no, std::u16string_view aString);
void SetArgumentFonts(const vcl::Font& aBoldFont,const vcl::Font& aLightFont);
void SetEdFocus(); // visible edit lines
diff --git a/include/comphelper/string.hxx b/include/comphelper/string.hxx
index 6e421fa7d1e8..349dc17360a4 100644
--- a/include/comphelper/string.hxx
+++ b/include/comphelper/string.hxx
@@ -70,7 +70,7 @@ inline OUStringBuffer& remove(OUStringBuffer &rIn,
@return The resulting OString
*/
-COMPHELPER_DLLPUBLIC OString stripStart(const OString &rIn,
+COMPHELPER_DLLPUBLIC OString stripStart(std::string_view rIn,
char c);
/** Strips occurrences of a character from the start of the source string
@@ -80,7 +80,7 @@ COMPHELPER_DLLPUBLIC OString stripStart(const OString &rIn,
@return The resulting OUString
*/
-COMPHELPER_DLLPUBLIC OUString stripStart(const OUString &rIn,
+COMPHELPER_DLLPUBLIC OUString stripStart(std::u16string_view rIn,
sal_Unicode c);
/** Strips occurrences of a character from the end of the source string
@@ -90,7 +90,7 @@ COMPHELPER_DLLPUBLIC OUString stripStart(const OUString &rIn,
@return The resulting OString
*/
-COMPHELPER_DLLPUBLIC OString stripEnd(const OString &rIn,
+COMPHELPER_DLLPUBLIC OString stripEnd(std::string_view rIn,
char c);
/** Strips occurrences of a character from the end of the source string
@@ -100,7 +100,7 @@ COMPHELPER_DLLPUBLIC OString stripEnd(const OString &rIn,
@return The resulting OUString
*/
-COMPHELPER_DLLPUBLIC OUString stripEnd(const OUString &rIn,
+COMPHELPER_DLLPUBLIC OUString stripEnd(std::u16string_view rIn,
sal_Unicode c);
/** Strips occurrences of a character from the start and end of the source string
@@ -110,7 +110,7 @@ COMPHELPER_DLLPUBLIC OUString stripEnd(const OUString &rIn,
@return The resulting OString
*/
-COMPHELPER_DLLPUBLIC OString strip(const OString &rIn,
+COMPHELPER_DLLPUBLIC OString strip(std::string_view rIn,
char c);
/** Strips occurrences of a character from the start and end of the source string
@@ -120,7 +120,7 @@ COMPHELPER_DLLPUBLIC OString strip(const OString &rIn,
@return The resulting OUString
*/
-COMPHELPER_DLLPUBLIC OUString strip(const OUString &rIn,
+COMPHELPER_DLLPUBLIC OUString strip(std::u16string_view rIn,
sal_Unicode c);
/** Returns number of tokens in an OUString
@@ -129,7 +129,7 @@ COMPHELPER_DLLPUBLIC OUString strip(const OUString &rIn,
@param cTok the character which separate the tokens.
@return the number of tokens
*/
-COMPHELPER_DLLPUBLIC sal_Int32 getTokenCount(const OString &rIn, char cTok);
+COMPHELPER_DLLPUBLIC sal_Int32 getTokenCount(std::string_view rIn, char cTok);
/** Returns number of tokens in an OUString
@@ -137,21 +137,21 @@ COMPHELPER_DLLPUBLIC sal_Int32 getTokenCount(const OString &rIn, char cTok);
@param cTok the character which separate the tokens.
@return the number of tokens
*/
-COMPHELPER_DLLPUBLIC sal_Int32 getTokenCount(const OUString &rIn, sal_Unicode cTok);
+COMPHELPER_DLLPUBLIC sal_Int32 getTokenCount(std::u16string_view rIn, sal_Unicode cTok);
/** Reverse an OUString
@param rIn the input OUString
@return the reversed input
*/
-COMPHELPER_DLLPUBLIC OUString reverseString(const OUString &rStr);
+COMPHELPER_DLLPUBLIC OUString reverseString(std::u16string_view rStr);
/** Reverse an OString
@param rIn the input OString
@return the reversed input
*/
-COMPHELPER_DLLPUBLIC OString reverseString(const OString &rStr);
+COMPHELPER_DLLPUBLIC OString reverseString(std::string_view rStr);
namespace detail
@@ -244,7 +244,7 @@ COMPHELPER_DLLPUBLIC OUString setToken(const OUString& rIn, sal_Int32 nToken, sa
@return position of first occurrence of any of the elements of pChars
or -1 if none of the code units occur in the string
*/
-COMPHELPER_DLLPUBLIC sal_Int32 indexOfAny(OUString const& rIn,
+COMPHELPER_DLLPUBLIC sal_Int32 indexOfAny(std::u16string_view rIn,
sal_Unicode const*const pChars, sal_Int32 const nPos);
/** Remove any of a list of code units in the string.
@@ -253,7 +253,7 @@ COMPHELPER_DLLPUBLIC sal_Int32 indexOfAny(OUString const& rIn,
@return OUString that has all of the pChars code units removed
*/
-COMPHELPER_DLLPUBLIC OUString removeAny(OUString const& rIn,
+COMPHELPER_DLLPUBLIC OUString removeAny(std::u16string_view rIn,
sal_Unicode const*const pChars);
/** Convert a sequence of strings to a single comma separated string.
@@ -353,7 +353,7 @@ public:
the ASCII '0'-'9' range
true otherwise, including for empty string
*/
-COMPHELPER_DLLPUBLIC bool isdigitAsciiString(const OString &rString);
+COMPHELPER_DLLPUBLIC bool isdigitAsciiString(std::string_view rString);
/** Determine if an OUString contains solely ASCII numeric digits
@@ -363,7 +363,7 @@ COMPHELPER_DLLPUBLIC bool isdigitAsciiString(const OString &rString);
the ASCII '0'-'9' range
true otherwise, including for empty string
*/
-COMPHELPER_DLLPUBLIC bool isdigitAsciiString(const OUString &rString);
+COMPHELPER_DLLPUBLIC bool isdigitAsciiString(std::u16string_view rString);
}
diff --git a/include/vcl/imap.hxx b/include/vcl/imap.hxx
index 5a71efdce90e..0623920039a3 100644
--- a/include/vcl/imap.hxx
+++ b/include/vcl/imap.hxx
@@ -49,12 +49,12 @@ private:
void ImpReadCERN( SvStream& rOStm );
void ImpReadNCSA( SvStream& rOStm );
- void ImpReadCERNLine( const OString& rLine );
+ void ImpReadCERNLine( std::string_view rLine );
static Point ImpReadCERNCoords( const char** ppStr );
static tools::Long ImpReadCERNRadius( const char** ppStr );
static OUString ImpReadCERNURL( const char** ppStr );
- void ImpReadNCSALine( const OString& rLine );
+ void ImpReadNCSALine( std::string_view rLine );
static OUString ImpReadNCSAURL( const char** ppStr );
static Point ImpReadNCSACoords( const char** ppStr );
diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index f2f0a3513b96..97a41ced3024 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -99,7 +99,7 @@ static bool getTag(const OString &rLine, const char *pTagName,
if (nPos == -1)
return false;
- rTagValue = comphelper::string::strip(rLine.copy(nPos + rtl_str_getLength(pTagName)),
+ rTagValue = comphelper::string::strip(rLine.subView(nPos + strlen(pTagName)),
' ');
return true;
}
diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index 0ecaf6466e08..6d740769637c 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -195,7 +195,7 @@ public:
OUString& rDataFieldName,
std::vector<css::sheet::DataPilotFieldFilter>& rFilters,
std::vector<sal_Int16>& rFilterFuncs,
- const OUString& rFilterList );
+ std::u16string_view rFilterList );
void GetMemberResultNames(ScDPUniqueStringSet& rNames, tools::Long nDimension);
diff --git a/sc/inc/dputil.hxx b/sc/inc/dputil.hxx
index b5a2b64c9138..74576c820b01 100644
--- a/sc/inc/dputil.hxx
+++ b/sc/inc/dputil.hxx
@@ -22,7 +22,7 @@ class ScDPUtil
public:
static bool isDuplicateDimension(const OUString& rName);
- SC_DLLPUBLIC static OUString getSourceDimensionName(const OUString& rName);
+ SC_DLLPUBLIC static OUString getSourceDimensionName(std::u16string_view rName);
/**
* Get a duplicate index in case the dimension is a duplicate. It returns
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index b31d9045f79e..d60b41d143e8 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -1713,7 +1713,7 @@ bool isAtStart(
bool ScDPObject::ParseFilters(
OUString& rDataFieldName,
std::vector<sheet::DataPilotFieldFilter>& rFilters,
- std::vector<sal_Int16>& rFilterFuncs, const OUString& rFilterList )
+ std::vector<sal_Int16>& rFilterFuncs, std::u16string_view rFilterList )
{
// parse the string rFilterList into parameters for GetPivotData
diff --git a/sc/source/core/data/dputil.cxx b/sc/source/core/data/dputil.cxx
index b3e2d7477327..a561b870e2cd 100644
--- a/sc/source/core/data/dputil.cxx
+++ b/sc/source/core/data/dputil.cxx
@@ -61,7 +61,7 @@ bool ScDPUtil::isDuplicateDimension(const OUString& rName)
return rName.endsWith("*");
}
-OUString ScDPUtil::getSourceDimensionName(const OUString& rName)
+OUString ScDPUtil::getSourceDimensionName(std::u16string_view rName)
{
return comphelper::string::stripEnd(rName, '*');
}
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index ca5897df8a0a..6ea3fa7a17c9 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -145,7 +145,7 @@ OUString CreateSizeText( sal_Int64 nSize )
return aSizeStr;
}
-OUString ConvertDateTime_Impl( const OUString& rName,
+OUString ConvertDateTime_Impl( std::u16string_view rName,
const util::DateTime& uDT, const LocaleDataWrapper& rWrapper )
{
Date aD(uDT);
@@ -1030,7 +1030,7 @@ void SfxDocumentPage::Reset( const SfxItemSet* rSet )
}
util::DateTime uDT;
- OUString emptyDate = ConvertDateTime_Impl( "", uDT, rLocaleWrapper );
+ OUString emptyDate = ConvertDateTime_Impl( u"", uDT, rLocaleWrapper );
if ( rCmisProp.Id == "cmis:creationDate" &&
(m_xCreateValFt->get_label() == emptyDate ||
m_xCreateValFt->get_label().isEmpty()))
@@ -1039,7 +1039,7 @@ void SfxDocumentPage::Reset( const SfxItemSet* rSet )
rCmisProp.Value >>= seqValue;
if ( seqValue.hasElements() )
{
- m_xCreateValFt->set_label( ConvertDateTime_Impl( "", seqValue[0], rLocaleWrapper ) );
+ m_xCreateValFt->set_label( ConvertDateTime_Impl( u"", seqValue[0], rLocaleWrapper ) );
}
}
if ( rCmisProp.Id == "cmis:lastModificationDate" &&
@@ -1050,7 +1050,7 @@ void SfxDocumentPage::Reset( const SfxItemSet* rSet )
rCmisProp.Value >>= seqValue;
if ( seqValue.hasElements() )
{
- m_xChangeValFt->set_label( ConvertDateTime_Impl( "", seqValue[0], rLocaleWrapper ) );
+ m_xChangeValFt->set_label( ConvertDateTime_Impl( u"", seqValue[0], rLocaleWrapper ) );
}
}
}
diff --git a/starmath/inc/cursor.hxx b/starmath/inc/cursor.hxx
index 6346017ee5bb..4b670e61cb8c 100644
--- a/starmath/inc/cursor.hxx
+++ b/starmath/inc/cursor.hxx
@@ -124,7 +124,7 @@ public:
* For more complex expressions use InsertCommandText, this method doesn't
* use SmParser, this means that it's faster, but not as strong.
*/
- void InsertSpecial(const OUString& aString);
+ void InsertSpecial(std::u16string_view aString);
/** Create sub-/super script
*
diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx
index 53de6278f51d..fc303ba29fc3 100644
--- a/starmath/inc/dialog.hxx
+++ b/starmath/inc/dialog.hxx
@@ -435,7 +435,7 @@ class SmSymDefineDialog final : public weld::GenericDialogController
void SetOrigSymbol(const SmSym *pSymbol, const OUString &rSymbolSetName);
void UpdateButtons();
- bool SelectSymbolSet(weld::ComboBox &rComboBox, const OUString &rSymbolSetName,
+ bool SelectSymbolSet(weld::ComboBox &rComboBox, std::u16string_view rSymbolSetName,
bool bDeleteText);
bool SelectSymbol(weld::ComboBox& rComboBox, const OUString &rSymbolName,
bool bDeleteText);
@@ -454,7 +454,7 @@ public:
virtual short run() override;
- void SelectOldSymbolSet(const OUString &rSymbolSetName)
+ void SelectOldSymbolSet(std::u16string_view rSymbolSetName)
{
SelectSymbolSet(*m_xOldSymbolSets, rSymbolSetName, false);
}
@@ -464,7 +464,7 @@ public:
SelectSymbol(*m_xOldSymbols, rSymbolName, false);
}
- bool SelectSymbolSet(const OUString &rSymbolSetName)
+ bool SelectSymbolSet(std::u16string_view rSymbolSetName)
{
return SelectSymbolSet(*m_xSymbolSets, rSymbolSetName, false);
}
diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx
index 3698c9d2ddb5..a839b0eb0a02 100644
--- a/starmath/source/cursor.cxx
+++ b/starmath/source/cursor.cxx
@@ -981,7 +981,7 @@ void SmCursor::InsertElement(SmFormulaElement element){
EndEdit();
}
-void SmCursor::InsertSpecial(const OUString& _aString)
+void SmCursor::InsertSpecial(std::u16string_view _aString)
{
BeginEdit();
Delete();
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index 8a862516b682..fc722e252bce 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -1808,7 +1808,7 @@ void SmSymDefineDialog::SetSymbolSetManager(const SmSymbolManager &rMgr)
}
bool SmSymDefineDialog::SelectSymbolSet(weld::ComboBox& rComboBox,
- const OUString &rSymbolSetName, bool bDeleteText)
+ std::u16string_view rSymbolSetName, bool bDeleteText)
{
assert((&rComboBox == m_xOldSymbolSets.get() || &rComboBox == m_xSymbolSets.get()) && "Sm : wrong ComboBox");
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 9df71b52e704..6829089fbb52 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -332,7 +332,7 @@ HashStr::HashStr( const OUString& rName, const OUString& rText,
}
/// Look up the Name, if it is present, return its String, otherwise return an empty String
-OUString LookString( SwHashTable<HashStr> const & rTable, const OUString& rName )
+OUString LookString( SwHashTable<HashStr> const & rTable, std::u16string_view rName )
{
HashStr* pFnd = rTable.Find( comphelper::string::strip(rName, ' ') );
if( pFnd )
diff --git a/sw/source/core/inc/docfld.hxx b/sw/source/core/inc/docfld.hxx
index e68227a21a4e..a1d6e816c267 100644
--- a/sw/source/core/inc/docfld.hxx
+++ b/sw/source/core/inc/docfld.hxx
@@ -122,7 +122,7 @@ struct SwCalcFieldType final : public SwHash
};
// search for the string that was saved under rName in the hash table
-OUString LookString( SwHashTable<HashStr> const & rTable, const OUString& rName );
+OUString LookString( SwHashTable<HashStr> const & rTable, std::u16string_view rName );
const int GETFLD_ALL = 3; // combine flags via OR
const int GETFLD_CALC = 1;
diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx
index 825d563a9f39..18234a8a554c 100644
--- a/sw/source/filter/html/htmlfldw.cxx
+++ b/sw/source/filter/html/htmlfldw.cxx
@@ -490,7 +490,7 @@ Writer& OutHTML_SwFormatField( Writer& rWrt, const SfxPoolItem& rHt )
rComment.endsWith(">") &&
rComment.startsWithIgnoreAsciiCase( "HTML:" ) )
{
- OUString sComment(comphelper::string::stripStart(rComment.copy(5), ' '));
+ OUString sComment(comphelper::string::stripStart(rComment.subView(5), ' '));
if( '<' == sComment[0] )
{
sComment = convertLineEnd(sComment, GetSystemLineEnd());
diff --git a/vcl/source/treelist/imap2.cxx b/vcl/source/treelist/imap2.cxx
index c5e46004fb72..4c55f67cde31 100644
--- a/vcl/source/treelist/imap2.cxx
+++ b/vcl/source/treelist/imap2.cxx
@@ -241,7 +241,7 @@ void ImageMap::ImpReadCERN( SvStream& rIStm )
ImpReadCERNLine( aStr );
}
-void ImageMap::ImpReadCERNLine( const OString& rLine )
+void ImageMap::ImpReadCERNLine( std::string_view rLine )
{
OString aStr = comphelper::string::stripStart(rLine, ' ');
aStr = comphelper::string::stripStart(aStr, '\t');
@@ -376,7 +376,7 @@ void ImageMap::ImpReadNCSA( SvStream& rIStm )
ImpReadNCSALine( aStr );
}
-void ImageMap::ImpReadNCSALine( const OString& rLine )
+void ImageMap::ImpReadNCSALine( std::string_view rLine )
{
OString aStr = comphelper::string::stripStart(rLine, ' ');
aStr = comphelper::string::stripStart(aStr, '\t');