basctl/source/basicide/moduldl2.cxx | 7 - basic/inc/sbxform.hxx | 2 basic/source/classes/sbunoobj.cxx | 4 basic/source/inc/sbunoobj.hxx | 7 - basic/source/sbx/sbxform.cxx | 21 ++-- basic/source/sbx/sbxscan.cxx | 5 chart2/source/inc/ObjectIdentifier.hxx | 2 chart2/source/tools/ObjectIdentifier.cxx | 34 +++--- comphelper/source/misc/storagehelper.cxx | 9 - compilerplugins/clang/stringviewparam.cxx | 3 configmgr/source/components.cxx | 5 configmgr/source/components.hxx | 2 connectivity/source/drivers/mysqlc/mysqlc_general.cxx | 55 ++++++---- connectivity/source/drivers/mysqlc/mysqlc_general.hxx | 2 connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx | 8 - connectivity/source/drivers/postgresql/pq_xcolumns.cxx | 4 cppu/source/uno/EnvStack.cxx | 13 +- cppu/source/uno/cascade_mapping.cxx | 13 +- cppuhelper/source/servicemanager.cxx | 5 cppuhelper/source/servicemanager.hxx | 2 cppuhelper/source/typemanager.cxx | 5 cppuhelper/source/typemanager.hxx | 2 cui/source/dialogs/cuifmsearch.cxx | 7 - cui/source/dialogs/multipat.cxx | 13 +- cui/source/inc/cuifmsearch.hxx | 2 cui/source/inc/multipat.hxx | 4 cui/source/inc/optpath.hxx | 2 cui/source/options/optaboutconfig.cxx | 5 cui/source/options/optaboutconfig.hxx | 2 cui/source/options/optpath.cxx | 10 - dbaccess/source/core/api/KeySet.cxx | 2 dbaccess/source/core/api/KeySet.hxx | 2 dbaccess/source/core/dataaccess/documentcontainer.cxx | 6 - dbaccess/source/core/misc/dsntypes.cxx | 4 dbaccess/source/ui/app/AppDetailPageHelper.cxx | 13 +- dbaccess/source/ui/dlg/TextConnectionHelper.cxx | 4 dbaccess/source/ui/dlg/TextConnectionHelper.hxx | 2 dbaccess/source/ui/inc/TableWindowListBox.hxx | 2 dbaccess/source/ui/inc/UITools.hxx | 2 dbaccess/source/ui/misc/UITools.cxx | 66 ++++++------ dbaccess/source/ui/querydesign/TableWindowListBox.cxx | 5 dbaccess/source/ui/tabledesign/TEditControl.cxx | 2 dbaccess/source/ui/tabledesign/TEditControl.hxx | 2 desktop/source/deployment/registry/dp_registry.cxx | 4 desktop/source/lib/init.cxx | 6 - extensions/source/propctrlr/standardcontrol.cxx | 5 extensions/source/propctrlr/stringrepresentation.cxx | 11 +- filter/source/config/cache/filtercache.cxx | 5 filter/source/config/cache/filtercache.hxx | 2 filter/source/config/cache/querytokenizer.cxx | 11 +- filter/source/config/cache/querytokenizer.hxx | 2 filter/source/svg/svgfontexport.cxx | 5 filter/source/svg/svgfontexport.hxx | 2 forms/source/xforms/convert.cxx | 4 forms/source/xforms/submission/replace.cxx | 11 +- forms/source/xforms/submission/submission.hxx | 2 framework/inc/dispatch/closedispatcher.hxx | 4 framework/inc/services/layoutmanager.hxx | 2 framework/inc/uielement/menubarmerger.hxx | 6 - framework/inc/uielement/statusbarmerger.hxx | 2 framework/inc/uielement/toolbarmerger.hxx | 4 framework/source/accelerators/keymapping.cxx | 7 - framework/source/accelerators/storageholder.cxx | 5 framework/source/dispatch/closedispatcher.cxx | 9 - framework/source/dispatch/dispatchinformationprovider.cxx | 2 framework/source/fwe/classes/sfxhelperfunctions.cxx | 4 framework/source/inc/accelerators/keymapping.hxx | 2 framework/source/inc/accelerators/storageholder.hxx | 2 framework/source/layoutmanager/helpers.cxx | 27 ++--- framework/source/layoutmanager/helpers.hxx | 6 - framework/source/layoutmanager/layoutmanager.cxx | 25 ++-- framework/source/services/pathsettings.cxx | 7 - framework/source/uielement/menubarmerger.cxx | 11 +- framework/source/uielement/statusbarmerger.cxx | 7 - framework/source/uielement/toolbarmerger.cxx | 7 - i18nlangtag/source/languagetag/languagetag.cxx | 5 include/comphelper/stl_types.hxx | 11 +- include/comphelper/storagehelper.hxx | 4 include/editeng/svxacorr.hxx | 5 include/framework/sfxhelperfunctions.hxx | 8 - include/jvmaccess/classpath.hxx | 2 include/oox/dump/dumperbase.hxx | 14 +- include/oox/helper/attributelist.hxx | 6 - include/oox/ole/axcontrol.hxx | 2 include/oox/ole/olehelper.hxx | 2 include/oox/vml/vmlshapecontext.hxx | 2 include/sfx2/docfac.hxx | 2 include/sfx2/docfilt.hxx | 2 include/sfx2/dockwin.hxx | 4 include/sfx2/fcontnr.hxx | 2 include/svtools/ctrlbox.hxx | 2 include/svtools/ctrltool.hxx | 6 - include/svx/fmsrcimp.hxx | 6 - include/svx/fmview.hxx | 2 include/svx/ruler.hxx | 2 include/svx/svdoashp.hxx | 2 include/unotools/datetime.hxx | 2 include/unotools/localedatawrapper.hxx | 2 include/unotools/moduleoptions.hxx | 2 include/vcl/graphicfilter.hxx | 2 include/vcl/syswin.hxx | 2 include/vcl/toolkit/combobox.hxx | 2 include/vcl/toolkit/svtabbx.hxx | 2 include/vcl/window.hxx | 2 include/xmloff/xmlnumfe.hxx | 2 jvmaccess/source/classpath.cxx | 5 jvmfwk/plugins/sunmajor/pluginlib/util.cxx | 13 +- l10ntools/inc/lngmerge.hxx | 4 l10ntools/source/lngmerge.cxx | 10 - oox/inc/drawingml/chart/chartdrawingfragment.hxx | 2 oox/source/docprop/docprophandler.cxx | 4 oox/source/docprop/docprophandler.hxx | 2 oox/source/drawingml/chart/chartdrawingfragment.cxx | 7 - oox/source/drawingml/customshapegeometry.cxx | 5 oox/source/dump/dumperbase.cxx | 58 ++++++----- oox/source/helper/attributelist.cxx | 12 +- oox/source/ole/axcontrol.cxx | 34 +++--- oox/source/ole/olehelper.cxx | 2 oox/source/vml/vmlshapecontext.cxx | 6 - opencl/source/openclconfig.cxx | 20 +-- package/source/xstor/ohierarchyholder.cxx | 5 package/source/xstor/ohierarchyholder.hxx | 2 sc/inc/rangelst.hxx | 2 sc/source/core/tool/rangelst.cxx | 7 - sc/source/filter/excel/xecontent.cxx | 7 - sc/source/filter/excel/xistyle.cxx | 5 sc/source/filter/ftools/ftools.cxx | 9 - sc/source/filter/html/htmlimp.cxx | 7 - sc/source/filter/inc/drawingbase.hxx | 2 sc/source/filter/inc/formulabase.hxx | 2 sc/source/filter/inc/ftools.hxx | 4 sc/source/filter/inc/htmlimp.hxx | 2 sc/source/filter/inc/workbookhelper.hxx | 2 sc/source/filter/inc/xecontent.hxx | 2 sc/source/filter/oox/drawingbase.cxx | 10 - sc/source/filter/oox/formulabase.cxx | 7 - sc/source/filter/oox/workbookhelper.cxx | 5 sc/source/filter/xml/xmlsorti.cxx | 5 sc/source/filter/xml/xmlsorti.hxx | 2 sc/source/ui/dbgui/asciiopt.cxx | 24 ++-- sc/source/ui/dbgui/imoptdlg.cxx | 8 - sc/source/ui/dbgui/scuiasciiopt.cxx | 14 +- sc/source/ui/dbgui/validate.cxx | 7 - sc/source/ui/inc/anyrefdg.hxx | 6 - sc/source/ui/inc/asciiopt.hxx | 2 sc/source/ui/inc/imoptdlg.hxx | 2 sc/source/ui/inc/linkarea.hxx | 2 sc/source/ui/inc/tabvwsh.hxx | 2 sc/source/ui/inc/viewdata.hxx | 2 sc/source/ui/miscdlgs/anyrefdg.cxx | 11 +- sc/source/ui/miscdlgs/linkarea.cxx | 7 - sc/source/ui/vba/vbarange.cxx | 2 sc/source/ui/vba/vbarange.hxx | 2 sc/source/ui/view/tabvwsh4.cxx | 2 sc/source/ui/view/viewdata.cxx | 18 +-- sd/qa/unit/export-tests-ooxml2.cxx | 16 +-- sd/qa/unit/tiledrendering/CallbackRecorder.hxx | 6 - sd/qa/unit/tiledrendering/tiledrendering.cxx | 6 - sd/source/ui/app/sdmod1.cxx | 2 sd/source/ui/dlg/tpoption.cxx | 13 +- sd/source/ui/inc/tpoption.hxx | 2 sd/source/ui/slideshow/slideshowimpl.cxx | 7 - sd/source/ui/slideshow/slideshowimpl.hxx | 2 sdext/source/minimizer/optimizerdialog.cxx | 4 sdext/source/minimizer/optimizerdialogcontrols.cxx | 4 sfx2/source/bastyp/fltfnc.cxx | 2 sfx2/source/dialog/dockwin.cxx | 9 - sfx2/source/dialog/filedlghelper.cxx | 4 sfx2/source/dialog/filedlgimpl.hxx | 2 sfx2/source/dialog/filtergrouping.cxx | 2 sfx2/source/dialog/filtergrouping.hxx | 2 sfx2/source/doc/DocumentMetadataAccess.cxx | 7 - sfx2/source/doc/docfac.cxx | 2 sfx2/source/doc/docfilt.cxx | 2 starmath/inc/view.hxx | 4 starmath/source/view.cxx | 13 +- svl/source/misc/msodocumentlockfile.cxx | 18 +-- svtools/source/control/ctrlbox.cxx | 2 svtools/source/control/ctrltool.cxx | 17 +-- svx/source/dialog/svxruler.cxx | 7 - svx/source/form/fmsrcimp.cxx | 9 - svx/source/form/fmview.cxx | 8 - svx/source/svdraw/presetooxhandleadjustmentrelations.cxx | 12 +- svx/source/svdraw/svdoashp.cxx | 13 +- sw/inc/authfld.hxx | 4 sw/inc/shellio.hxx | 2 sw/inc/unochart.hxx | 2 sw/source/core/fields/authfld.cxx | 6 - sw/source/core/inc/SwXMLBlockExport.hxx | 2 sw/source/core/inc/SwXMLTextBlocks.hxx | 4 sw/source/core/swg/SwXMLBlockExport.cxx | 6 - sw/source/core/swg/SwXMLTextBlocks.cxx | 5 sw/source/core/swg/SwXMLTextBlocks1.cxx | 2 sw/source/core/unocore/unochart.cxx | 18 +-- sw/source/core/unocore/unofield.cxx | 2 sw/source/filter/basflt/fltini.cxx | 28 ++--- sw/source/filter/html/htmlctxt.cxx | 5 sw/source/filter/html/htmlgrin.cxx | 5 sw/source/filter/html/swhtml.hxx | 4 sw/source/filter/ww8/docxattributeoutput.cxx | 4 sw/source/filter/ww8/ww8par.hxx | 4 sw/source/ui/fldui/changedb.cxx | 11 +- sw/source/uibase/dbui/mailmergehelper.cxx | 5 sw/source/uibase/envelp/labelcfg.cxx | 9 - sw/source/uibase/inc/changedb.hxx | 2 sw/source/uibase/inc/glosdoc.hxx | 6 - sw/source/uibase/inc/mailmergehelper.hxx | 2 sw/source/uibase/misc/glosdoc.cxx | 12 +- ucb/source/ucp/webdav-curl/UCBDeadPropertyValue.cxx | 21 ++-- ucb/source/ucp/webdav-curl/UCBDeadPropertyValue.hxx | 2 unoidl/source/unoidl-read.cxx | 5 unotools/source/config/moduleoptions.cxx | 23 ++-- unotools/source/i18n/localedatawrapper.cxx | 5 unotools/source/misc/datetime.cxx | 17 +-- vbahelper/source/vbahelper/vbacommandbarhelper.cxx | 9 - vbahelper/source/vbahelper/vbacommandbarhelper.hxx | 4 vcl/inc/IconThemeScanner.hxx | 4 vcl/inc/listbox.hxx | 2 vcl/inc/window.h | 2 vcl/qt5/QtTransferable.cxx | 12 +- vcl/source/app/IconThemeScanner.cxx | 7 - vcl/source/control/combobox.cxx | 2 vcl/source/control/imp_listbox.cxx | 5 vcl/source/filter/graphicfilter.cxx | 4 vcl/source/filter/webp/writer.cxx | 15 +- vcl/source/font/PhysicalFontFace.cxx | 5 vcl/source/gdi/FileDefinitionWidgetDraw.cxx | 7 - vcl/source/gdi/WidgetDefinitionReader.cxx | 73 +++++++------- vcl/source/treelist/svtabbx.cxx | 9 - vcl/source/window/syswin.cxx | 62 +++++------ vcl/source/window/window2.cxx | 29 ++--- vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx | 11 -- vcl/workben/svpclient.cxx | 13 +- writerfilter/source/dmapper/ConversionHelper.cxx | 10 - writerfilter/source/dmapper/ConversionHelper.hxx | 2 writerfilter/source/dmapper/DomainMapper_Impl.cxx | 8 - writerfilter/source/rtftok/rtfsdrimport.cxx | 16 +-- writerfilter/source/rtftok/rtfsdrimport.hxx | 6 - xmlhelp/source/cxxhelp/provider/databases.hxx | 5 xmloff/source/draw/animationimport.cxx | 20 +-- xmloff/source/draw/ximpcustomshape.cxx | 9 - xmloff/source/style/xmlnumfe.cxx | 11 +- xmlsecurity/inc/documentsignaturehelper.hxx | 2 xmlsecurity/source/helper/documentsignaturehelper.cxx | 7 - 244 files changed, 979 insertions(+), 879 deletions(-)
New commits: commit fdfd517a6f75e394ddcb1e195decbfed33ba56b9 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Apr 12 12:43:11 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Apr 13 08:38:53 2022 +0200 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.gran...@collabora.co.uk> diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index 265a5d55b746..57241bce7dde 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -63,6 +63,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/propertysequence.hxx> #include <cppuhelper/implbase.hxx> +#include <o3tl/string_view.hxx> #include <cassert> @@ -102,12 +103,12 @@ public: namespace { - int FindEntry(const weld::TreeView& rBox, const OUString& rName) + int FindEntry(const weld::TreeView& rBox, std::u16string_view rName) { int nCount = rBox.n_children(); for (int i = 0; i < nCount; ++i) { - if (rName.equalsIgnoreAsciiCase(rBox.get_text(i, 0))) + if (o3tl::equalsIgnoreAsciiCase(rName, rBox.get_text(i, 0))) return i; } return -1; @@ -1219,7 +1220,7 @@ void LibPage::SetCurLib() ImpInsertLibEntry(aLibName, nEntry++); } - int nEntry_ = FindEntry(*m_xLibBox, "Standard"); + int nEntry_ = FindEntry(*m_xLibBox, u"Standard"); if (nEntry_ == -1 && m_xLibBox->n_children()) nEntry_ = 0; m_xLibBox->set_cursor(nEntry_); diff --git a/basic/inc/sbxform.hxx b/basic/inc/sbxform.hxx index 8173c8ed87b7..8ae9cb2db3f4 100644 --- a/basic/inc/sbxform.hxx +++ b/basic/inc/sbxform.hxx @@ -95,7 +95,7 @@ class SbxBasicFormater { OUString BasicFormat( double dNumber, const OUString& sFormatStrg ); static OUString BasicFormatNull( const OUString& sFormatStrg ); - static bool isBasicFormat( const OUString& sFormatStrg ); + static bool isBasicFormat( std::u16string_view sFormatStrg ); private: static inline void ShiftString( OUStringBuffer& sStrg, sal_uInt16 nStartPos ); diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 999972c94744..3dc1b8f643a0 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -3271,14 +3271,14 @@ void VBAConstantHelper::init() } bool -VBAConstantHelper::isVBAConstantType( const OUString& rName ) +VBAConstantHelper::isVBAConstantType( std::u16string_view rName ) { init(); bool bConstant = false; for (auto const& elem : aConstCache) { - if( rName.equalsIgnoreAsciiCase(elem) ) + if( o3tl::equalsIgnoreAsciiCase(rName, elem) ) { bConstant = true; break; diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx index 1fc8ebe4e6c1..67be6f92ca5e 100644 --- a/basic/source/inc/sbunoobj.hxx +++ b/basic/source/inc/sbunoobj.hxx @@ -31,6 +31,7 @@ #include <com/sun/star/reflection/XIdlClass.hpp> #include <com/sun/star/reflection/XServiceTypeDescription2.hpp> #include <rtl/ustring.hxx> +#include <o3tl/string_view.hxx> #include <string_view> #include <unordered_map> @@ -65,9 +66,9 @@ class SbUnoStructRefObject final : public SbxObject { struct caseLessComp { - bool operator() (const OUString& rProp, std::u16string_view rOtherProp ) const + bool operator() (std::u16string_view rProp, std::u16string_view rOtherProp ) const { - return rProp.compareToIgnoreAsciiCase( rOtherProp ) < 0; + return o3tl::compareToIgnoreAsciiCase( rProp, rOtherProp ) < 0; } }; typedef std::map< OUString, std::unique_ptr<StructRefInfo>, caseLessComp > StructFieldInfo; @@ -372,7 +373,7 @@ private: public: static VBAConstantHelper& instance(); SbxVariable* getVBAConstant( const OUString& rName ); - bool isVBAConstantType( const OUString& rName ); + bool isVBAConstantType( std::u16string_view rName ); }; SbxVariable* getDefaultProp( SbxVariable* pRef ); diff --git a/basic/source/sbx/sbxform.cxx b/basic/source/sbx/sbxform.cxx index 0123dd076d02..ef273c1f392b 100644 --- a/basic/source/sbx/sbxform.cxx +++ b/basic/source/sbx/sbxform.cxx @@ -24,6 +24,7 @@ #include <rtl/ustrbuf.hxx> #include <rtl/character.hxx> +#include <o3tl/string_view.hxx> /* TODO: are there any Star-Basic characteristics unconsidered? @@ -957,41 +958,41 @@ OUString SbxBasicFormater::BasicFormat( double dNumber, const OUString& _sFormat return sReturnStrg; } -bool SbxBasicFormater::isBasicFormat( const OUString& sFormatStrg ) +bool SbxBasicFormater::isBasicFormat( std::u16string_view sFormatStrg ) { - if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_GENERALNUMBER ) ) + if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_GENERALNUMBER ) ) { return true; } - if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_CURRENCY ) ) + if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_CURRENCY ) ) { return true; } - if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_FIXED ) ) + if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_FIXED ) ) { return true; } - if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_STANDARD ) ) + if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_STANDARD ) ) { return true; } - if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_PERCENT ) ) + if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_PERCENT ) ) { return true; } - if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_SCIENTIFIC ) ) + if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_SCIENTIFIC ) ) { return true; } - if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_YESNO ) ) + if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_YESNO ) ) { return true; } - if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_TRUEFALSE ) ) + if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_TRUEFALSE ) ) { return true; } - if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_ONOFF ) ) + if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_ONOFF ) ) { return true; } diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx index 9151c34defba..ae6d50b9cfdf 100644 --- a/basic/source/sbx/sbxscan.cxx +++ b/basic/source/sbx/sbxscan.cxx @@ -48,6 +48,7 @@ #include <rtl/math.hxx> #include <svl/numformat.hxx> #include <svl/zforlist.hxx> +#include <o3tl/string_view.hxx> void ImpGetIntntlSep( sal_Unicode& rcDecimalSep, sal_Unicode& rcThousandSep, sal_Unicode& rcDecimalSepAlt ) @@ -470,12 +471,12 @@ const VbaFormatInfo pFormatInfoTable[] = { VbaFormatType::Null, std::u16string_view(u""), NF_INDEX_TABLE_ENTRIES, nullptr } }; -const VbaFormatInfo* getFormatInfo( const OUString& rFmt ) +const VbaFormatInfo* getFormatInfo( std::u16string_view rFmt ) { const VbaFormatInfo* pInfo = pFormatInfoTable; while( pInfo->meType != VbaFormatType::Null ) { - if( rFmt.equalsIgnoreAsciiCase( pInfo->mpVbaFormat ) ) + if( o3tl::equalsIgnoreAsciiCase( rFmt, pInfo->mpVbaFormat ) ) break; ++pInfo; } diff --git a/chart2/source/inc/ObjectIdentifier.hxx b/chart2/source/inc/ObjectIdentifier.hxx index 5be9d9cf3a97..834c7e814dd0 100644 --- a/chart2/source/inc/ObjectIdentifier.hxx +++ b/chart2/source/inc/ObjectIdentifier.hxx @@ -223,7 +223,7 @@ public: sal_Int32 nOffsetPercent , const css::awt::Point& rMinimumPosition , const css::awt::Point& rMaximumPosition ); - static bool parsePieSegmentDragParameterString( const OUString& rDragParameterString + static bool parsePieSegmentDragParameterString( std::u16string_view rDragParameterString , sal_Int32& rOffsetPercent , css::awt::Point& rMinimumPosition , css::awt::Point& rMaximumPosition ); diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx index 43c26d2aaf55..9e08f108b12b 100644 --- a/chart2/source/tools/ObjectIdentifier.cxx +++ b/chart2/source/tools/ObjectIdentifier.cxx @@ -173,12 +173,12 @@ OUString lcl_getIndexStringAfterString( const OUString& rString, const OUString& return aRet.makeStringAndClear(); } -sal_Int32 lcl_StringToIndex( const OUString& rIndexString ) +sal_Int32 lcl_StringToIndex( std::u16string_view rIndexString ) { sal_Int32 nRet = -1; - if( !rIndexString.isEmpty() ) + if( !rIndexString.empty() ) { - nRet = rIndexString.toInt32(); + nRet = o3tl::toInt32(rIndexString); if( nRet < -1 ) nRet = -1; } @@ -195,8 +195,8 @@ void lcl_parseAxisIndices( sal_Int32& rnDimensionIndex, sal_Int32& rnAxisIndex, { OUString aAxisIndexString = lcl_getIndexStringAfterString( rString, ":Axis=" ); sal_Int32 nCharacterIndex=0; - rnDimensionIndex = lcl_StringToIndex( aAxisIndexString.getToken( 0, ',', nCharacterIndex ) ); - rnAxisIndex = lcl_StringToIndex( aAxisIndexString.getToken( 0, ',', nCharacterIndex ) ); + rnDimensionIndex = lcl_StringToIndex( o3tl::getToken(aAxisIndexString, 0, ',', nCharacterIndex ) ); + rnAxisIndex = lcl_StringToIndex( o3tl::getToken(aAxisIndexString, 0, ',', nCharacterIndex ) ); } void lcl_parseGridIndices( sal_Int32& rnSubGridIndex, const OUString& rString ) @@ -599,35 +599,35 @@ OUString ObjectIdentifier::createPieSegmentDragParameterString( } bool ObjectIdentifier::parsePieSegmentDragParameterString( - const OUString& rDragParameterString + std::u16string_view rDragParameterString , sal_Int32& rOffsetPercent , awt::Point& rMinimumPosition , awt::Point& rMaximumPosition ) { sal_Int32 nCharacterIndex = 0; - OUString aValueString( rDragParameterString.getToken( 0, ',', nCharacterIndex ) ); - rOffsetPercent = aValueString.toInt32(); + std::u16string_view aValueString( o3tl::getToken(rDragParameterString, 0, ',', nCharacterIndex ) ); + rOffsetPercent = o3tl::toInt32(aValueString); if( nCharacterIndex < 0 ) return false; - aValueString = rDragParameterString.getToken( 0, ',', nCharacterIndex ); - rMinimumPosition.X = aValueString.toInt32(); + aValueString = o3tl::getToken(rDragParameterString, 0, ',', nCharacterIndex ); + rMinimumPosition.X = o3tl::toInt32(aValueString); if( nCharacterIndex < 0 ) return false; - aValueString = rDragParameterString.getToken( 0, ',', nCharacterIndex ); - rMinimumPosition.Y = aValueString.toInt32(); + aValueString = o3tl::getToken(rDragParameterString, 0, ',', nCharacterIndex ); + rMinimumPosition.Y = o3tl::toInt32(aValueString); if( nCharacterIndex < 0 ) return false; - aValueString = rDragParameterString.getToken( 0, ',', nCharacterIndex ); - rMaximumPosition.X = aValueString.toInt32(); + aValueString = o3tl::getToken(rDragParameterString, 0, ',', nCharacterIndex ); + rMaximumPosition.X = o3tl::toInt32(aValueString); if( nCharacterIndex < 0 ) return false; - aValueString = rDragParameterString.getToken( 0, ',', nCharacterIndex ); - rMaximumPosition.Y = aValueString.toInt32(); + aValueString = o3tl::getToken(rDragParameterString, 0, ',', nCharacterIndex ); + rMaximumPosition.Y = o3tl::toInt32(aValueString); return nCharacterIndex >= 0; } @@ -1007,7 +1007,7 @@ OUString ObjectIdentifier::createChildParticleWithIndex( ObjectType eObjectType, sal_Int32 ObjectIdentifier::getIndexFromParticleOrCID( const OUString& rParticleOrCID ) { const OUString aIndexString = lcl_getIndexStringAfterString( rParticleOrCID, "=" ); - return lcl_StringToIndex( aIndexString.getToken( 0, ',' ) ); + return lcl_StringToIndex( o3tl::getToken(aIndexString, 0, ',' ) ); } OUString ObjectIdentifier::createSeriesSubObjectStub( ObjectType eSubObjectType diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx index b850d7d70197..b2a4512e4e79 100644 --- a/comphelper/source/misc/storagehelper.cxx +++ b/comphelper/source/misc/storagehelper.cxx @@ -607,11 +607,10 @@ void LifecycleProxy::commitStorages() }); } -static void splitPath( std::vector<OUString> &rElems, - const OUString& rPath ) +static void splitPath( std::vector<OUString> &rElems, std::u16string_view rPath ) { for (sal_Int32 i = 0; i >= 0;) - rElems.push_back( rPath.getToken( 0, '/', i ) ); + rElems.push_back( OUString(o3tl::getToken(rPath, 0, '/', i )) ); } static uno::Reference< embed::XStorage > LookupStorageAtPath( @@ -631,7 +630,7 @@ static uno::Reference< embed::XStorage > LookupStorageAtPath( uno::Reference< embed::XStorage > OStorageHelper::GetStorageAtPath( const uno::Reference< embed::XStorage > &xStorage, - const OUString& rPath, sal_uInt32 nOpenMode, + std::u16string_view rPath, sal_uInt32 nOpenMode, LifecycleProxy const &rNastiness ) { std::vector<OUString> aElems; @@ -641,7 +640,7 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageAtPath( uno::Reference< io::XStream > OStorageHelper::GetStreamAtPath( const uno::Reference< embed::XStorage > &xParentStorage, - const OUString& rPath, sal_uInt32 nOpenMode, + std::u16string_view rPath, sal_uInt32 nOpenMode, LifecycleProxy const &rNastiness ) { std::vector<OUString> aElems; diff --git a/compilerplugins/clang/stringviewparam.cxx b/compilerplugins/clang/stringviewparam.cxx index e0ca76ead49a..10b7bd7e9c16 100644 --- a/compilerplugins/clang/stringviewparam.cxx +++ b/compilerplugins/clang/stringviewparam.cxx @@ -139,7 +139,8 @@ DeclRefExpr const* relevantCXXMemberCallExpr(CXXMemberCallExpr const* expr) auto const n = i->getName(); if (n == "endsWith" || n == "isEmpty" || n == "startsWith" || n == "subView" || n == "indexOf" || n == "lastIndexOf" || n == "compareTo" || n == "match" - || n == "trim") + || n == "trim" || n == "toInt32" || n == "toInt64" || n == "toDouble" + || n == "equalsIgnoreAsciiCase" || n == "compareToIgnoreAsciiCase" || n == "getToken") { good = true; } diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx index 3863103e2763..cf1375956571 100644 --- a/configmgr/source/components.cxx +++ b/configmgr/source/components.cxx @@ -51,6 +51,7 @@ #include <salhelper/thread.hxx> #include <tools/diagnose_ex.h> #include <comphelper/backupfilehelper.hxx> +#include <o3tl/string_view.hxx> #include "additions.hxx" #include "components.hxx" @@ -715,11 +716,11 @@ void Components::parseFiles( } void Components::parseFileList( - int layer, FileParser * parseFile, OUString const & urls, + int layer, FileParser * parseFile, std::u16string_view urls, bool recordAdditions) { for (sal_Int32 i = 0;;) { - OUString url(urls.getToken(0, ' ', i)); + OUString url(o3tl::getToken(urls, 0, ' ', i)); if (!url.isEmpty()) { Additions * adds = nullptr; if (recordAdditions) { diff --git a/configmgr/source/components.hxx b/configmgr/source/components.hxx index a44097810015..08f14a8b7bf9 100644 --- a/configmgr/source/components.hxx +++ b/configmgr/source/components.hxx @@ -122,7 +122,7 @@ private: OUString const & url, bool recursive); void parseFileList( - int layer, FileParser * parseFile, OUString const & urls, + int layer, FileParser * parseFile, std::u16string_view urls, bool recordAdditions); void parseXcdFiles(int layer, OUString const & url); diff --git a/connectivity/source/drivers/mysqlc/mysqlc_general.cxx b/connectivity/source/drivers/mysqlc/mysqlc_general.cxx index 17b118c531a9..bc57770413f5 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_general.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_general.cxx @@ -20,6 +20,7 @@ #include <sal/log.hxx> #include <rtl/ustring.hxx> +#include <o3tl/string_view.hxx> #include <com/sun/star/sdbc/DataType.hpp> @@ -192,50 +193,58 @@ sal_Int32 mysqlToOOOType(int eType, int charsetnr) noexcept return css::sdbc::DataType::VARCHAR; } -sal_Int32 mysqlStrToOOOType(const OUString& sType) +sal_Int32 mysqlStrToOOOType(std::u16string_view sType) { // TODO other types. - if (sType.equalsIgnoreAsciiCase("tiny") || sType.equalsIgnoreAsciiCase("tinyint")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"tiny") + || o3tl::equalsIgnoreAsciiCase(sType, u"tinyint")) return css::sdbc::DataType::TINYINT; - if (sType.equalsIgnoreAsciiCase("smallint") || sType.equalsIgnoreAsciiCase("year")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"smallint") + || o3tl::equalsIgnoreAsciiCase(sType, u"year")) return css::sdbc::DataType::SMALLINT; - if (sType.equalsIgnoreAsciiCase("int") || sType.equalsIgnoreAsciiCase("mediumint")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"int") + || o3tl::equalsIgnoreAsciiCase(sType, u"mediumint")) return css::sdbc::DataType::INTEGER; - if (sType.equalsIgnoreAsciiCase("varchar") || sType.equalsIgnoreAsciiCase("set") - || sType.equalsIgnoreAsciiCase("enum")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"varchar") || o3tl::equalsIgnoreAsciiCase(sType, u"set") + || o3tl::equalsIgnoreAsciiCase(sType, u"enum")) return css::sdbc::DataType::VARCHAR; - if (sType.equalsIgnoreAsciiCase("bigint")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"bigint")) return css::sdbc::DataType::BIGINT; - if (sType.equalsIgnoreAsciiCase("blob") || sType.equalsIgnoreAsciiCase("longblob") - || sType.equalsIgnoreAsciiCase("tinyblob") || sType.equalsIgnoreAsciiCase("mediumblob")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"blob") + || o3tl::equalsIgnoreAsciiCase(sType, u"longblob") + || o3tl::equalsIgnoreAsciiCase(sType, u"tinyblob") + || o3tl::equalsIgnoreAsciiCase(sType, u"mediumblob")) return css::sdbc::DataType::BLOB; - if (sType.equalsIgnoreAsciiCase("varbinary")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"varbinary")) return css::sdbc::DataType::VARBINARY; - if (sType.equalsIgnoreAsciiCase("char")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"char")) return css::sdbc::DataType::CHAR; - if (sType.equalsIgnoreAsciiCase("tinytext")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"tinytext")) return css::sdbc::DataType::VARCHAR; - if (sType.equalsIgnoreAsciiCase("text")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"text")) return css::sdbc::DataType::LONGVARCHAR; - if (sType.equalsIgnoreAsciiCase("mediumtext") || sType.equalsIgnoreAsciiCase("longtext")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"mediumtext") + || o3tl::equalsIgnoreAsciiCase(sType, u"longtext")) return css::sdbc::DataType::CLOB; - if (sType.equalsIgnoreAsciiCase("binary")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"binary")) return css::sdbc::DataType::BINARY; - if (sType.equalsIgnoreAsciiCase("time")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"time")) return css::sdbc::DataType::TIME; - if (sType.equalsIgnoreAsciiCase("date")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"date")) return css::sdbc::DataType::DATE; - if (sType.equalsIgnoreAsciiCase("datetime") || sType.equalsIgnoreAsciiCase("timestamp")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"datetime") + || o3tl::equalsIgnoreAsciiCase(sType, u"timestamp")) return css::sdbc::DataType::TIMESTAMP; - if (sType.equalsIgnoreAsciiCase("decimal")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"decimal")) return css::sdbc::DataType::DECIMAL; - if (sType.equalsIgnoreAsciiCase("real") || sType.equalsIgnoreAsciiCase("float")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"real") || o3tl::equalsIgnoreAsciiCase(sType, u"float")) return css::sdbc::DataType::REAL; - if (sType.equalsIgnoreAsciiCase("double")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"double")) return css::sdbc::DataType::DOUBLE; - if (sType.equalsIgnoreAsciiCase("bit")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"bit")) return css::sdbc::DataType::BIT; - if (sType.equalsIgnoreAsciiCase("bool") || sType.equalsIgnoreAsciiCase("boolean")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"bool") + || o3tl::equalsIgnoreAsciiCase(sType, u"boolean")) return css::sdbc::DataType::BOOLEAN; OSL_FAIL("Unknown type name from string, failing back to varchar."); return css::sdbc::DataType::VARCHAR; diff --git a/connectivity/source/drivers/mysqlc/mysqlc_general.hxx b/connectivity/source/drivers/mysqlc/mysqlc_general.hxx index 2a78c7628879..16236e1530ed 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_general.hxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_general.hxx @@ -108,7 +108,7 @@ sal_Int32 mysqlToOOOType(int eType, int charsetnr) noexcept; OUString mysqlTypeToStr(unsigned mysql_type, unsigned mysql_flags); -sal_Int32 mysqlStrToOOOType(const OUString& sType); +sal_Int32 mysqlStrToOOOType(std::u16string_view sType); OUString convert(const ::std::string& _string, const rtl_TextEncoding encoding); } diff --git a/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx b/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx index 182e74b7fcb9..2feb2d2688d1 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx @@ -30,6 +30,7 @@ #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/typeprovider.hxx> #include <comphelper/seqstream.hxx> +#include <o3tl/string_view.hxx> using namespace rtl; @@ -51,14 +52,13 @@ namespace { // copied from string misc, it should be replaced when library is not an // extension anymore -std::vector<OString> lcl_split(const OString& rStr, char cSeparator) +std::vector<OString> lcl_split(std::string_view rStr, char cSeparator) { std::vector<OString> vec; sal_Int32 idx = 0; do { - OString kw = rStr.getToken(0, cSeparator, idx); - kw = kw.trim(); + OString kw(o3tl::trim(o3tl::getToken(rStr, 0, cSeparator, idx))); if (!kw.isEmpty()) { vec.push_back(kw); @@ -507,7 +507,7 @@ DateTime SAL_CALL OResultSet::getTimestamp(sal_Int32 column) // YY-MM-DD HH:MM:SS std::vector<OString> dateAndTime - = lcl_split(OString{ sVal.getStr(), getDataLength(column) }, ' '); + = lcl_split(std::string_view(sVal.getStr(), getDataLength(column)), ' '); auto dateParts = lcl_split(dateAndTime.at(0), '-'); auto timeParts = lcl_split(dateAndTime.at(1), ':'); diff --git a/connectivity/source/drivers/postgresql/pq_xcolumns.cxx b/connectivity/source/drivers/postgresql/pq_xcolumns.cxx index 82d595628db3..95c4db003314 100644 --- a/connectivity/source/drivers/postgresql/pq_xcolumns.cxx +++ b/connectivity/source/drivers/postgresql/pq_xcolumns.cxx @@ -75,9 +75,9 @@ using com::sun::star::sdbc::SQLException; namespace pq_sdbc_driver { -static Any isCurrency( const OUString & typeName ) +static Any isCurrency( std::u16string_view typeName ) { - return Any( typeName.equalsIgnoreAsciiCase("money") ); + return Any( o3tl::equalsIgnoreAsciiCase(typeName, u"money") ); } // static sal_Bool isAutoIncrement8( const OUString & typeName ) diff --git a/cppu/source/uno/EnvStack.cxx b/cppu/source/uno/EnvStack.cxx index 2356948c51c5..880b922886d1 100644 --- a/cppu/source/uno/EnvStack.cxx +++ b/cppu/source/uno/EnvStack.cxx @@ -25,6 +25,7 @@ #include <osl/thread.h> #include <osl/thread.hxx> +#include <o3tl/string_view.hxx> #include <mutex> #include <unordered_map> @@ -140,22 +141,22 @@ extern "C" void SAL_CALL uno_getCurrentEnvironment(uno_Environment ** ppEnv, rtl } } -static OUString s_getPrefix(OUString const & str1, OUString const & str2) +static OUString s_getPrefix(OUString const & str1, std::u16string_view str2) { sal_Int32 nIndex1 = 0; sal_Int32 nIndex2 = 0; sal_Int32 sim = 0; - OUString token1; - OUString token2; + std::u16string_view token1; + std::u16string_view token2; do { - token1 = str1.getToken(0, ':', nIndex1); - token2 = str2.getToken(0, ':', nIndex2); + token1 = o3tl::getToken(str1, 0, ':', nIndex1); + token2 = o3tl::getToken(str2, 0, ':', nIndex2); if (token1 == token2) - sim += token1.getLength() + 1; + sim += token1.size() + 1; } while(nIndex1 == nIndex2 && nIndex1 >= 0 && token1 == token2); diff --git a/cppu/source/uno/cascade_mapping.cxx b/cppu/source/uno/cascade_mapping.cxx index e19173bcff4c..dbfbfc6c4dba 100644 --- a/cppu/source/uno/cascade_mapping.cxx +++ b/cppu/source/uno/cascade_mapping.cxx @@ -23,6 +23,7 @@ #include <uno/lbnames.h> #include <uno/mapping.hxx> #include <uno/dispatcher.h> +#include <o3tl/string_view.hxx> #include <cppu/EnvDcp.hxx> @@ -155,22 +156,22 @@ extern "C" { static void s_MediatorMapping_free(uno_Mapping * pMapping) }} -static OUString getPrefix(OUString const & str1, OUString const & str2) +static OUString getPrefix(OUString const & str1, std::u16string_view str2) { sal_Int32 nIndex1 = 0; sal_Int32 nIndex2 = 0; sal_Int32 sim = 0; - OUString token1; - OUString token2; + std::u16string_view token1; + std::u16string_view token2; do { - token1 = str1.getToken(0, ':', nIndex1); - token2 = str2.getToken(0, ':', nIndex2); + token1 = o3tl::getToken(str1, 0, ':', nIndex1); + token2 = o3tl::getToken(str2, 0, ':', nIndex2); if (token1 == token2) - sim += token1.getLength() + 1; + sim += token1.size() + 1; } while(nIndex1 == nIndex2 && nIndex1 >= 0 && token1 == token2); diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx index 6e2f12813445..44044e28a54e 100644 --- a/cppuhelper/source/servicemanager.cxx +++ b/cppuhelper/source/servicemanager.cxx @@ -46,6 +46,7 @@ #include <sal/log.hxx> #include <uno/environment.hxx> #include <uno/mapping.hxx> +#include <o3tl/string_view.hxx> #include "loadsharedlibcomponentfactory.hxx" @@ -1322,9 +1323,9 @@ void cppuhelper::ServiceManager::removeEventListenerFromComponent( } } -void cppuhelper::ServiceManager::init(OUString const & rdbUris) { +void cppuhelper::ServiceManager::init(std::u16string_view rdbUris) { for (sal_Int32 i = 0; i != -1;) { - OUString uri(rdbUris.getToken(0, ' ', i)); + OUString uri(o3tl::getToken(rdbUris, 0, ' ', i)); if (uri.isEmpty()) { continue; } diff --git a/cppuhelper/source/servicemanager.hxx b/cppuhelper/source/servicemanager.hxx index d086a8d65ead..537194151735 100644 --- a/cppuhelper/source/servicemanager.hxx +++ b/cppuhelper/source/servicemanager.hxx @@ -193,7 +193,7 @@ public: using ServiceManagerBase::acquire; using ServiceManagerBase::release; - void init(OUString const & rdbUris); + void init(std::u16string_view rdbUris); void setContext( css::uno::Reference< css::uno::XComponentContext > const & context) diff --git a/cppuhelper/source/typemanager.cxx b/cppuhelper/source/typemanager.cxx index 30c1555de137..28ef85189f29 100644 --- a/cppuhelper/source/typemanager.cxx +++ b/cppuhelper/source/typemanager.cxx @@ -53,6 +53,7 @@ #include <sal/log.hxx> #include <sal/macros.h> #include <sal/types.h> +#include <o3tl/string_view.hxx> #include <unoidl/unoidl.hxx> @@ -2023,9 +2024,9 @@ cppuhelper::TypeManager::createTypeDescriptionEnumeration( depth == css::reflection::TypeDescriptionSearchDepth_INFINITE); } -void cppuhelper::TypeManager::init(OUString const & rdbUris) { +void cppuhelper::TypeManager::init(std::u16string_view rdbUris) { for (sal_Int32 i = 0; i != -1;) { - OUString uri(rdbUris.getToken(0, ' ', i)); + OUString uri(o3tl::getToken(rdbUris, 0, ' ', i)); if (uri.isEmpty()) { continue; } diff --git a/cppuhelper/source/typemanager.hxx b/cppuhelper/source/typemanager.hxx index dcd415b888b1..1ee264bf16ff 100644 --- a/cppuhelper/source/typemanager.hxx +++ b/cppuhelper/source/typemanager.hxx @@ -47,7 +47,7 @@ public: using TypeManager_Base::acquire; using TypeManager_Base::release; - void init(OUString const & rdbUris); + void init(std::u16string_view rdbUris); css::uno::Any find(OUString const & name); 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); diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index ba712b574bc4..9cf07310502d 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -1379,7 +1379,7 @@ namespace dbaccess void getColumnPositions(const Reference<XNameAccess>& _rxQueryColumns, const css::uno::Sequence< OUString >& _aColumnNames, - const OUString& _rsUpdateTableName, + std::u16string_view _rsUpdateTableName, SelectColumnsMetaData& o_rColumnNames, bool i_bAppendTableName) { diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx index e5d3c61ea5ac..57889c7743b2 100644 --- a/dbaccess/source/core/api/KeySet.hxx +++ b/dbaccess/source/core/api/KeySet.hxx @@ -63,7 +63,7 @@ namespace dbaccess // the elements of _rxQueryColumns must have the properties PROPERTY_REALNAME and PROPERTY_TABLENAME void getColumnPositions(const css::uno::Reference< css::container::XNameAccess >& _rxQueryColumns, const css::uno::Sequence< OUString >& _rColumnNames, - const OUString& _rsUpdateTableName, + std::u16string_view _rsUpdateTableName, SelectColumnsMetaData& o_rColumnNames /* out */, bool i_bAppendTableName = false); diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx index ffbabde52f76..1a4eedac9532 100644 --- a/dbaccess/source/core/dataaccess/documentcontainer.cxx +++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx @@ -493,10 +493,10 @@ Any SAL_CALL ODocumentContainer::execute( const Command& aCommand, sal_Int32 Com namespace { - bool lcl_queryContent(const OUString& _sName,Reference< XNameContainer >& _xNameContainer,Any& _rRet,OUString& _sSimpleName) + bool lcl_queryContent(std::u16string_view _sName,Reference< XNameContainer >& _xNameContainer,Any& _rRet,OUString& _sSimpleName) { sal_Int32 nIndex = 0; - OUString sName = _sName.getToken(0,'/',nIndex); + OUString sName( o3tl::getToken(_sName,0,'/',nIndex) ); bool bRet = _xNameContainer->hasByName(sName); if ( bRet ) { @@ -504,7 +504,7 @@ namespace _rRet = _xNameContainer->getByName(_sSimpleName); while ( nIndex != -1 && bRet ) { - sName = _sName.getToken(0,'/',nIndex); + sName = o3tl::getToken(_sName,0,'/',nIndex); _xNameContainer.set(_rRet,UNO_QUERY); bRet = _xNameContainer.is(); if ( bRet ) diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx index b05cd467da81..25513b36c952 100644 --- a/dbaccess/source/core/misc/dsntypes.cxx +++ b/dbaccess/source/core/misc/dsntypes.cxx @@ -36,12 +36,12 @@ namespace dbaccess namespace { - void lcl_extractHostAndPort(const OUString& _sUrl,OUString& _sHostname,sal_Int32& _nPortNumber) + void lcl_extractHostAndPort(std::u16string_view _sUrl, OUString& _sHostname, sal_Int32& _nPortNumber) { if ( comphelper::string::getTokenCount(_sUrl, ':') >= 2 ) { sal_Int32 nPos {0}; - _sHostname = _sUrl.getToken(0, ':', nPos); + _sHostname = o3tl::getToken(_sUrl, 0, ':', nPos); _nPortNumber = o3tl::toInt32(o3tl::getToken(_sUrl, 0, ':', nPos)); } } diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx index 4e9bb41cb63c..9533ec087c14 100644 --- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx +++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/util/XCloseable.hpp> #include <comphelper/propertyvalue.hxx> #include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include "AppView.hxx" #include <helpids.h> #include <strings.hxx> @@ -79,11 +80,11 @@ namespace dbaui namespace { - bool lcl_findEntry_impl(const TreeListBox& rTree, const OUString& rName, weld::TreeIter& rIter) + bool lcl_findEntry_impl(const TreeListBox& rTree, std::u16string_view rName, weld::TreeIter& rIter) { bool bReturn = false; sal_Int32 nIndex = 0; - OUString sName( rName.getToken(0,'/',nIndex) ); + std::u16string_view sName( o3tl::getToken(rName,0,'/',nIndex) ); const weld::TreeView& rTreeView = rTree.GetWidget(); bool bEntry = true; @@ -93,7 +94,7 @@ namespace { if ( nIndex != -1 ) { - sName = rName.getToken(0,'/',nIndex); + sName = o3tl::getToken(rName,0,'/',nIndex); bEntry = rTreeView.iter_children(rIter); } else @@ -110,11 +111,11 @@ namespace return bReturn; } - bool lcl_findEntry(const TreeListBox& rTree, const OUString& rName, weld::TreeIter& rIter) + bool lcl_findEntry(const TreeListBox& rTree, std::u16string_view rName, weld::TreeIter& rIter) { sal_Int32 nIndex = 0; - OUString sErase = rName.getToken(0,'/',nIndex); // we don't want to have the "private:forms" part - return nIndex != -1 && lcl_findEntry_impl(rTree, rName.copy(sErase.getLength() + 1), rIter); + std::u16string_view sErase = o3tl::getToken(rName,0,'/',nIndex); // we don't want to have the "private:forms" part + return nIndex != -1 && lcl_findEntry_impl(rTree, rName.substr(sErase.size() + 1), rIter); } } diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx index 1dee8a1f57e2..caac1d968779 100644 --- a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx @@ -366,7 +366,7 @@ namespace dbaui return OUString(); } - void OTextConnectionHelper::SetSeparator( weld::ComboBox& rBox, const OUString& rList, const OUString& rVal ) + void OTextConnectionHelper::SetSeparator( weld::ComboBox& rBox, std::u16string_view rList, const OUString& rVal ) { if (rVal.getLength()==1) { @@ -376,7 +376,7 @@ namespace dbaui sal_Int32 nPrevIdx {nIdx}; if (static_cast<sal_Unicode>(o3tl::toInt32(o3tl::getToken(rList, 1, '\t', nIdx))) == nVal) { - rBox.set_entry_text(rList.getToken(0, '\t', nPrevIdx)); + rBox.set_entry_text(OUString(o3tl::getToken(rList,0, '\t', nPrevIdx))); return; } } diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.hxx b/dbaccess/source/ui/dlg/TextConnectionHelper.hxx index 5fface3d0512..6755a422378e 100644 --- a/dbaccess/source/ui/dlg/TextConnectionHelper.hxx +++ b/dbaccess/source/ui/dlg/TextConnectionHelper.hxx @@ -72,7 +72,7 @@ namespace dbaui DECL_LINK(OnEditModified, weld::Entry&, void); OUString GetSeparator(const weld::ComboBox& rBox, std::u16string_view rList); - void SetSeparator(weld::ComboBox& rBox, const OUString& rList, const OUString& rVal); + void SetSeparator(weld::ComboBox& rBox, std::u16string_view rList, const OUString& rVal); void SetExtension(const OUString& _rVal); public: diff --git a/dbaccess/source/ui/inc/TableWindowListBox.hxx b/dbaccess/source/ui/inc/TableWindowListBox.hxx index 0d3890cf26c7..cdad4947ca8d 100644 --- a/dbaccess/source/ui/inc/TableWindowListBox.hxx +++ b/dbaccess/source/ui/inc/TableWindowListBox.hxx @@ -90,7 +90,7 @@ namespace dbaui virtual void Command(const CommandEvent& rEvt) override; OTableWindow* GetTabWin(){ return m_pTabWin; } - int GetEntryFromText( const OUString& rEntryText ); + int GetEntryFromText( std::u16string_view rEntryText ); }; class TableWindowListBoxHelper final : public DropTargetHelper diff --git a/dbaccess/source/ui/inc/UITools.hxx b/dbaccess/source/ui/inc/UITools.hxx index 34249933f9b6..c622c73f65c5 100644 --- a/dbaccess/source/ui/inc/UITools.hxx +++ b/dbaccess/source/ui/inc/UITools.hxx @@ -115,7 +115,7 @@ namespace dbaui @param _rTypeInfoIters the vector filled with map iterators */ void fillTypeInfo( const css::uno::Reference< css::sdbc::XConnection>& _rxConnection, - const OUString& _rsTypeNames, + std::u16string_view _rsTypeNames, OTypeInfoMap& _rTypeInfoMap, std::vector<OTypeInfoMap::iterator>& _rTypeInfoIters); diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index fca7026cf9e2..e5f595d72446 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -395,7 +395,7 @@ TOTypeInfoSP getTypeInfoFromType(const OTypeInfoMap& _rTypeInfo, } void fillTypeInfo( const Reference< css::sdbc::XConnection>& _rxConnection, - const OUString& _rsTypeNames, + std::u16string_view _rsTypeNames, OTypeInfoMap& _rTypeInfoMap, std::vector<OTypeInfoMap::iterator>& _rTypeInfoIters) { @@ -489,108 +489,108 @@ void fillTypeInfo( const Reference< css::sdbc::XConnection>& _rxConnection, if( pInfo->nNumPrecRadix <= 1) pInfo->nNumPrecRadix = 10; - OUString aName; + std::u16string_view aName; switch(pInfo->nType) { case DataType::CHAR: - aName = _rsTypeNames.getToken(TYPE_CHAR, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_CHAR, ';'); break; case DataType::VARCHAR: - aName = _rsTypeNames.getToken(TYPE_TEXT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_TEXT, ';'); break; case DataType::DECIMAL: - aName = _rsTypeNames.getToken(TYPE_DECIMAL, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_DECIMAL, ';'); break; case DataType::NUMERIC: - aName = _rsTypeNames.getToken(TYPE_NUMERIC, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_NUMERIC, ';'); break; case DataType::BIGINT: - aName = _rsTypeNames.getToken(TYPE_BIGINT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_BIGINT, ';'); break; case DataType::FLOAT: - aName = _rsTypeNames.getToken(TYPE_FLOAT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_FLOAT, ';'); break; case DataType::DOUBLE: - aName = _rsTypeNames.getToken(TYPE_DOUBLE, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_DOUBLE, ';'); break; case DataType::LONGVARCHAR: - aName = _rsTypeNames.getToken(TYPE_MEMO, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_MEMO, ';'); break; case DataType::LONGVARBINARY: - aName = _rsTypeNames.getToken(TYPE_IMAGE, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_IMAGE, ';'); break; case DataType::DATE: - aName = _rsTypeNames.getToken(TYPE_DATE, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_DATE, ';'); break; case DataType::TIME: - aName = _rsTypeNames.getToken(TYPE_TIME, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_TIME, ';'); break; case DataType::TIMESTAMP: - aName = _rsTypeNames.getToken(TYPE_DATETIME, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_DATETIME, ';'); break; case DataType::BIT: if ( !pInfo->aCreateParams.isEmpty() ) { - aName = _rsTypeNames.getToken(TYPE_BIT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_BIT, ';'); break; } [[fallthrough]]; case DataType::BOOLEAN: - aName = _rsTypeNames.getToken(TYPE_BOOL, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_BOOL, ';'); break; case DataType::TINYINT: - aName = _rsTypeNames.getToken(TYPE_TINYINT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_TINYINT, ';'); break; case DataType::SMALLINT: - aName = _rsTypeNames.getToken(TYPE_SMALLINT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_SMALLINT, ';'); break; case DataType::INTEGER: - aName = _rsTypeNames.getToken(TYPE_INTEGER, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_INTEGER, ';'); break; case DataType::REAL: - aName = _rsTypeNames.getToken(TYPE_REAL, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_REAL, ';'); break; case DataType::BINARY: - aName = _rsTypeNames.getToken(TYPE_BINARY, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_BINARY, ';'); break; case DataType::VARBINARY: - aName = _rsTypeNames.getToken(TYPE_VARBINARY, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_VARBINARY, ';'); break; case DataType::SQLNULL: - aName = _rsTypeNames.getToken(TYPE_SQLNULL, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_SQLNULL, ';'); break; case DataType::OBJECT: - aName = _rsTypeNames.getToken(TYPE_OBJECT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_OBJECT, ';'); break; case DataType::DISTINCT: - aName = _rsTypeNames.getToken(TYPE_DISTINCT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_DISTINCT, ';'); break; case DataType::STRUCT: - aName = _rsTypeNames.getToken(TYPE_STRUCT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_STRUCT, ';'); break; case DataType::ARRAY: - aName = _rsTypeNames.getToken(TYPE_ARRAY, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_ARRAY, ';'); break; case DataType::BLOB: - aName = _rsTypeNames.getToken(TYPE_BLOB, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_BLOB, ';'); break; case DataType::CLOB: - aName = _rsTypeNames.getToken(TYPE_CLOB, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_CLOB, ';'); break; case DataType::REF: - aName = _rsTypeNames.getToken(TYPE_REF, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_REF, ';'); break; case DataType::OTHER: - aName = _rsTypeNames.getToken(TYPE_OTHER, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_OTHER, ';'); break; } - if ( !aName.isEmpty() ) + if ( !aName.empty() ) { pInfo->aUIName = aName; pInfo->aUIName += " [ "; } pInfo->aUIName += pInfo->aTypeName; - if ( !aName.isEmpty() ) + if ( !aName.empty() ) pInfo->aUIName += " ]"; // Now that we have the type info, save it in the multimap _rTypeInfoMap.emplace(pInfo->nType,pInfo); diff --git a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx index a1a8a17c4735..3066f8429f35 100644 --- a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx +++ b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx @@ -28,6 +28,7 @@ #include <com/sun/star/sdbc/SQLException.hpp> #include <vcl/svapp.hxx> #include <vcl/commandevent.hxx> +#include <o3tl/string_view.hxx> using namespace dbaui; using namespace ::com::sun::star::sdbc; @@ -92,7 +93,7 @@ void OTableWindowListBox::dispose() InterimItemWindow::dispose(); } -int OTableWindowListBox::GetEntryFromText(const OUString& rEntryText) +int OTableWindowListBox::GetEntryFromText(std::u16string_view rEntryText) { // iterate through the list OJoinDesignView* pView = m_pTabWin->getDesignView(); @@ -111,7 +112,7 @@ int OTableWindowListBox::GetEntryFromText(const OUString& rEntryText) for (int nEntry = 0, nCount = m_xTreeView->n_children(); nEntry < nCount; ++nEntry) { if (bCase ? rEntryText == m_xTreeView->get_text(nEntry) - : rEntryText.equalsIgnoreAsciiCase(m_xTreeView->get_text(nEntry))) + : o3tl::equalsIgnoreAsciiCase(rEntryText, m_xTreeView->get_text(nEntry))) return nEntry; } } diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx index 728b21cf55d6..119791a7c438 100644 --- a/dbaccess/source/ui/tabledesign/TEditControl.cxx +++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx @@ -477,7 +477,7 @@ void OTableEditorCtrl::CursorMoved() OTableRowView::CursorMoved(); } -sal_Int32 OTableEditorCtrl::HasFieldName( const OUString& rFieldName ) +sal_Int32 OTableEditorCtrl::HasFieldName( std::u16string_view rFieldName ) { Reference<XConnection> xCon = GetView()->getController().getConnection(); diff --git a/dbaccess/source/ui/tabledesign/TEditControl.hxx b/dbaccess/source/ui/tabledesign/TEditControl.hxx index 74e3594cf0b2..7b1d467815db 100644 --- a/dbaccess/source/ui/tabledesign/TEditControl.hxx +++ b/dbaccess/source/ui/tabledesign/TEditControl.hxx @@ -176,7 +176,7 @@ namespace dbaui DECL_LINK( InvalidateFieldType, void*, void ); void InitCellController(); - sal_Int32 HasFieldName( const OUString& rFieldName ); + sal_Int32 HasFieldName( std::u16string_view rFieldName ); OUString GenerateName( const OUString& rName ); bool SetDataPtr( sal_Int32 nRow ); diff --git a/desktop/source/deployment/registry/dp_registry.cxx b/desktop/source/deployment/registry/dp_registry.cxx index 17b9b774a17d..9932dc6f6b64 100644 --- a/desktop/source/deployment/registry/dp_registry.cxx +++ b/desktop/source/deployment/registry/dp_registry.cxx @@ -72,8 +72,8 @@ class PackageRegistryImpl : private cppu::BaseMutex, public t_helper } }; struct ci_string_equals { - bool operator () ( OUString const & str1, std::u16string_view str2 ) const{ - return str1.equalsIgnoreAsciiCase( str2 ); + bool operator () ( std::u16string_view str1, std::u16string_view str2 ) const{ + return o3tl::equalsIgnoreAsciiCase( str1, str2 ); } }; typedef std::unordered_map< diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 017a5838c93b..33b763b3a1cb 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1181,19 +1181,19 @@ rtl::Reference<LOKClipboard> forceSetClipboardForCurrentView(LibreOfficeKitDocum #endif -const vcl::Font* FindFont(const OUString& rFontName) +const vcl::Font* FindFont(std::u16string_view rFontName) { SfxObjectShell* pDocSh = SfxObjectShell::Current(); const SvxFontListItem* pFonts = static_cast<const SvxFontListItem*>(pDocSh->GetItem(SID_ATTR_CHAR_FONTLIST)); const FontList* pList = pFonts ? pFonts->GetFontList() : nullptr; - if (pList && !rFontName.isEmpty()) + if (pList && !rFontName.empty()) if (sal_Handle hMetric = pList->GetFirstFontMetric(rFontName)) return &FontList::GetFontMetric(hMetric); return nullptr; } -vcl::Font FindFont_FallbackToDefault(const OUString& rFontName) +vcl::Font FindFont_FallbackToDefault(std::u16string_view rFontName) { if (auto pFound = FindFont(rFontName)) return *pFound; diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx index 4aec523f9614..ba1b943f29a5 100644 --- a/extensions/source/propctrlr/standardcontrol.cxx +++ b/extensions/source/propctrlr/standardcontrol.cxx @@ -38,6 +38,7 @@ #include <tools/datetime.hxx> #include <unotools/datetime.hxx> +#include <o3tl/string_view.hxx> #include <limits> #include <memory> @@ -680,7 +681,7 @@ namespace pcr namespace { - StlSyntaxSequence< OUString > lcl_convertMultiLineToList( const OUString& _rCompsedTextWithLineBreaks ) + StlSyntaxSequence< OUString > lcl_convertMultiLineToList( std::u16string_view _rCompsedTextWithLineBreaks ) { sal_Int32 nLines = comphelper::string::getTokenCount(_rCompsedTextWithLineBreaks, '\n'); StlSyntaxSequence< OUString > aStrings( nLines ); @@ -690,7 +691,7 @@ namespace pcr sal_Int32 nIdx {0}; do { - *stringItem = _rCompsedTextWithLineBreaks.getToken( 0, '\n', nIdx ); + *stringItem = o3tl::getToken(_rCompsedTextWithLineBreaks, 0, '\n', nIdx ); ++stringItem; } while (nIdx>0); diff --git a/extensions/source/propctrlr/stringrepresentation.cxx b/extensions/source/propctrlr/stringrepresentation.cxx index 3c984eb0a867..e436b28e0b64 100644 --- a/extensions/source/propctrlr/stringrepresentation.cxx +++ b/extensions/source/propctrlr/stringrepresentation.cxx @@ -39,6 +39,7 @@ #include <sal/log.hxx> #include <yesno.hrc> #include <comphelper/types.hxx> +#include <o3tl/string_view.hxx> #include "modulepcr.hxx" #include <algorithm> @@ -304,9 +305,9 @@ namespace { return OUString::number( _rIntValue ); } - sal_Int32 operator()( const OUString& _rStringValue ) const + sal_Int32 operator()( std::u16string_view _rStringValue ) const { - return _rStringValue.toInt32(); + return o3tl::toInt32(_rStringValue); } }; @@ -336,16 +337,16 @@ namespace } template < class ElementType, class Transformer > - void splitComposedStringToSequence( const OUString& _rComposed, Sequence< ElementType >& _out_SplitUp, const Transformer& _rTransformer ) + void splitComposedStringToSequence( std::u16string_view _rComposed, Sequence< ElementType >& _out_SplitUp, const Transformer& _rTransformer ) { _out_SplitUp.realloc( 0 ); - if ( _rComposed.isEmpty() ) + if ( _rComposed.empty() ) return; sal_Int32 tokenPos = 0; do { _out_SplitUp.realloc( _out_SplitUp.getLength() + 1 ); - _out_SplitUp.getArray()[ _out_SplitUp.getLength() - 1 ] = static_cast<ElementType>(_rTransformer( _rComposed.getToken( 0, '\n', tokenPos ) )); + _out_SplitUp.getArray()[ _out_SplitUp.getLength() - 1 ] = static_cast<ElementType>(_rTransformer( OUString(o3tl::getToken(_rComposed, 0, '\n', tokenPos )) )); } while ( tokenPos != -1 ); } diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx index eb602355ce20..7d64e645b668 100644 --- a/filter/source/config/cache/filtercache.cxx +++ b/filter/source/config/cache/filtercache.cxx @@ -51,6 +51,7 @@ #include <i18nlangtag/languagetag.hxx> #include <officecfg/Setup.hxx> +#include <o3tl/string_view.hxx> namespace filter::config{ @@ -2146,14 +2147,14 @@ CacheItem FilterCache::impl_readOldItem(const css::uno::Reference< css::containe } -std::vector<OUString> FilterCache::impl_tokenizeString(const OUString& sData , +std::vector<OUString> FilterCache::impl_tokenizeString(std::u16string_view sData , sal_Unicode cSeparator) { std::vector<OUString> lData ; sal_Int32 nToken = 0; do { - OUString sToken = sData.getToken(0, cSeparator, nToken); + OUString sToken( o3tl::getToken(sData, 0, cSeparator, nToken) ); lData.push_back(sToken); } while(nToken >= 0); diff --git a/filter/source/config/cache/filtercache.hxx b/filter/source/config/cache/filtercache.hxx index 42be4314cb38..526ce85d6126 100644 --- a/filter/source/config/cache/filtercache.hxx +++ b/filter/source/config/cache/filtercache.hxx @@ -891,7 +891,7 @@ class FilterCache : public cppu::BaseMutex /** TODO */ - static std::vector<OUString> impl_tokenizeString(const OUString& sData , + static std::vector<OUString> impl_tokenizeString(std::u16string_view sData , sal_Unicode cSeparator); diff --git a/filter/source/config/cache/querytokenizer.cxx b/filter/source/config/cache/querytokenizer.cxx index 9b64f68fe6d8..f5b021f53b45 100644 --- a/filter/source/config/cache/querytokenizer.cxx +++ b/filter/source/config/cache/querytokenizer.cxx @@ -20,23 +20,24 @@ #include "querytokenizer.hxx" #include <osl/diagnose.h> +#include <o3tl/string_view.hxx> namespace filter::config{ -QueryTokenizer::QueryTokenizer(const OUString& sQuery) +QueryTokenizer::QueryTokenizer(std::u16string_view sQuery) : m_bValid(true) { sal_Int32 token = 0; while(token != -1) { - OUString sToken = sQuery.getToken(0, ':', token); - if (!sToken.isEmpty()) + std::u16string_view sToken = o3tl::getToken(sQuery,0, ':', token); + if (!sToken.empty()) { sal_Int32 nIdx{ 0 }; - const OUString sKey{ sToken.getToken(0, '=', nIdx) }; - const OUString sVal{ sToken.getToken(0, ':', nIdx) }; + const OUString sKey{ o3tl::getToken(sToken, 0, '=', nIdx) }; + const OUString sVal{ o3tl::getToken(sToken, 0, ':', nIdx) }; if (sKey.isEmpty()) m_bValid = false; diff --git a/filter/source/config/cache/querytokenizer.hxx b/filter/source/config/cache/querytokenizer.hxx index e0b8d5218130..0c7e79b3ddc7 100644 --- a/filter/source/config/cache/querytokenizer.hxx +++ b/filter/source/config/cache/querytokenizer.hxx @@ -73,7 +73,7 @@ class QueryTokenizer : public std::unordered_map< OUString, OUString > @param sQuery the query string. */ - explicit QueryTokenizer(const OUString& sQuery); + explicit QueryTokenizer(std::u16string_view sQuery); /** @short destruct an instance of this class. diff --git a/filter/source/svg/svgfontexport.cxx b/filter/source/svg/svgfontexport.cxx index b0cbed97e4e7..7e75d65e6bc2 100644 --- a/filter/source/svg/svgfontexport.cxx +++ b/filter/source/svg/svgfontexport.cxx @@ -29,6 +29,7 @@ #include <vcl/settings.hxx> #include <i18nlangtag/languagetag.hxx> #include <xmloff/namespacemap.hxx> +#include <o3tl/string_view.hxx> #include <com/sun/star/i18n/CharacterIteratorMode.hpp> #include <com/sun/star/i18n/XBreakIterator.hpp> @@ -307,9 +308,9 @@ void SVGFontExport::EmbedFonts() } -OUString SVGFontExport::GetMappedFontName( const OUString& rFontName ) const +OUString SVGFontExport::GetMappedFontName( std::u16string_view rFontName ) const { - OUString aRet( rFontName.getToken( 0, ';' ) ); + OUString aRet( o3tl::getToken(rFontName, 0, ';' ) ); if( mnCurFontId ) aRet += " embedded"; diff --git a/filter/source/svg/svgfontexport.hxx b/filter/source/svg/svgfontexport.hxx index 6492ebd9c04c..259196f9e031 100644 --- a/filter/source/svg/svgfontexport.hxx +++ b/filter/source/svg/svgfontexport.hxx @@ -66,7 +66,7 @@ public: ~SVGFontExport(); void EmbedFonts(); - OUString GetMappedFontName( const OUString& rFontName ) const; + OUString GetMappedFontName( std::u16string_view rFontName ) const; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/xforms/convert.cxx b/forms/source/xforms/convert.cxx index 773cbfd6f925..278d5b01f597 100644 --- a/forms/source/xforms/convert.cxx +++ b/forms/source/xforms/convert.cxx @@ -85,7 +85,7 @@ namespace } - css::util::Date lcl_toUNODate( const OUString& rString ) + css::util::Date lcl_toUNODate( std::u16string_view rString ) { css::util::Date aDate( 1, 1, 1900 ); @@ -217,7 +217,7 @@ namespace } else { - aDate = lcl_toUNODate( rString.copy( 0, nDateTimeSep ) ); + aDate = lcl_toUNODate( rString.subView( 0, nDateTimeSep ) ); aTime = lcl_toUNOTime( rString.subView( nDateTimeSep + 1 ) ); } css::util::DateTime aDateTime( diff --git a/forms/source/xforms/submission/replace.cxx b/forms/source/xforms/submission/replace.cxx index e0595736b712..77e628728534 100644 --- a/forms/source/xforms/submission/replace.cxx +++ b/forms/source/xforms/submission/replace.cxx @@ -24,6 +24,7 @@ #include <rtl/ustring.hxx> #include <rtl/ref.hxx> #include <tools/diagnose_ex.h> +#include <o3tl/string_view.hxx> #include <comphelper/processfactory.hxx> #include <com/sun/star/uno/Reference.hxx> @@ -43,15 +44,15 @@ using namespace com::sun::star::beans; using namespace com::sun::star::task; using namespace com::sun::star::xml::dom; -CSubmission::SubmissionResult CSubmission::replace(const OUString& aReplace, const Reference<XDocument>& aDocument, const Reference<XFrame>& aFrame) +CSubmission::SubmissionResult CSubmission::replace(std::u16string_view aReplace, const Reference<XDocument>& aDocument, const Reference<XFrame>& aFrame) { if (!m_aResultStream.is()) return CSubmission::UNKNOWN_ERROR; try { Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); - if (aReplace.equalsIgnoreAsciiCase("all") - || aReplace.equalsIgnoreAsciiCase("document")) { + if (o3tl::equalsIgnoreAsciiCase(aReplace, u"all") + || o3tl::equalsIgnoreAsciiCase(aReplace, u"document")) { Reference< XComponentLoader > xLoader; if (aFrame.is()) xLoader.set(aFrame, UNO_QUERY); @@ -73,7 +74,7 @@ CSubmission::SubmissionResult CSubmission::replace(const OUString& aReplace, con return CSubmission::SUCCESS; - } else if (aReplace.equalsIgnoreAsciiCase("instance")) { + } else if (o3tl::equalsIgnoreAsciiCase(aReplace, u"instance")) { if (aDocument.is()) { // parse the result stream into a new document Reference< XDocumentBuilder > xBuilder(DocumentBuilder::create(xContext)); @@ -94,7 +95,7 @@ CSubmission::SubmissionResult CSubmission::replace(const OUString& aReplace, con // nothing to replace return CSubmission::UNKNOWN_ERROR; } - } else if (aReplace.equalsIgnoreAsciiCase("none")) { + } else if (o3tl::equalsIgnoreAsciiCase(aReplace, u"none")) { // do nothing \o/ return CSubmission::SUCCESS; } diff --git a/forms/source/xforms/submission/submission.hxx b/forms/source/xforms/submission/submission.hxx index 655529063a7d..bb5a19ee362b 100644 --- a/forms/source/xforms/submission/submission.hxx +++ b/forms/source/xforms/submission/submission.hxx @@ -130,7 +130,7 @@ public: virtual SubmissionResult submit(const css::uno::Reference< css::task::XInteractionHandler >& ) = 0; - SubmissionResult replace(const OUString&, const css::uno::Reference< css::xml::dom::XDocument >&, const css::uno::Reference< css::frame::XFrame>&); + SubmissionResult replace(std::u16string_view, const css::uno::Reference< css::xml::dom::XDocument >&, const css::uno::Reference< css::frame::XFrame>&); }; diff --git a/framework/inc/dispatch/closedispatcher.hxx b/framework/inc/dispatch/closedispatcher.hxx index 8ee08ed194f3..1ceb256498f9 100644 --- a/framework/inc/dispatch/closedispatcher.hxx +++ b/framework/inc/dispatch/closedispatcher.hxx @@ -117,7 +117,7 @@ class CloseDispatcher final : public ::cppu::WeakImplHelper< */ CloseDispatcher(const css::uno::Reference< css::uno::XComponentContext >& rxContext , const css::uno::Reference< css::frame::XFrame >& xFrame , - const OUString& sTarget); + std::u16string_view sTarget); /** @short does nothing real. */ virtual ~CloseDispatcher() override; @@ -252,7 +252,7 @@ class CloseDispatcher final : public ::cppu::WeakImplHelper< */ static css::uno::Reference< css::frame::XFrame > static_impl_searchRightTargetFrame(const css::uno::Reference< css::frame::XFrame >& xFrame , - const OUString& sTarget); + std::u16string_view sTarget); }; // class CloseDispatcher diff --git a/framework/inc/services/layoutmanager.hxx b/framework/inc/services/layoutmanager.hxx index 189be410bfc9..28f78d5bdc0f 100644 --- a/framework/inc/services/layoutmanager.hxx +++ b/framework/inc/services/layoutmanager.hxx @@ -175,7 +175,7 @@ namespace framework // query - css::uno::Reference< css::ui::XUIElement > implts_findElement( const OUString& aName ); + css::uno::Reference< css::ui::XUIElement > implts_findElement( std::u16string_view aName ); bool implts_readWindowStateData( const OUString& rName, UIElement& rElementData ); void implts_writeWindowStateData( const OUString& rName, const UIElement& rElementData ); diff --git a/framework/inc/uielement/menubarmerger.hxx b/framework/inc/uielement/menubarmerger.hxx index 3e2d4addd408..16bb8ec67610 100644 --- a/framework/inc/uielement/menubarmerger.hxx +++ b/framework/inc/uielement/menubarmerger.hxx @@ -62,7 +62,7 @@ namespace MenuBarMerger bool IsCorrectContext( std::u16string_view aContext, std::u16string_view aModuleIdentifier ); - void RetrieveReferencePath( const OUString&, + void RetrieveReferencePath( std::u16string_view, std::vector< OUString >& aReferencePath ); ReferencePathInfo FindReferencePath( const std::vector< OUString >& aReferencePath, Menu* pMenu ); sal_uInt16 FindMenuItem( std::u16string_view rCmd, @@ -75,7 +75,7 @@ namespace MenuBarMerger sal_uInt16 nPos, sal_uInt16& rItemId, std::u16string_view rMergeCommand, - const OUString& rMergeCommandParameter, + std::u16string_view rMergeCommandParameter, const OUString& rModuleIdentifier, const AddonMenuContainer& rAddonMenuItems ); bool ProcessFallbackOperation( const ReferencePathInfo& aRefPathInfo, @@ -98,7 +98,7 @@ namespace MenuBarMerger const AddonMenuContainer& rAddonMenuItems ); bool RemoveMenuItems( Menu* pMenu, sal_uInt16 nPos, - const OUString& rMergeCommandParameter ); + std::u16string_view rMergeCommandParameter ); bool CreateSubMenu( Menu* pSubMenu, sal_uInt16& nItemId, const OUString& rModuleIdentifier, diff --git a/framework/inc/uielement/statusbarmerger.hxx b/framework/inc/uielement/statusbarmerger.hxx index 350bae4bf2f8..1eaec5a88f81 100644 --- a/framework/inc/uielement/statusbarmerger.hxx +++ b/framework/inc/uielement/statusbarmerger.hxx @@ -60,7 +60,7 @@ namespace StatusbarMerger sal_uInt16 nPos, sal_uInt16& rItemId, std::u16string_view rMergeCommand, - const OUString& rMergeCommandParameter, + std::u16string_view rMergeCommandParameter, const AddonStatusbarItemContainer& rItems ); bool ProcessMergeFallback( StatusBar* pStatusbar, diff --git a/framework/inc/uielement/toolbarmerger.hxx b/framework/inc/uielement/toolbarmerger.hxx index 157e02170340..837507baa386 100644 --- a/framework/inc/uielement/toolbarmerger.hxx +++ b/framework/inc/uielement/toolbarmerger.hxx @@ -84,7 +84,7 @@ class ToolBarMerger CommandToInfoMap& rCommandMap, std::u16string_view rModuleIdentifier, std::u16string_view rMergeCommand, - const OUString& rMergeCommandParameter, + std::u16string_view rMergeCommandParameter, const AddonToolbarItemContainer& rItems ); static bool ProcessMergeFallback( ToolBox* pToolbar, @@ -112,7 +112,7 @@ class ToolBarMerger static void RemoveItems( ToolBox* pToolbar, ToolBox::ImplToolItems::size_type nPos, - const OUString& rMergeCommandParameter ); + std::u16string_view rMergeCommandParameter ); static rtl::Reference<::cppu::OWeakObject> CreateController( const css::uno::Reference< css::uno::XComponentContext > & rxContext, diff --git a/framework/source/accelerators/keymapping.cxx b/framework/source/accelerators/keymapping.cxx index 1a5648c8d43a..a0d33e7b4e23 100644 --- a/framework/source/accelerators/keymapping.cxx +++ b/framework/source/accelerators/keymapping.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/awt/Key.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <o3tl/string_view.hxx> namespace framework { @@ -186,10 +187,10 @@ OUString KeyMapping::mapCodeToIdentifier(sal_uInt16 nCode) return OUString::number(nCode); } -bool KeyMapping::impl_st_interpretIdentifierAsPureKeyCode(const OUString& sIdentifier, +bool KeyMapping::impl_st_interpretIdentifierAsPureKeyCode(std::u16string_view sIdentifier, sal_uInt16& rCode ) { - sal_Int32 nCode = sIdentifier.toInt32(); + sal_Int32 nCode = o3tl::toInt32(sIdentifier); if (nCode > 0) { rCode = static_cast<sal_uInt16>(nCode); @@ -199,7 +200,7 @@ bool KeyMapping::impl_st_interpretIdentifierAsPureKeyCode(const OUString& sIdent // 0 is normally an error of the called method toInt32() ... // But we must be aware, that the identifier is "0"! rCode = 0; - return sIdentifier == "0"; + return sIdentifier == u"0"; } } // namespace framework diff --git a/framework/source/accelerators/storageholder.cxx b/framework/source/accelerators/storageholder.cxx index e870ec0b71b8..c0a6106d7202 100644 --- a/framework/source/accelerators/storageholder.cxx +++ b/framework/source/accelerators/storageholder.cxx @@ -26,6 +26,7 @@ #include <com/sun/star/embed/XTransactedObject.hpp> #include <rtl/ustrbuf.hxx> +#include <o3tl/string_view.hxx> #include <algorithm> @@ -427,13 +428,13 @@ OUString StorageHolder::impl_st_normPath(const OUString& sPath) return sNormedPath; } -std::vector<OUString> StorageHolder::impl_st_parsePath(const OUString& sPath) +std::vector<OUString> StorageHolder::impl_st_parsePath(std::u16string_view sPath) { std::vector<OUString> lToken; sal_Int32 i = 0; while (true) { - OUString sToken = sPath.getToken(0, PATH_SEPARATOR_UNICODE, i); + OUString sToken( o3tl::getToken(sPath, 0, PATH_SEPARATOR_UNICODE, i) ); if (i < 0) break; lToken.push_back(sToken); diff --git a/framework/source/dispatch/closedispatcher.cxx b/framework/source/dispatch/closedispatcher.cxx index 6b2a13cb4eb7..d36a14c6461a 100644 --- a/framework/source/dispatch/closedispatcher.cxx +++ b/framework/source/dispatch/closedispatcher.cxx @@ -40,6 +40,7 @@ #include <vcl/svapp.hxx> #include <vcl/syswin.hxx> #include <unotools/moduleoptions.hxx> +#include <o3tl/string_view.hxx> using namespace com::sun::star; @@ -56,7 +57,7 @@ const char URL_CLOSEFRAME[] = ".uno:CloseFrame"; CloseDispatcher::CloseDispatcher(const css::uno::Reference< css::uno::XComponentContext >& rxContext , const css::uno::Reference< css::frame::XFrame >& xFrame , - const OUString& sTarget) + std::u16string_view sTarget) : m_xContext (rxContext ) , m_aAsyncCallback( new vcl::EventPoster(LINK(this, CloseDispatcher, impl_asyncCallback))) @@ -558,12 +559,12 @@ void CloseDispatcher::implts_notifyResultListener(const css::uno::Reference< css } css::uno::Reference< css::frame::XFrame > CloseDispatcher::static_impl_searchRightTargetFrame(const css::uno::Reference< css::frame::XFrame >& xFrame , - const OUString& sTarget) + std::u16string_view sTarget) { - if (sTarget.equalsIgnoreAsciiCase("_self")) + if (o3tl::equalsIgnoreAsciiCase(sTarget, u"_self")) return xFrame; - OSL_ENSURE(sTarget.isEmpty(), "CloseDispatch used for unexpected target. Magic things will happen now .-)"); + OSL_ENSURE(sTarget.empty(), "CloseDispatch used for unexpected target. Magic things will happen now .-)"); css::uno::Reference< css::frame::XFrame > xTarget = xFrame; while(true) diff --git a/framework/source/dispatch/dispatchinformationprovider.cxx b/framework/source/dispatch/dispatchinformationprovider.cxx index 0f4b488a19a9..8c9cd6d7c0d9 100644 --- a/framework/source/dispatch/dispatchinformationprovider.cxx +++ b/framework/source/dispatch/dispatchinformationprovider.cxx @@ -113,7 +113,7 @@ css::uno::Sequence< css::uno::Reference< css::frame::XDispatchInformationProvide if (!xFrame.is()) return css::uno::Sequence< css::uno::Reference< css::frame::XDispatchInformationProvider > >(); - rtl::Reference<CloseDispatcher> xCloser = new CloseDispatcher(m_xContext, xFrame, "_self"); // explicit "_self" ... not "" ... see implementation of close dispatcher itself! + rtl::Reference<CloseDispatcher> xCloser = new CloseDispatcher(m_xContext, xFrame, u"_self"); // explicit "_self" ... not "" ... see implementation of close dispatcher itself! css::uno::Reference< css::frame::XDispatchInformationProvider > xController (xFrame->getController() , css::uno::UNO_QUERY); css::uno::Reference< css::frame::XDispatchInformationProvider > xAppDispatcher = css::frame::AppDispatchProvider::create(m_xContext); diff --git a/framework/source/fwe/classes/sfxhelperfunctions.cxx b/framework/source/fwe/classes/sfxhelperfunctions.cxx index 06f48f1fe695..170f3e7156bb 100644 --- a/framework/source/fwe/classes/sfxhelperfunctions.cxx +++ b/framework/source/fwe/classes/sfxhelperfunctions.cxx @@ -132,7 +132,7 @@ pfunc_createDockingWindow SetDockingWindowCreator( pfunc_createDockingWindow pNe return pOldFunc; } -void CreateDockingWindow( const css::uno::Reference< css::frame::XFrame >& rFrame, const OUString& rResourceURL ) +void CreateDockingWindow( const css::uno::Reference< css::frame::XFrame >& rFrame, std::u16string_view rResourceURL ) { pfunc_createDockingWindow pFactory = nullptr; { @@ -153,7 +153,7 @@ pfunc_isDockingWindowVisible SetIsDockingWindowVisible( pfunc_isDockingWindowVis return pOldFunc; } -bool IsDockingWindowVisible( const css::uno::Reference< css::frame::XFrame >& rFrame, const OUString& rResourceURL ) +bool IsDockingWindowVisible( const css::uno::Reference< css::frame::XFrame >& rFrame, std::u16string_view rResourceURL ) { pfunc_isDockingWindowVisible pCall = nullptr; { diff --git a/framework/source/inc/accelerators/keymapping.hxx b/framework/source/inc/accelerators/keymapping.hxx index 75715efc7e3a..88429a0122f1 100644 --- a/framework/source/inc/accelerators/keymapping.hxx +++ b/framework/source/inc/accelerators/keymapping.hxx @@ -117,7 +117,7 @@ class KeyMapping @return [boolean] sal_True if conversion was successful. */ - bool impl_st_interpretIdentifierAsPureKeyCode(const OUString& sIdentifier, + bool impl_st_interpretIdentifierAsPureKeyCode(std::u16string_view sIdentifier, sal_uInt16& rCode ); }; diff --git a/framework/source/inc/accelerators/storageholder.hxx b/framework/source/inc/accelerators/storageholder.hxx index d2e17ee1a550..355bedeaa662 100644 --- a/framework/source/inc/accelerators/storageholder.hxx +++ b/framework/source/inc/accelerators/storageholder.hxx @@ -174,7 +174,7 @@ class StorageHolder final /** @short TODO */ - static std::vector<OUString> impl_st_parsePath(const OUString& sPath); + static std::vector<OUString> impl_st_parsePath(std::u16string_view sPath); }; } // namespace framework diff --git a/framework/source/layoutmanager/helpers.cxx b/framework/source/layoutmanager/helpers.cxx index d3b58351d95c..7508d58cbd44 100644 --- a/framework/source/layoutmanager/helpers.cxx +++ b/framework/source/layoutmanager/helpers.cxx @@ -32,6 +32,7 @@ #include <comphelper/propertyvalue.hxx> #include <unotools/mediadescriptor.hxx> #include <vcl/svapp.hxx> +#include <o3tl/string_view.hxx> #include <toolkit/helper/vclunohelper.hxx> using namespace com::sun::star; @@ -185,26 +186,24 @@ WindowAlign ImplConvertAlignment( ui::DockingArea aAlignment ) return WindowAlign::Bottom; } -OUString getElementTypeFromResourceURL( const OUString& aResourceURL ) +std::u16string_view getElementTypeFromResourceURL( std::u16string_view aResourceURL ) { - OUString aUIResourceURL( UIRESOURCE_URL ); - if ( aResourceURL.startsWith( aUIResourceURL ) ) + if ( o3tl::starts_with(aResourceURL, UIRESOURCE_URL ) ) { - sal_Int32 nIndex{ aUIResourceURL.getLength() }; - return aResourceURL.getToken( 1, '/', nIndex ); + sal_Int32 nIndex{ UIRESOURCE_URL.getLength() }; + return o3tl::getToken(aResourceURL, 1, '/', nIndex ); } - return OUString(); + return std::u16string_view(); } -void parseResourceURL( const OUString& aResourceURL, OUString& aElementType, OUString& aElementName ) +void parseResourceURL( std::u16string_view aResourceURL, OUString& aElementType, OUString& aElementName ) { - OUString aUIResourceURL( UIRESOURCE_URL ); - if ( aResourceURL.startsWith( aUIResourceURL ) ) + if ( o3tl::starts_with(aResourceURL, UIRESOURCE_URL) ) { - sal_Int32 nIndex{ aUIResourceURL.getLength() }; - aElementType = aResourceURL.getToken( 1, '/', nIndex ); - aElementName = aResourceURL.getToken( 0, '/', nIndex ); + sal_Int32 nIndex{ UIRESOURCE_URL.getLength() }; + aElementType = o3tl::getToken(aResourceURL, 1, '/', nIndex ); + aElementName = o3tl::getToken(aResourceURL, 0, '/', nIndex ); } } @@ -287,9 +286,9 @@ bool implts_isFrameOrWindowTop( const uno::Reference< frame::XFrame >& xFrame ) return false; } -void impl_setDockingWindowVisibility( const css::uno::Reference< css::uno::XComponentContext>& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, const OUString& rDockingWindowName, bool bVisible ) +void impl_setDockingWindowVisibility( const css::uno::Reference< css::uno::XComponentContext>& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, std::u16string_view rDockingWindowName, bool bVisible ) { - sal_Int32 nID = rDockingWindowName.toInt32(); + sal_Int32 nID = o3tl::toInt32(rDockingWindowName); sal_Int32 nIndex = nID - DOCKWIN_ID_BASE; css::uno::Reference< css::frame::XDispatchProvider > xProvider(rFrame, css::uno::UNO_QUERY); diff --git a/framework/source/layoutmanager/helpers.hxx b/framework/source/layoutmanager/helpers.hxx index e3df8fa6f0e9..14f9642a39d6 100644 --- a/framework/source/layoutmanager/helpers.hxx +++ b/framework/source/layoutmanager/helpers.hxx @@ -52,14 +52,14 @@ bool equalRectangles( const css::awt::Rectangle& rRect1, const css::awt::Rectang bool lcl_checkUIElement(const css::uno::Reference< css::ui::XUIElement >& xUIElement,css::awt::Rectangle& _rPosSize, css::uno::Reference< css::awt::XWindow >& _xWindow); css::uno::Reference< css::awt::XWindowPeer > createToolkitWindow( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::awt::XWindowPeer >& rParent, const char* pService ); WindowAlign ImplConvertAlignment( css::ui::DockingArea aAlignment ); -OUString getElementTypeFromResourceURL( const OUString& aResourceURL ); -void parseResourceURL( const OUString& aResourceURL, OUString& aElementType, OUString& aElementName ); +std::u16string_view getElementTypeFromResourceURL( std::u16string_view aResourceURL ); +void parseResourceURL( std::u16string_view aResourceURL, OUString& aElementType, OUString& aElementName ); ::tools::Rectangle putAWTToRectangle( const css::awt::Rectangle& rRect ); css::awt::Rectangle putRectangleValueToAWT( const ::tools::Rectangle& rRect ); css::uno::Reference< css::frame::XModel > impl_getModelFromFrame( const css::uno::Reference< css::frame::XFrame >& rFrame ); bool implts_isPreviewModel( const css::uno::Reference< css::frame::XModel >& xModel ); bool implts_isFrameOrWindowTop( const css::uno::Reference< css::frame::XFrame >& xFrame ); -void impl_setDockingWindowVisibility( const css::uno::Reference< css::uno::XComponentContext>& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, const OUString& rDockingWindowName, bool bVisible ); +void impl_setDockingWindowVisibility( const css::uno::Reference< css::uno::XComponentContext>& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, std::u16string_view rDockingWindowName, bool bVisible ); void impl_addWindowListeners( const css::uno::Reference< css::uno::XInterface >& xThis, const css::uno::Reference< css::ui::XUIElement >& xUIElement ); } diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 0d1cc619da89..9397e7643a28 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -63,6 +63,7 @@ #include <rtl/ref.hxx> #include <sal/log.hxx> +#include <o3tl/string_view.hxx> #include <algorithm> @@ -482,7 +483,7 @@ void LayoutManager::implts_toggleFloatingUIElementsVisibility( bool bActive ) pToolbarManager->setFloatingToolbarsVisibility( bActive ); } -uno::Reference< ui::XUIElement > LayoutManager::implts_findElement( const OUString& aName ) +uno::Reference< ui::XUIElement > LayoutManager::implts_findElement( std::u16string_view aName ) { OUString aElementType; OUString aElementName; @@ -1880,7 +1881,7 @@ sal_Bool SAL_CALL LayoutManager::dockAllWindows( ::sal_Int16 /*nElementType*/ ) sal_Bool SAL_CALL LayoutManager::floatWindow( const OUString& aName ) { bool bResult( false ); - if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR )) + if ( o3tl::equalsIgnoreAsciiCase(getElementTypeFromResourceURL( aName ), UIRESOURCETYPE_TOOLBAR )) { SolarMutexClearableGuard aReadLock; ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get(); @@ -1899,7 +1900,7 @@ sal_Bool SAL_CALL LayoutManager::floatWindow( const OUString& aName ) sal_Bool SAL_CALL LayoutManager::lockWindow( const OUString& aName ) { bool bResult( false ); - if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR )) + if ( o3tl::equalsIgnoreAsciiCase(getElementTypeFromResourceURL( aName ), UIRESOURCETYPE_TOOLBAR )) { SolarMutexClearableGuard aReadLock; ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get(); @@ -1918,7 +1919,7 @@ sal_Bool SAL_CALL LayoutManager::lockWindow( const OUString& aName ) sal_Bool SAL_CALL LayoutManager::unlockWindow( const OUString& aName ) { bool bResult( false ); - if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR )) + if ( o3tl::equalsIgnoreAsciiCase(getElementTypeFromResourceURL( aName ), UIRESOURCETYPE_TOOLBAR )) { SolarMutexClearableGuard aReadLock; ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get(); @@ -1936,7 +1937,7 @@ sal_Bool SAL_CALL LayoutManager::unlockWindow( const OUString& aName ) void SAL_CALL LayoutManager::setElementSize( const OUString& aName, const awt::Size& aSize ) { - if ( !getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR )) + if ( !o3tl::equalsIgnoreAsciiCase(getElementTypeFromResourceURL( aName ), UIRESOURCETYPE_TOOLBAR )) return; SolarMutexClearableGuard aReadLock; @@ -1953,7 +1954,7 @@ void SAL_CALL LayoutManager::setElementSize( const OUString& aName, const awt::S void SAL_CALL LayoutManager::setElementPos( const OUString& aName, const awt::Point& aPos ) { - if ( !getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR )) + if ( !o3tl::equalsIgnoreAsciiCase(getElementTypeFromResourceURL( aName ), UIRESOURCETYPE_TOOLBAR )) return; SolarMutexClearableGuard aReadLock; @@ -1970,7 +1971,7 @@ void SAL_CALL LayoutManager::setElementPos( const OUString& aName, const awt::Po void SAL_CALL LayoutManager::setElementPosSize( const OUString& aName, const awt::Point& aPos, const awt::Size& aSize ) { - if ( !getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR )) + if ( !o3tl::equalsIgnoreAsciiCase(getElementTypeFromResourceURL( aName ), UIRESOURCETYPE_TOOLBAR )) return; SolarMutexClearableGuard aReadLock; @@ -2061,7 +2062,7 @@ sal_Bool SAL_CALL LayoutManager::isElementVisible( const OUString& aName ) sal_Bool SAL_CALL LayoutManager::isElementFloating( const OUString& aName ) { - if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR )) + if ( o3tl::equalsIgnoreAsciiCase(getElementTypeFromResourceURL( aName ), UIRESOURCETYPE_TOOLBAR )) { SolarMutexClearableGuard aReadLock; ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get(); @@ -2076,7 +2077,7 @@ sal_Bool SAL_CALL LayoutManager::isElementFloating( const OUString& aName ) sal_Bool SAL_CALL LayoutManager::isElementDocked( const OUString& aName ) { - if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR )) + if ( o3tl::equalsIgnoreAsciiCase(getElementTypeFromResourceURL( aName ), UIRESOURCETYPE_TOOLBAR )) { SolarMutexClearableGuard aReadLock; ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get(); @@ -2091,7 +2092,7 @@ sal_Bool SAL_CALL LayoutManager::isElementDocked( const OUString& aName ) sal_Bool SAL_CALL LayoutManager::isElementLocked( const OUString& aName ) { - if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR )) + if ( o3tl::equalsIgnoreAsciiCase(getElementTypeFromResourceURL( aName ), UIRESOURCETYPE_TOOLBAR )) { SolarMutexClearableGuard aReadLock; ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get(); @@ -2106,7 +2107,7 @@ sal_Bool SAL_CALL LayoutManager::isElementLocked( const OUString& aName ) awt::Size SAL_CALL LayoutManager::getElementSize( const OUString& aName ) { - if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR )) + if ( o3tl::equalsIgnoreAsciiCase(getElementTypeFromResourceURL( aName ), UIRESOURCETYPE_TOOLBAR )) { SolarMutexClearableGuard aReadLock; ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get(); @@ -2121,7 +2122,7 @@ awt::Size SAL_CALL LayoutManager::getElementSize( const OUString& aName ) awt::Point SAL_CALL LayoutManager::getElementPos( const OUString& aName ) { - if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR )) + if ( o3tl::equalsIgnoreAsciiCase(getElementTypeFromResourceURL( aName ), UIRESOURCETYPE_TOOLBAR )) { SolarMutexClearableGuard aReadLock; ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get(); diff --git a/framework/source/services/pathsettings.cxx b/framework/source/services/pathsettings.cxx index fc74b81d55f1..bdffa86b1cea 100644 --- a/framework/source/services/pathsettings.cxx +++ b/framework/source/services/pathsettings.cxx @@ -50,6 +50,7 @@ #include <comphelper/sequence.hxx> #include <comphelper/configurationhelper.hxx> #include <unotools/configpaths.hxx> +#include <o3tl/string_view.hxx> using namespace framework; @@ -369,7 +370,7 @@ private: /** converts our new string list schema to the old ";" separated schema ... */ OUString impl_convertPath2OldStyle(const PathSettings::PathInfo& rPath ) const; - std::vector<OUString> impl_convertOldStyle2Path(const OUString& sOldStylePath) const; + std::vector<OUString> impl_convertOldStyle2Path(std::u16string_view sOldStylePath) const; /** remove still known paths from the given lList argument. So real user defined paths can be extracted from the list of @@ -970,13 +971,13 @@ OUString PathSettings::impl_convertPath2OldStyle(const PathSettings::PathInfo& r return sPathVal.makeStringAndClear(); } -std::vector<OUString> PathSettings::impl_convertOldStyle2Path(const OUString& sOldStylePath) const +std::vector<OUString> PathSettings::impl_convertOldStyle2Path(std::u16string_view sOldStylePath) const { std::vector<OUString> lList; sal_Int32 nToken = 0; do { - OUString sToken = sOldStylePath.getToken(0, ';', nToken); + OUString sToken( o3tl::getToken(sOldStylePath, 0, ';', nToken) ); if (!sToken.isEmpty()) lList.push_back(sToken); } diff --git a/framework/source/uielement/menubarmerger.cxx b/framework/source/uielement/menubarmerger.cxx index 175cbe8bcde0..c5730d2ef3e9 100644 --- a/framework/source/uielement/menubarmerger.cxx +++ b/framework/source/uielement/menubarmerger.cxx @@ -20,6 +20,7 @@ #include <uielement/menubarmerger.hxx> #include <framework/addonsoptions.hxx> #include <com/sun/star/uno/Sequence.hxx> +#include <o3tl/string_view.hxx> using namespace ::com::sun::star; @@ -62,7 +63,7 @@ bool MenuBarMerger::IsCorrectContext( } void MenuBarMerger::RetrieveReferencePath( - const OUString& rReferencePathString, + std::u16string_view rReferencePathString, ::std::vector< OUString >& rReferencePath ) { const char aDelimiter = '\\'; @@ -71,7 +72,7 @@ void MenuBarMerger::RetrieveReferencePath( sal_Int32 nIndex( 0 ); do { - OUString aToken = rReferencePathString.getToken( 0, aDelimiter, nIndex ); + OUString aToken( o3tl::getToken(rReferencePathString, 0, aDelimiter, nIndex ) ); if ( !aToken.isEmpty() ) rReferencePath.push_back( aToken ); } @@ -256,9 +257,9 @@ bool MenuBarMerger::ReplaceMenuItem( bool MenuBarMerger::RemoveMenuItems( Menu* pMenu, sal_uInt16 nPos, - const OUString& rMergeCommandParameter ) + std::u16string_view rMergeCommandParameter ) { - const sal_uInt16 nParam( sal_uInt16( rMergeCommandParameter.toInt32() )); + const sal_uInt16 nParam( sal_uInt16( o3tl::toInt32(rMergeCommandParameter) )); sal_uInt16 nCount = std::max( nParam, sal_uInt16(1) ); sal_uInt16 i = 0; @@ -276,7 +277,7 @@ bool MenuBarMerger::ProcessMergeOperation( sal_uInt16 nPos, sal_uInt16& nItemId, std::u16string_view rMergeCommand, - const OUString& rMergeCommandParameter, + std::u16string_view rMergeCommandParameter, const OUString& rModuleIdentifier, const AddonMenuContainer& rAddonMenuItems ) { diff --git a/framework/source/uielement/statusbarmerger.cxx b/framework/source/uielement/statusbarmerger.cxx ... etc. - the rest is truncated