diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-02 19:02:40 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-03 10:01:48 +0200 |
commit | 3e1e0af376d45f44dab975cea943de7fb676f967 (patch) | |
tree | 3a1e0f7cf57ee323b8cdde8ac02a010d1e02f0b3 | |
parent | 744722123a8ce3d3c30583ba1285a21e129b471f (diff) |
loplugin:stringviewparam convert methods using match
which converts to a combination of substr and o3tl::starts_with
Change-Id: I5b01a181b9e6bee3483e4f49f1a9426abcc682d0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132458
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | chart2/source/controller/inc/SelectionHelper.hxx | 2 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartController_Window.cxx | 2 | ||||
-rw-r--r-- | chart2/source/controller/main/SelectionHelper.cxx | 2 | ||||
-rw-r--r-- | chart2/source/inc/ObjectIdentifier.hxx | 16 | ||||
-rw-r--r-- | chart2/source/tools/ObjectIdentifier.cxx | 96 | ||||
-rw-r--r-- | chart2/source/tools/PropertyHelper.cxx | 5 | ||||
-rw-r--r-- | compilerplugins/clang/stringviewparam.cxx | 2 | ||||
-rw-r--r-- | filter/source/xmlfilterdetect/filterdetect.cxx | 7 | ||||
-rw-r--r-- | include/oox/export/vmlexport.hxx | 2 | ||||
-rw-r--r-- | oox/source/export/vmlexport.cxx | 7 | ||||
-rw-r--r-- | sfx2/inc/emojiview.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/control/emojiview.cxx | 21 | ||||
-rw-r--r-- | sw/source/core/crsr/crossrefbookmark.cxx | 9 | ||||
-rw-r--r-- | sw/source/core/inc/crossrefbookmark.hxx | 4 |
14 files changed, 92 insertions, 85 deletions
diff --git a/chart2/source/controller/inc/SelectionHelper.hxx b/chart2/source/controller/inc/SelectionHelper.hxx index ae241d61ab42..ff0e95eee27a 100644 --- a/chart2/source/controller/inc/SelectionHelper.hxx +++ b/chart2/source/controller/inc/SelectionHelper.hxx @@ -92,7 +92,7 @@ public: DrawViewWrapper const & rDrawViewWrapper, bool bGetDiagramInsteadOf_Wall=false ); - static bool isRotateableObject( const OUString& rCID + static bool isRotateableObject( std::u16string_view rCID , const rtl::Reference<::chart::ChartModel>& xChartModel ); explicit SelectionHelper( SdrObject* pSelectedObj ); diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index 0e33cabfccbb..a6bae9b002a7 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -154,7 +154,7 @@ void lcl_insertMenuCommand( xMenu->setCommand( nId, rCommand ); } -OUString lcl_getFormatCommandForObjectCID( const OUString& rCID ) +OUString lcl_getFormatCommandForObjectCID( std::u16string_view rCID ) { OUString aDispatchCommand( ".uno:FormatSelection" ); diff --git a/chart2/source/controller/main/SelectionHelper.cxx b/chart2/source/controller/main/SelectionHelper.cxx index 433a157ba828..cc01e09eff0a 100644 --- a/chart2/source/controller/main/SelectionHelper.cxx +++ b/chart2/source/controller/main/SelectionHelper.cxx @@ -443,7 +443,7 @@ OUString SelectionHelper::getHitObjectCID( // \\- solar mutex } -bool SelectionHelper::isRotateableObject( const OUString& rCID +bool SelectionHelper::isRotateableObject( std::u16string_view rCID , const rtl::Reference<::chart::ChartModel>& xChartModel ) { if( !ObjectIdentifier::isRotateableObject( rCID ) ) diff --git a/chart2/source/inc/ObjectIdentifier.hxx b/chart2/source/inc/ObjectIdentifier.hxx index f4ce48011419..5be9d9cf3a97 100644 --- a/chart2/source/inc/ObjectIdentifier.hxx +++ b/chart2/source/inc/ObjectIdentifier.hxx @@ -118,11 +118,11 @@ public: , const rtl::Reference<::chart::ChartModel>& xChartModel ); static OUString createClassifiedIdentifierForParticle( - const OUString& rParticle ); + std::u16string_view rParticle ); static OUString createClassifiedIdentifierForParticles( - const OUString& rParentParticle - , const OUString& rChildParticle + std::u16string_view rParentParticle + , std::u16string_view rChildParticle , std::u16string_view rDragMethodServiceName = std::u16string_view() , std::u16string_view rDragParameterString = std::u16string_view() ); @@ -165,22 +165,22 @@ public: , std::u16string_view rDragParameterString = std::u16string_view() ); - static bool isCID( const OUString& rName ); + static bool isCID( std::u16string_view rName ); static OUString getDragMethodServiceName( const OUString& rClassifiedIdentifier ); static OUString getDragParameterString( const OUString& rCID ); static bool isDragableObject( const OUString& rClassifiedIdentifier ); bool isDragableObject() const; - static bool isRotateableObject( const OUString& rClassifiedIdentifier ); - static bool isMultiClickObject( const OUString& rClassifiedIdentifier ); + static bool isRotateableObject( std::u16string_view rClassifiedIdentifier ); + static bool isMultiClickObject( std::u16string_view rClassifiedIdentifier ); static bool areSiblings( const OUString& rCID1, const OUString& rCID2 );//identical object is no sibling static bool areIdenticalObjects( const OUString& rCID1, const OUString& rCID2 ); static OUString getStringForType( ObjectType eObjectType ); - static ObjectType getObjectType( const OUString& rCID ); + static ObjectType getObjectType( std::u16string_view rCID ); ObjectType getObjectType() const; static OUString createSeriesSubObjectStub( ObjectType eSubObjectType - , const OUString& rSeriesParticle + , std::u16string_view rSeriesParticle , std::u16string_view rDragMethodServiceName = std::u16string_view() , std::u16string_view rDragParameterString = std::u16string_view() ); static OUString createPointCID( std::u16string_view rPointCID_Stub, sal_Int32 nIndex ); diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx index 058314eae395..43c26d2aaf55 100644 --- a/chart2/source/tools/ObjectIdentifier.cxx +++ b/chart2/source/tools/ObjectIdentifier.cxx @@ -47,6 +47,7 @@ #include <rtl/ustrbuf.hxx> #include <tools/diagnose_ex.h> +#include <o3tl/string_view.hxx> namespace com::sun::star::drawing { class XShape; } @@ -58,10 +59,10 @@ using namespace ::com::sun::star::chart2; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Any; -const char m_aMultiClick[] = "MultiClick"; +const sal_Unicode m_aMultiClick[] = u"MultiClick"; const char m_aDragMethodEquals[] = "DragMethod="; const char m_aDragParameterEquals[] = "DragParameter="; -const char m_aProtocol[] = "CID/"; +const sal_Unicode m_aProtocol[] = u"CID/"; const OUString m_aPieSegmentDragMethodServiceName("PieSegmentDragging"); namespace @@ -425,14 +426,14 @@ OUString ObjectIdentifier::createClassifiedIdentifierForObject( } OUString ObjectIdentifier::createClassifiedIdentifierForParticle( - const OUString& rParticle ) + std::u16string_view rParticle ) { - return ObjectIdentifier::createClassifiedIdentifierForParticles( rParticle, OUString() ); + return ObjectIdentifier::createClassifiedIdentifierForParticles( rParticle, u"" ); } OUString ObjectIdentifier::createClassifiedIdentifierForParticles( - const OUString& rParentParticle - , const OUString& rChildParticle + std::u16string_view rParentParticle + , std::u16string_view rChildParticle , std::u16string_view rDragMethodServiceName , std::u16string_view rDragParameterString ) { @@ -442,13 +443,13 @@ OUString ObjectIdentifier::createClassifiedIdentifierForParticles( OUStringBuffer aRet( m_aProtocol ); aRet.append( lcl_createClassificationStringForType( eObjectType, rDragMethodServiceName, rDragParameterString )); - if(aRet.getLength() > static_cast<sal_Int32>(strlen(m_aProtocol))) + if(aRet.getLength() > static_cast<sal_Int32>(std::size(m_aProtocol)-1)) aRet.append("/"); - if(!rParentParticle.isEmpty()) + if(!rParentParticle.empty()) { aRet.append(rParentParticle); - if( !rChildParticle.isEmpty() ) + if( !rChildParticle.empty() ) aRet.append(":"); } aRet.append(rChildParticle); @@ -566,7 +567,7 @@ OUString ObjectIdentifier::createClassifiedIdentifierWithParent( OUStringBuffer aRet( m_aProtocol ); aRet.append( lcl_createClassificationStringForType( eObjectType, rDragMethodServiceName, rDragParameterString )); - if(aRet.getLength() > static_cast<sal_Int32>(strlen(m_aProtocol))) + if(aRet.getLength() > static_cast<sal_Int32>(std::size(m_aProtocol)-1)) aRet.append("/"); aRet.append(rParentPartical); if(!rParentPartical.empty()) @@ -716,7 +717,7 @@ bool ObjectIdentifier::isDragableObject() const return bReturn; } -bool ObjectIdentifier::isRotateableObject( const OUString& rClassifiedIdentifier ) +bool ObjectIdentifier::isRotateableObject( std::u16string_view rClassifiedIdentifier ) { bool bReturn = false; ObjectType eObjectType = ObjectIdentifier::getObjectType( rClassifiedIdentifier ); @@ -733,7 +734,7 @@ bool ObjectIdentifier::isRotateableObject( const OUString& rClassifiedIdentifier return bReturn; } -bool ObjectIdentifier::isMultiClickObject( const OUString& rClassifiedIdentifier ) +bool ObjectIdentifier::isMultiClickObject( std::u16string_view rClassifiedIdentifier ) { //the name of a shape is it's ClassifiedIdentifier @@ -742,7 +743,7 @@ bool ObjectIdentifier::isMultiClickObject( const OUString& rClassifiedIdentifier //was selected before; //!!!!! by definition the name of a MultiClickObject starts with "CID/MultiClick:" - bool bRet = rClassifiedIdentifier.match( m_aMultiClick, strlen(m_aProtocol) ); + bool bRet = o3tl::starts_with(rClassifiedIdentifier.substr( std::size(m_aProtocol)-1 ), m_aMultiClick); return bRet; } @@ -877,69 +878,70 @@ OUString ObjectIdentifier::getStringForType( ObjectType eObjectType ) return aRet; } -ObjectType ObjectIdentifier::getObjectType( const OUString& rCID ) +ObjectType ObjectIdentifier::getObjectType( std::u16string_view aCID ) { ObjectType eRet; - sal_Int32 nLastSign = rCID.lastIndexOf( ':' );//last sign before the type string - if(nLastSign==-1) - nLastSign = rCID.lastIndexOf( '/' ); - if(nLastSign==-1) + size_t nLastSign = aCID.rfind( ':' );//last sign before the type string + if(nLastSign == std::u16string_view::npos) + nLastSign = aCID.rfind( '/' ); + if(nLastSign == std::u16string_view::npos) { - sal_Int32 nEndIndex = rCID.lastIndexOf( '=' ); - if(nEndIndex==-1) + size_t nEndIndex = aCID.rfind( '=' ); + if(nEndIndex == std::u16string_view::npos) return OBJECTTYPE_UNKNOWN; nLastSign = 0; } if( nLastSign>0 ) nLastSign++; - if( rCID.match("Page",nLastSign) ) + aCID = aCID.substr(nLastSign); + if( o3tl::starts_with(aCID, u"Page") ) eRet = OBJECTTYPE_PAGE; - else if( rCID.match("Title",nLastSign) ) + else if( o3tl::starts_with(aCID, u"Title") ) eRet = OBJECTTYPE_TITLE; - else if( rCID.match("LegendEntry",nLastSign) ) + else if( o3tl::starts_with(aCID, u"LegendEntry") ) eRet = OBJECTTYPE_LEGEND_ENTRY; - else if( rCID.match("Legend",nLastSign) ) + else if( o3tl::starts_with(aCID, u"Legend") ) eRet = OBJECTTYPE_LEGEND; - else if( rCID.match("DiagramWall",nLastSign) ) + else if( o3tl::starts_with(aCID, u"DiagramWall") ) eRet = OBJECTTYPE_DIAGRAM_WALL; - else if( rCID.match("DiagramFloor",nLastSign) ) + else if( o3tl::starts_with(aCID, u"DiagramFloor") ) eRet = OBJECTTYPE_DIAGRAM_FLOOR; - else if( rCID.match("D=",nLastSign) ) + else if( o3tl::starts_with(aCID, u"D=") ) eRet = OBJECTTYPE_DIAGRAM; - else if( rCID.match("AxisUnitLabel",nLastSign) ) + else if( o3tl::starts_with(aCID, u"AxisUnitLabel") ) eRet = OBJECTTYPE_AXIS_UNITLABEL; - else if( rCID.match("Axis",nLastSign) ) + else if( o3tl::starts_with(aCID, u"Axis") ) eRet = OBJECTTYPE_AXIS; - else if( rCID.match("Grid",nLastSign) ) + else if( o3tl::starts_with(aCID, u"Grid") ) eRet = OBJECTTYPE_GRID; - else if( rCID.match("SubGrid",nLastSign) ) + else if( o3tl::starts_with(aCID, u"SubGrid") ) eRet = OBJECTTYPE_SUBGRID; - else if( rCID.match("Series",nLastSign) ) + else if( o3tl::starts_with(aCID, u"Series") ) eRet = OBJECTTYPE_DATA_SERIES; - else if( rCID.match("Point",nLastSign) ) + else if( o3tl::starts_with(aCID, u"Point") ) eRet = OBJECTTYPE_DATA_POINT; - else if( rCID.match("DataLabels",nLastSign) ) + else if( o3tl::starts_with(aCID, u"DataLabels") ) eRet = OBJECTTYPE_DATA_LABELS; - else if( rCID.match("DataLabel",nLastSign) ) + else if( o3tl::starts_with(aCID, u"DataLabel") ) eRet = OBJECTTYPE_DATA_LABEL; - else if( rCID.match("ErrorsX",nLastSign) ) + else if( o3tl::starts_with(aCID, u"ErrorsX") ) eRet = OBJECTTYPE_DATA_ERRORS_X; - else if( rCID.match("ErrorsY",nLastSign) ) + else if( o3tl::starts_with(aCID, u"ErrorsY") ) eRet = OBJECTTYPE_DATA_ERRORS_Y; - else if( rCID.match("ErrorsZ",nLastSign) ) + else if( o3tl::starts_with(aCID, u"ErrorsZ") ) eRet = OBJECTTYPE_DATA_ERRORS_Z; - else if( rCID.match("Curve",nLastSign) ) + else if( o3tl::starts_with(aCID, u"Curve") ) eRet = OBJECTTYPE_DATA_CURVE; - else if( rCID.match("Equation",nLastSign) ) + else if( o3tl::starts_with(aCID, u"Equation") ) eRet = OBJECTTYPE_DATA_CURVE_EQUATION; - else if( rCID.match("Average",nLastSign) ) + else if( o3tl::starts_with(aCID, u"Average") ) eRet = OBJECTTYPE_DATA_AVERAGE_LINE; - else if( rCID.match("StockRange",nLastSign) ) + else if( o3tl::starts_with(aCID, u"StockRange") ) eRet = OBJECTTYPE_DATA_STOCK_RANGE; - else if( rCID.match("StockLoss",nLastSign) ) + else if( o3tl::starts_with(aCID, u"StockLoss") ) eRet = OBJECTTYPE_DATA_STOCK_LOSS; - else if( rCID.match("StockGain",nLastSign) ) + else if( o3tl::starts_with(aCID, u"StockGain") ) eRet = OBJECTTYPE_DATA_STOCK_GAIN; else eRet = OBJECTTYPE_UNKNOWN; @@ -1009,7 +1011,7 @@ sal_Int32 ObjectIdentifier::getIndexFromParticleOrCID( const OUString& rParticle } OUString ObjectIdentifier::createSeriesSubObjectStub( ObjectType eSubObjectType - , const OUString& rSeriesParticle + , std::u16string_view rSeriesParticle , std::u16string_view rDragMethodServiceName , std::u16string_view rDragParameterString ) { @@ -1067,9 +1069,9 @@ OUString ObjectIdentifier::getObjectID( const OUString& rCID ) return aRet; } -bool ObjectIdentifier::isCID( const OUString& rName ) +bool ObjectIdentifier::isCID( std::u16string_view rName ) { - return !rName.isEmpty() && rName.match( m_aProtocol ); + return !rName.empty() && o3tl::starts_with( rName, m_aProtocol ); } Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet( diff --git a/chart2/source/tools/PropertyHelper.cxx b/chart2/source/tools/PropertyHelper.cxx index cb3e860c0350..9718cbfa676f 100644 --- a/chart2/source/tools/PropertyHelper.cxx +++ b/chart2/source/tools/PropertyHelper.cxx @@ -23,6 +23,7 @@ #include <comphelper/sequence.hxx> #include <osl/diagnose.h> #include <tools/diagnose_ex.h> +#include <o3tl/string_view.hxx> #include <vector> #include <algorithm> @@ -67,9 +68,9 @@ struct lcl_StringMatches m_aCmpStr( rCmpStr ) {} - bool operator() ( const OUString & rStr ) + bool operator() ( std::u16string_view rStr ) { - return rStr.match( m_aCmpStr ); + return o3tl::starts_with( rStr, m_aCmpStr ); } private: diff --git a/compilerplugins/clang/stringviewparam.cxx b/compilerplugins/clang/stringviewparam.cxx index 0ca41f2aeb1e..72ebe98768b3 100644 --- a/compilerplugins/clang/stringviewparam.cxx +++ b/compilerplugins/clang/stringviewparam.cxx @@ -138,7 +138,7 @@ 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 == "indexOf" || n == "lastIndexOf" || n == "compareTo" || n == "match") { good = true; } diff --git a/filter/source/xmlfilterdetect/filterdetect.cxx b/filter/source/xmlfilterdetect/filterdetect.cxx index db4ee2d5fe84..e7cab3323fca 100644 --- a/filter/source/xmlfilterdetect/filterdetect.cxx +++ b/filter/source/xmlfilterdetect/filterdetect.cxx @@ -28,6 +28,7 @@ #include <unotools/ucbstreamhelper.hxx> #include <svl/inettype.hxx> #include <memory> +#include <o3tl/string_view.hxx> using namespace com::sun::star::container; using namespace com::sun::star::uno; @@ -35,12 +36,12 @@ using namespace com::sun::star::beans; namespace { -OUString supportedByType( const OUString& clipBoardFormat, std::u16string_view resultString, const OUString& checkType) +OUString supportedByType( std::u16string_view clipBoardFormat, std::u16string_view resultString, const OUString& checkType) { OUString sTypeName; - if ( clipBoardFormat.match("doctype:") ) + if ( o3tl::starts_with(clipBoardFormat, u"doctype:") ) { - std::u16string_view tryStr = clipBoardFormat.subView(8); + std::u16string_view tryStr = clipBoardFormat.substr(8); if (resultString.find(tryStr) != std::u16string_view::npos) { sTypeName = checkType; diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx index 5f18df230783..5efdb34a90ff 100644 --- a/include/oox/export/vmlexport.hxx +++ b/include/oox/export/vmlexport.hxx @@ -149,7 +149,7 @@ public: const bool bOOxmlExport = false ); OString const & AddInlineSdrObject( const SdrObject& rObj, const bool bOOxmlExport ); virtual void AddSdrObjectVMLObject( const SdrObject& rObj) override; - static bool IsWaterMarkShape(const OUString& rStr); + static bool IsWaterMarkShape(std::u16string_view rStr); void SetSkipwzName(bool bSkipwzName) { m_bSkipwzName = bSkipwzName; } void SetHashMarkForType(bool bUseHashMarkForType) { m_bUseHashMarkForType = bUseHashMarkForType; } diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index c23604b6cb19..544a5599c932 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -39,6 +39,7 @@ #include <filter/msfilter/msdffimp.hxx> #include <filter/msfilter/util.hxx> #include <filter/msfilter/escherex.hxx> +#include <o3tl/string_view.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySetInfo.hpp> @@ -203,11 +204,11 @@ void VMLExport::AddShape( sal_uInt32 nShapeType, ShapeFlag nShapeFlags, sal_uInt } } -bool VMLExport::IsWaterMarkShape(const OUString& rStr) +bool VMLExport::IsWaterMarkShape(std::u16string_view rStr) { - if (rStr.isEmpty() ) return false; + if (rStr.empty() ) return false; - return rStr.match("PowerPlusWaterMarkObject") || rStr.match("WordPictureWatermark"); + return o3tl::starts_with(rStr, u"PowerPlusWaterMarkObject") || o3tl::starts_with(rStr, u"WordPictureWatermark"); } void VMLExport::OverrideShapeIDGen(bool bOverrideShapeIdGen, const OString& sShapeIDPrefix) diff --git a/sfx2/inc/emojiview.hxx b/sfx2/inc/emojiview.hxx index 52bb47bf0bc0..8328f2f410c4 100644 --- a/sfx2/inc/emojiview.hxx +++ b/sfx2/inc/emojiview.hxx @@ -41,7 +41,7 @@ public: bool operator()(const ThumbnailViewItem* pItem); - static bool isFilteredCategory(FILTER_CATEGORY filter, const OUString& rCategory); + static bool isFilteredCategory(FILTER_CATEGORY filter, std::u16string_view rCategory); private: FILTER_CATEGORY mCategory; diff --git a/sfx2/source/control/emojiview.cxx b/sfx2/source/control/emojiview.cxx index 02ee330e2c2a..6e5bd97b8dfc 100644 --- a/sfx2/source/control/emojiview.cxx +++ b/sfx2/source/control/emojiview.cxx @@ -17,6 +17,7 @@ #include <comphelper/processfactory.hxx> #include <vcl/event.hxx> #include <vcl/weldutils.hxx> +#include <o3tl/string_view.hxx> #include <orcus/json_document_tree.hpp> #include <orcus/config.hpp> @@ -26,28 +27,28 @@ using namespace ::com::sun::star; -bool ViewFilter_Category::isFilteredCategory(FILTER_CATEGORY filter, const OUString &rCategory) +bool ViewFilter_Category::isFilteredCategory(FILTER_CATEGORY filter, std::u16string_view rCategory) { bool bRet = true; if (filter == FILTER_CATEGORY::PEOPLE) - bRet = rCategory.match("people"); + bRet = o3tl::starts_with(rCategory, u"people"); else if (filter == FILTER_CATEGORY::NATURE) - bRet = rCategory.match("nature"); + bRet = o3tl::starts_with(rCategory, u"nature"); else if (filter == FILTER_CATEGORY::FOOD) - bRet = rCategory.match("food"); + bRet = o3tl::starts_with(rCategory, u"food"); else if (filter == FILTER_CATEGORY::ACTIVITY) - bRet = rCategory.match("activity"); + bRet = o3tl::starts_with(rCategory, u"activity"); else if (filter == FILTER_CATEGORY::TRAVEL) - bRet = rCategory.match("travel"); + bRet = o3tl::starts_with(rCategory, u"travel"); else if (filter == FILTER_CATEGORY::OBJECTS) - bRet = rCategory.match("objects"); + bRet = o3tl::starts_with(rCategory, u"objects"); else if (filter == FILTER_CATEGORY::SYMBOLS) - bRet = rCategory.match("symbols"); + bRet = o3tl::starts_with(rCategory, u"symbols"); else if (filter == FILTER_CATEGORY::FLAGS) - bRet = rCategory.match("flags"); + bRet = o3tl::starts_with(rCategory, u"flags"); else if (filter == FILTER_CATEGORY::UNICODE9) - bRet = rCategory.match("unicode9"); + bRet = o3tl::starts_with(rCategory, u"unicode9"); return bRet; } diff --git a/sw/source/core/crsr/crossrefbookmark.cxx b/sw/source/core/crsr/crossrefbookmark.cxx index 76c1fbad03df..f5754ee19fd3 100644 --- a/sw/source/core/crsr/crossrefbookmark.cxx +++ b/sw/source/core/crsr/crossrefbookmark.cxx @@ -24,6 +24,7 @@ #include <IDocumentMarkAccess.hxx> #include <crossrefbookmark.hxx> #include <ndtxt.hxx> +#include <o3tl/string_view.hxx> namespace { @@ -73,9 +74,9 @@ namespace sw::mark : CrossRefBookmark(rPaM, rCode, rName, OUStringConcatenation(IDocumentMarkAccess::GetCrossRefHeadingBookmarkNamePrefix()+"_Toc")) { } - bool CrossRefHeadingBookmark::IsLegalName(const OUString& rName) + bool CrossRefHeadingBookmark::IsLegalName(std::u16string_view rName) { - return rName.match(IDocumentMarkAccess::GetCrossRefHeadingBookmarkNamePrefix()); + return o3tl::starts_with(rName, IDocumentMarkAccess::GetCrossRefHeadingBookmarkNamePrefix()); } CrossRefNumItemBookmark::CrossRefNumItemBookmark(const SwPaM& rPaM, @@ -84,9 +85,9 @@ namespace sw::mark : CrossRefBookmark(rPaM, rCode, rName, CrossRefNumItemBookmark_NamePrefix) { } - bool CrossRefNumItemBookmark::IsLegalName(const OUString& rName) + bool CrossRefNumItemBookmark::IsLegalName(std::u16string_view rName) { - return rName.match(CrossRefNumItemBookmark_NamePrefix); + return o3tl::starts_with(rName, CrossRefNumItemBookmark_NamePrefix); } } diff --git a/sw/source/core/inc/crossrefbookmark.hxx b/sw/source/core/inc/crossrefbookmark.hxx index 90e4927ed862..2540170c9407 100644 --- a/sw/source/core/inc/crossrefbookmark.hxx +++ b/sw/source/core/inc/crossrefbookmark.hxx @@ -69,7 +69,7 @@ namespace sw::mark { CrossRefHeadingBookmark(const SwPaM& rPaM, const vcl::KeyCode& rCode, const OUString& rName); - static bool IsLegalName(const OUString& rName); + static bool IsLegalName(std::u16string_view rName); }; class CrossRefNumItemBookmark final @@ -79,7 +79,7 @@ namespace sw::mark { CrossRefNumItemBookmark(const SwPaM& rPaM, const vcl::KeyCode& rCode, const OUString& rName); - static bool IsLegalName(const OUString& rName); + static bool IsLegalName(std::u16string_view rName); }; } |