diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-01-28 20:29:16 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-01-29 09:25:12 +0100 |
commit | 1250aecd71fabde4dba990bfceb61bbe8e06b8ea (patch) | |
tree | 3c42ffdf68b7e81aba29228631a8cd34e2f11830 /sc | |
parent | 4f3987e0b1a995431478769c898b5ef151745254 (diff) |
loplugin:stringviewparam extend to new..
O[U]StringBuffer methods
Change-Id: I0ffbc33d54ae7c98b5652434f3370ee4f819f6f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110090
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/dputil.hxx | 2 | ||||
-rw-r--r-- | sc/inc/global.hxx | 2 | ||||
-rw-r--r-- | sc/qa/unit/helper/qahelper.cxx | 10 | ||||
-rw-r--r-- | sc/qa/unit/helper/qahelper.hxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/dptabres.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/dputil.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/global.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/address.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/compiler.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/excdoc.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/excel/xeescher.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/xltools.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/inc/xeescher.hxx | 2 | ||||
-rw-r--r-- | sc/source/filter/inc/xltools.hxx | 2 | ||||
-rw-r--r-- | sc/source/filter/oox/querytablebuffer.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/oox/stylesbuffer.cxx | 6 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlimprt.cxx | 8 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlimprt.hxx | 4 | ||||
-rw-r--r-- | sc/source/ui/condformat/condformathelper.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/inc/condformathelper.hxx | 2 |
20 files changed, 39 insertions, 31 deletions
diff --git a/sc/inc/dputil.hxx b/sc/inc/dputil.hxx index 742c69da0e6a..b3e733f40c7b 100644 --- a/sc/inc/dputil.hxx +++ b/sc/inc/dputil.hxx @@ -47,7 +47,7 @@ public: double fValue, const ScDPNumGroupInfo* pInfo, sal_Int32 nDatePart, const SvNumberFormatter* pFormatter); - SC_DLLPUBLIC static OUString getDisplayedMeasureName(const OUString& rName, ScSubTotalFunc eFunc); + SC_DLLPUBLIC static OUString getDisplayedMeasureName(std::u16string_view rName, ScSubTotalFunc eFunc); SC_DLLPUBLIC static ScSubTotalFunc toSubTotalFunc(ScGeneralFunction eGenFunc); }; diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 6e0836fe8342..f1a3559aa6ad 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -627,7 +627,7 @@ public: @param nSepCount Specifies how often cSep is inserted between two tokens. @param bForceSep true = Always insert separator; false = Only, if not at begin or end. */ SC_DLLPUBLIC static OUString addToken( - const OUString& rTokenList, const OUString& rToken, + const OUString& rTokenList, std::u16string_view rToken, sal_Unicode cSep, sal_Int32 nSepCount = 1, bool bForceSep = false ); diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 5400347324e7..051292ea52e6 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -653,7 +653,15 @@ void ScBootstrapFixture::createFileURL( rFilePath = url.GetMainURL(INetURLObject::DecodeMechanism::NONE); } -void ScBootstrapFixture::createCSVPath(const OUString& aFileBase, OUString& rCSVPath) +void ScBootstrapFixture::createCSVPath(const char* aFileBase, OUString& rCSVPath) +{ + OUStringBuffer aBuffer( m_directories.getSrcRootPath()); + aBuffer.append(EnsureSeparator(aBuffer)).append(m_aBaseString); + aBuffer.append(EnsureSeparator(aBuffer)).append("contentCSV/").appendAscii(aFileBase).append("csv"); + rCSVPath = aBuffer.makeStringAndClear(); +} + +void ScBootstrapFixture::createCSVPath(std::u16string_view aFileBase, OUString& rCSVPath) { OUStringBuffer aBuffer( m_directories.getSrcRootPath()); aBuffer.append(EnsureSeparator(aBuffer)).append(m_aBaseString); diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index 693ccbe3675f..5e1dc4cd3da4 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -188,8 +188,8 @@ public: virtual ~ScBootstrapFixture() override; void createFileURL(std::u16string_view aFileBase, const OUString& aFileExtension, OUString& rFilePath); - - void createCSVPath(const OUString& aFileBase, OUString& rCSVPath); + void createCSVPath(const char* aFileBase, OUString& rCSVPath); + void createCSVPath(std::u16string_view aFileBase, OUString& rCSVPath); ScDocShellRef saveAndReload(ScDocShell* pShell, const OUString &rFilter, const OUString &rUserData, const OUString& rTypeName, SfxFilterFlags nFormatType, const OUString* pPassword = nullptr ); diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx index c0022282a9d6..b3d1d894dd2a 100644 --- a/sc/source/core/data/dptabres.cxx +++ b/sc/source/core/data/dptabres.cxx @@ -1296,7 +1296,7 @@ void ScDPResultMember::ProcessData( const vector< SCROW >& aChildMembers, const * Parse subtotal string and replace all occurrences of '?' with the caption * string. Do ensure that escaped characters are not translated. */ -static OUString lcl_parseSubtotalName(const OUString& rSubStr, const OUString& rCaption) +static OUString lcl_parseSubtotalName(const OUString& rSubStr, std::u16string_view rCaption) { OUStringBuffer aNewStr; sal_Int32 n = rSubStr.getLength(); diff --git a/sc/source/core/data/dputil.cxx b/sc/source/core/data/dputil.cxx index 46fa54aebbb4..b3e2d7477327 100644 --- a/sc/source/core/data/dputil.cxx +++ b/sc/source/core/data/dputil.cxx @@ -387,7 +387,7 @@ const char* aFuncStrIds[] = { } -OUString ScDPUtil::getDisplayedMeasureName(const OUString& rName, ScSubTotalFunc eFunc) +OUString ScDPUtil::getDisplayedMeasureName(std::u16string_view rName, ScSubTotalFunc eFunc) { OUStringBuffer aRet; assert(unsigned(eFunc) < SAL_N_ELEMENTS(aFuncStrIds)); diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index eb7476801f99..3a87e3a95577 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -651,11 +651,11 @@ const sal_Unicode* ScGlobal::UnicodeStrChr( const sal_Unicode* pStr, return nullptr; } -OUString ScGlobal::addToken(const OUString& rTokenList, const OUString& rToken, +OUString ScGlobal::addToken(const OUString& rTokenList, std::u16string_view rToken, sal_Unicode cSep, sal_Int32 nSepCount, bool bForceSep) { OUStringBuffer aBuf(rTokenList); - if( bForceSep || (!rToken.isEmpty() && !rTokenList.isEmpty()) ) + if( bForceSep || (!rToken.empty() && !rTokenList.isEmpty()) ) comphelper::string::padToLength(aBuf, aBuf.getLength() + nSepCount, cSep); aBuf.append(rToken); return aBuf.makeStringAndClear(); diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index b8dd4c1440b6..44c8e0a90dc1 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -2002,7 +2002,7 @@ static OUString getFileNameFromDoc( const ScDocument* pDoc ) } -static void lcl_string_append(OUStringBuffer &rString, const OUString &sString) +static void lcl_string_append(OUStringBuffer &rString, std::u16string_view sString) { rString.append(sString); } diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 24c594667231..5ed09abc0b73 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -804,7 +804,7 @@ struct ConventionOOO_A1 : public Convention_A1 static void MakeOneRefStrImpl( const ScSheetLimits& rLimits, OUStringBuffer& rBuffer, - const OUString& rErrRef, const std::vector<OUString>& rTabNames, + std::u16string_view rErrRef, const std::vector<OUString>& rTabNames, const ScSingleRefData& rRef, const ScAddress& rAbsRef, bool bForceTab, bool bODF, SingletonDisplay eSingletonDisplay ) { diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx index 6bb415559869..ebc5a69f937a 100644 --- a/sc/source/filter/excel/excdoc.cxx +++ b/sc/source/filter/excel/excdoc.cxx @@ -429,7 +429,7 @@ void ExcTable::FillAsTableBinary( SCTAB nCodeNameIdx ) if (rNote.maPos.Tab() != mnScTab) continue; - mxNoteList->AppendNewRecord(new XclExpNote(GetRoot(), rNote.maPos, rNote.mpNote, OUString())); + mxNoteList->AppendNewRecord(new XclExpNote(GetRoot(), rNote.maPos, rNote.mpNote, u"")); } // WSBOOL needs data from page settings, create it here, add it later @@ -570,7 +570,7 @@ void ExcTable::FillAsTableXml() if (rNote.maPos.Tab() != mnScTab) continue; - mxNoteList->AppendNewRecord(new XclExpNote(GetRoot(), rNote.maPos, rNote.mpNote, OUString())); + mxNoteList->AppendNewRecord(new XclExpNote(GetRoot(), rNote.maPos, rNote.mpNote, u"")); } // WSBOOL needs data from page settings, create it here, add it later diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index f4f29e83e02d..68cf336c88a8 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -1448,7 +1448,7 @@ const css::uno::Reference<css::chart::XChartDocument>& XclExpChartObj::GetChartD } XclExpNote::XclExpNote(const XclExpRoot& rRoot, const ScAddress& rScPos, - const ScPostIt* pScNote, const OUString& rAddText) + const ScPostIt* pScNote, std::u16string_view rAddText) : XclExpRecord(EXC_ID_NOTE) , mrRoot(rRoot) , maScPos(rScPos) diff --git a/sc/source/filter/excel/xltools.cxx b/sc/source/filter/excel/xltools.cxx index 814817ce030f..e4ffbebce44b 100644 --- a/sc/source/filter/excel/xltools.cxx +++ b/sc/source/filter/excel/xltools.cxx @@ -549,7 +549,7 @@ const char* const ppcStyleNames[] = "Followed_Hyperlink" }; -OUString XclTools::GetBuiltInStyleName( sal_uInt8 nStyleId, const OUString& rName, sal_uInt8 nLevel ) +OUString XclTools::GetBuiltInStyleName( sal_uInt8 nStyleId, std::u16string_view rName, sal_uInt8 nLevel ) { OUString aStyleName; @@ -562,7 +562,7 @@ OUString XclTools::GetBuiltInStyleName( sal_uInt8 nStyleId, const OUString& rNam OUStringBuffer aBuf(maStyleNamePrefix1); if( nStyleId < SAL_N_ELEMENTS( ppcStyleNames ) ) aBuf.appendAscii(ppcStyleNames[nStyleId]); - else if (!rName.isEmpty()) + else if (!rName.empty()) aBuf.append(rName); else aBuf.append(static_cast<sal_Int32>(nStyleId)); diff --git a/sc/source/filter/inc/xeescher.hxx b/sc/source/filter/inc/xeescher.hxx index 1a08b6db9886..07156acbcfa5 100644 --- a/sc/source/filter/inc/xeescher.hxx +++ b/sc/source/filter/inc/xeescher.hxx @@ -349,7 +349,7 @@ public: const XclExpRoot& rRoot, const ScAddress& rScPos, const ScPostIt* pScNote, - const OUString& rAddText ); + std::u16string_view rAddText ); /** Writes the NOTE record, if the respective Escher object is present. */ virtual void Save( XclExpStream& rStrm ) override; diff --git a/sc/source/filter/inc/xltools.hxx b/sc/source/filter/inc/xltools.hxx index 9b77c88e636f..a5b413a5f03e 100644 --- a/sc/source/filter/inc/xltools.hxx +++ b/sc/source/filter/inc/xltools.hxx @@ -203,7 +203,7 @@ public: @param rName Default name for unknown styles. @param nLevel The zero-based outline level for RowLevel and ColLevel styles. @return The style name or an empty string, if the parameters are not valid. */ - static OUString GetBuiltInStyleName( sal_uInt8 nStyleId, const OUString& rName, sal_uInt8 nLevel ); + static OUString GetBuiltInStyleName( sal_uInt8 nStyleId, std::u16string_view rName, sal_uInt8 nLevel ); /** Returns true, if the passed string is a name of an Excel built-in style. @param pnStyleId If not 0, the found style identifier will be returned here. diff --git a/sc/source/filter/oox/querytablebuffer.cxx b/sc/source/filter/oox/querytablebuffer.cxx index 9ab1c550a14a..a3800acd5a81 100644 --- a/sc/source/filter/oox/querytablebuffer.cxx +++ b/sc/source/filter/oox/querytablebuffer.cxx @@ -63,9 +63,9 @@ const sal_uInt32 BIFF12_QUERYTABLE_APPLYBORDER = 0x00020000; const sal_uInt32 BIFF12_QUERYTABLE_APPLYFILL = 0x00040000; const sal_uInt32 BIFF12_QUERYTABLE_APPLYPROTECTION = 0x00080000; -void lclAppendWebQueryTableName( OUStringBuffer& rTables, const OUString& rTableName ) +void lclAppendWebQueryTableName( OUStringBuffer& rTables, std::u16string_view rTableName ) { - if( !rTableName.isEmpty() ) + if( !rTableName.empty() ) { if( !rTables.isEmpty() ) rTables.append( ';' ); diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx index 17cf305392e2..153948cd0422 100644 --- a/sc/source/filter/oox/stylesbuffer.cxx +++ b/sc/source/filter/oox/stylesbuffer.cxx @@ -2399,13 +2399,13 @@ const char* const sppcStyleNames[] = }; const sal_Int32 snStyleNamesCount = static_cast< sal_Int32 >( SAL_N_ELEMENTS( sppcStyleNames ) ); -OUString lclGetBuiltinStyleName( sal_Int32 nBuiltinId, const OUString& rName, sal_Int32 nLevel = 0 ) +OUString lclGetBuiltinStyleName( sal_Int32 nBuiltinId, std::u16string_view rName, sal_Int32 nLevel = 0 ) { OSL_ENSURE( (0 <= nBuiltinId) && (nBuiltinId < snStyleNamesCount), "lclGetBuiltinStyleName - unknown built-in style" ); OUStringBuffer aStyleName("Excel Built-in "); if( (0 <= nBuiltinId) && (nBuiltinId < snStyleNamesCount) && (sppcStyleNames[ nBuiltinId ] != nullptr) ) aStyleName.appendAscii( sppcStyleNames[ nBuiltinId ] ); - else if( !rName.isEmpty() ) + else if( !rName.empty() ) aStyleName.append( rName ); else aStyleName.append( nBuiltinId ); @@ -2678,7 +2678,7 @@ OUString CellStyleBuffer::createCellStyle( const CellStyleRef& rxCellStyle ) return rStyleName; } // on error: fallback to default style - return lclGetBuiltinStyleName( OOX_STYLE_NORMAL, OUString() ); + return lclGetBuiltinStyleName( OOX_STYLE_NORMAL, u"" ); } AutoFormatModel::AutoFormatModel() : diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index 1111f2349b99..a3b784f1b419 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -807,7 +807,7 @@ void ScXMLImport::SetConfigurationSettings(const uno::Sequence<beans::PropertyVa SvXMLUnitConverter::convertPropertySet(xProperties, aFilteredProps); } -sal_Int32 ScXMLImport::SetCurrencySymbol(const sal_Int32 nKey, const OUString& rCurrency) +sal_Int32 ScXMLImport::SetCurrencySymbol(const sal_Int32 nKey, std::u16string_view rCurrency) { uno::Reference <util::XNumberFormatsSupplier> xNumberFormatsSupplier(GetNumberFormatsSupplier()); if (xNumberFormatsSupplier.is()) @@ -913,7 +913,7 @@ bool ScXMLImport::IsCurrencySymbol(const sal_Int32 nNumberFormat, const OUString void ScXMLImport::SetType(const uno::Reference <beans::XPropertySet>& rProperties, sal_Int32& rNumberFormat, const sal_Int16 nCellType, - const OUString& rCurrency) + std::u16string_view rCurrency) { if (!mbImportStyles) return; @@ -966,7 +966,7 @@ void ScXMLImport::SetType(const uno::Reference <beans::XPropertySet>& rPropertie rProperties->setPropertyValue( gsNumberFormat, uno::makeAny(xNumberFormatTypes->getStandardFormat(nCellType, aLocale)) ); } } - else if (!rCurrency.isEmpty() && !sCurrentCurrency.isEmpty()) + else if (!rCurrency.empty() && !sCurrentCurrency.isEmpty()) { if (sCurrentCurrency != rCurrency) if (!IsCurrencySymbol(rNumberFormat, sCurrentCurrency, rCurrency)) @@ -982,7 +982,7 @@ void ScXMLImport::SetType(const uno::Reference <beans::XPropertySet>& rPropertie } else { - if ((nCellType == util::NumberFormat::CURRENCY) && !rCurrency.isEmpty() && !sCurrentCurrency.isEmpty() && + if ((nCellType == util::NumberFormat::CURRENCY) && !rCurrency.empty() && !sCurrentCurrency.isEmpty() && sCurrentCurrency != rCurrency && !IsCurrencySymbol(rNumberFormat, sCurrentCurrency, rCurrency)) rProperties->setPropertyValue( gsNumberFormat, uno::makeAny(SetCurrencySymbol(rNumberFormat, rCurrency))); } diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx index c1fa72cd7b4d..5591e4e4c7e3 100644 --- a/sc/source/filter/xml/xmlimprt.hxx +++ b/sc/source/filter/xml/xmlimprt.hxx @@ -254,12 +254,12 @@ public: virtual void SetConfigurationSettings(const css::uno::Sequence<css::beans::PropertyValue>& aConfigProps) override; ScMyStylesImportHelper* GetStylesImportHelper() { return pStylesImportHelper.get(); } - sal_Int32 SetCurrencySymbol(const sal_Int32 nKey, const OUString& rCurrency); + sal_Int32 SetCurrencySymbol(const sal_Int32 nKey, std::u16string_view rCurrency); bool IsCurrencySymbol(const sal_Int32 nNumberFormat, const OUString& sCurrencySymbol, std::u16string_view sBankSymbol); void SetType(const css::uno::Reference <css::beans::XPropertySet>& rProperties, sal_Int32& rNumberFormat, const sal_Int16 nCellType, - const OUString& rCurrency); + std::u16string_view rCurrency); void ProgressBarIncrement(); diff --git a/sc/source/ui/condformat/condformathelper.cxx b/sc/source/ui/condformat/condformathelper.cxx index 130785249469..3ae4f301a1a5 100644 --- a/sc/source/ui/condformat/condformathelper.cxx +++ b/sc/source/ui/condformat/condformathelper.cxx @@ -191,7 +191,7 @@ OUString ScCondFormatHelper::GetExpression(const ScConditionalFormat& rFormat, c } OUString ScCondFormatHelper::GetExpression( ScCondFormatEntryType eType, sal_Int32 nIndex, - const OUString& aStr1, const OUString& aStr2 ) + std::u16string_view aStr1, std::u16string_view aStr2 ) { OUStringBuffer aBuffer(getTextForType(eType)); aBuffer.append(" "); diff --git a/sc/source/ui/inc/condformathelper.hxx b/sc/source/ui/inc/condformathelper.hxx index 79de9c7d6d7b..8191c9f18726 100644 --- a/sc/source/ui/inc/condformathelper.hxx +++ b/sc/source/ui/inc/condformathelper.hxx @@ -31,7 +31,7 @@ public: static SC_DLLPUBLIC OUString GetExpression(const ScConditionalFormat& rFormat, const ScAddress& rPos); static SC_DLLPUBLIC OUString GetExpression( ScCondFormatEntryType eType, sal_Int32 nIndex, - const OUString& aStr1 = OUString(), const OUString& aStr2 = OUString() ); + std::u16string_view aStr1 = std::u16string_view(), std::u16string_view aStr2 = std::u16string_view() ); }; #endif |