diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-12-20 09:47:06 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-12-20 13:07:02 +0100 |
commit | cf7306194f5c677fef75e3ff5098676ee302359e (patch) | |
tree | a52a0980de72c7f70e4f3ae55126579655440773 | |
parent | 24b02a4f2507f40fe9d36c393c59e12c072428c3 (diff) |
No longer need to worry about ambiguous operator== in loplugin:stringviewparam
...after 46c5de832868d2812448b2caace3eeaa9237b9f6 "make *String(string_view)
constructors explicit"
Change-Id: I6e884c762a2fc91f5dd6fbb197a596fd60f17cae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108043
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
31 files changed, 104 insertions, 61 deletions
diff --git a/compilerplugins/clang/stringviewparam.cxx b/compilerplugins/clang/stringviewparam.cxx index 1e4e71c2d801..1e802068da9c 100644 --- a/compilerplugins/clang/stringviewparam.cxx +++ b/compilerplugins/clang/stringviewparam.cxx @@ -194,11 +194,10 @@ SmallVector<DeclRefExpr const*, 2> relevantCXXOperatorCallExpr(CXXOperatorCallEx return wrap(relevantDeclRefExpr(arg0)); } - // TODO Can't currently convert rtl::OString because we end up with ambiguous operator== - // (one in string_view header and one in rtl/string.hxx header) auto st1 = relevantStringType(arg0->getType()); auto st2 = relevantStringType(arg1->getType()); - if (st1 == StringType::RtlOustring && st2 == StringType::RtlOustring) + if ((st1 == StringType::RtlOstring && st2 == StringType::RtlOstring) + || (st1 == StringType::RtlOustring && st2 == StringType::RtlOustring)) { SmallVector<DeclRefExpr const*, 2> v; if (auto const e = relevantDeclRefExpr(arg0)) @@ -211,11 +210,11 @@ SmallVector<DeclRefExpr const*, 2> relevantCXXOperatorCallExpr(CXXOperatorCallEx } return v; } - if (st1 == StringType::RtlOustring && isStringView(arg1->getType())) + if (st1 != StringType::None && isStringView(arg1->getType())) { return wrap(relevantDeclRefExpr(arg0)); } - if (st2 == StringType::RtlOustring && isStringView(arg0->getType())) + if (st2 != StringType::None && isStringView(arg0->getType())) { return wrap(relevantDeclRefExpr(arg1)); } diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx index 5e792a5e59c0..e166c7475381 100644 --- a/cui/source/dialogs/iconcdlg.cxx +++ b/cui/source/dialogs/iconcdlg.cxx @@ -283,7 +283,7 @@ void SvxHpLinkDlg::Start() | \**********************************************************************/ -IconChoicePageData* SvxHpLinkDlg::GetPageData ( const OString& rId ) +IconChoicePageData* SvxHpLinkDlg::GetPageData ( std::string_view rId ) { IconChoicePageData *pRet = nullptr; for (const auto & pData : maPageList) diff --git a/cui/source/inc/cuihyperdlg.hxx b/cui/source/inc/cuihyperdlg.hxx index 626ac501cd63..d5842369f45a 100644 --- a/cui/source/inc/cuihyperdlg.hxx +++ b/cui/source/inc/cuihyperdlg.hxx @@ -22,6 +22,7 @@ #include <sal/config.h> #include <memory> +#include <string_view> #include <svx/hlnkitem.hxx> #include <sfx2/childwin.hxx> @@ -88,7 +89,7 @@ private: DECL_LINK( ChosePageHdl_Impl, const OString&, void ); - IconChoicePageData* GetPageData ( const OString& rId ); + IconChoicePageData* GetPageData ( std::string_view rId ); void SwitchPage( const OString& rId ); @@ -96,7 +97,7 @@ private: DECL_LINK (ClickOkHdl_Impl, weld::Button&, void ); DECL_LINK (ClickApplyHdl_Impl, weld::Button&, void ); - IconChoicePage* GetTabPage( const OString& rPageId ) + IconChoicePage* GetTabPage( std::string_view rPageId ) { return GetPageData(rPageId)->xPage.get(); } void ActivatePageImpl (); diff --git a/filter/source/graphicfilter/idxf/dxf2mtf.cxx b/filter/source/graphicfilter/idxf/dxf2mtf.cxx index 9ff520167e79..06aebc3da16b 100644 --- a/filter/source/graphicfilter/idxf/dxf2mtf.cxx +++ b/filter/source/graphicfilter/idxf/dxf2mtf.cxx @@ -64,7 +64,7 @@ tools::Long DXF2GDIMetaFile::GetEntityColor(const DXFBasicEntity & rE) return nColor; } -DXFLineInfo DXF2GDIMetaFile::LTypeToDXFLineInfo(OString const& rLineType) +DXFLineInfo DXF2GDIMetaFile::LTypeToDXFLineInfo(std::string_view rLineType) { const DXFLType * pLT; DXFLineInfo aDXFLineInfo; diff --git a/filter/source/graphicfilter/idxf/dxf2mtf.hxx b/filter/source/graphicfilter/idxf/dxf2mtf.hxx index 426932fd1fba..6d383dae1005 100644 --- a/filter/source/graphicfilter/idxf/dxf2mtf.hxx +++ b/filter/source/graphicfilter/idxf/dxf2mtf.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_FILTER_SOURCE_GRAPHICFILTER_IDXF_DXF2MTF_HXX #define INCLUDED_FILTER_SOURCE_GRAPHICFILTER_IDXF_DXF2MTF_HXX +#include <sal/config.h> + +#include <string_view> + #include "dxfreprd.hxx" #include <vcl/font.hxx> #include <vcl/lineinfo.hxx> @@ -55,7 +59,7 @@ private: tools::Long GetEntityColor(const DXFBasicEntity & rE); - DXFLineInfo LTypeToDXFLineInfo(OString const& rLineType); + DXFLineInfo LTypeToDXFLineInfo(std::string_view rLineType); DXFLineInfo GetEntityDXFLineInfo(const DXFBasicEntity & rE); diff --git a/filter/source/graphicfilter/idxf/dxfblkrd.cxx b/filter/source/graphicfilter/idxf/dxfblkrd.cxx index 9597fdca95a4..b5a96b93ea9a 100644 --- a/filter/source/graphicfilter/idxf/dxfblkrd.cxx +++ b/filter/source/graphicfilter/idxf/dxfblkrd.cxx @@ -100,7 +100,7 @@ void DXFBlocks::Read(DXFGroupReader & rDGR) } -DXFBlock * DXFBlocks::Search(OString const& rName) const +DXFBlock * DXFBlocks::Search(std::string_view rName) const { DXFBlock * pB; for (pB=pFirst; pB!=nullptr; pB=pB->pSucc) { diff --git a/filter/source/graphicfilter/idxf/dxfblkrd.hxx b/filter/source/graphicfilter/idxf/dxfblkrd.hxx index 6aa488641d1a..ca0a0e68aa54 100644 --- a/filter/source/graphicfilter/idxf/dxfblkrd.hxx +++ b/filter/source/graphicfilter/idxf/dxfblkrd.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_FILTER_SOURCE_GRAPHICFILTER_IDXF_DXFBLKRD_HXX #define INCLUDED_FILTER_SOURCE_GRAPHICFILTER_IDXF_DXFBLKRD_HXX +#include <sal/config.h> + +#include <string_view> + #include "dxfentrd.hxx" @@ -65,7 +69,7 @@ public: void Read(DXFGroupReader & rDGR); // reads all block per rDGR until an ENDSEC or EOF. - DXFBlock * Search(OString const& rName) const; + DXFBlock * Search(std::string_view rName) const; // looks for a block with the name, return NULL if not successful void Clear(); diff --git a/filter/source/graphicfilter/idxf/dxftblrd.cxx b/filter/source/graphicfilter/idxf/dxftblrd.cxx index 7820b04f4343..5077b687bed8 100644 --- a/filter/source/graphicfilter/idxf/dxftblrd.cxx +++ b/filter/source/graphicfilter/idxf/dxftblrd.cxx @@ -347,7 +347,7 @@ void DXFTables::Clear() } -DXFLType * DXFTables::SearchLType(OString const& rName) const +DXFLType * DXFTables::SearchLType(std::string_view rName) const { DXFLType * p; for (p=pLTypes; p!=nullptr; p=p->pSucc) { @@ -357,7 +357,7 @@ DXFLType * DXFTables::SearchLType(OString const& rName) const } -DXFLayer * DXFTables::SearchLayer(OString const& rName) const +DXFLayer * DXFTables::SearchLayer(std::string_view rName) const { DXFLayer * p; for (p=pLayers; p!=nullptr; p=p->pSucc) { @@ -367,7 +367,7 @@ DXFLayer * DXFTables::SearchLayer(OString const& rName) const } -DXFVPort * DXFTables::SearchVPort(OString const& rName) const +DXFVPort * DXFTables::SearchVPort(std::string_view rName) const { DXFVPort * p; for (p=pVPorts; p!=nullptr; p=p->pSucc) { diff --git a/filter/source/graphicfilter/idxf/dxftblrd.hxx b/filter/source/graphicfilter/idxf/dxftblrd.hxx index 9549458dabd5..f60c0461e2a7 100644 --- a/filter/source/graphicfilter/idxf/dxftblrd.hxx +++ b/filter/source/graphicfilter/idxf/dxftblrd.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_FILTER_SOURCE_GRAPHICFILTER_IDXF_DXFTBLRD_HXX #define INCLUDED_FILTER_SOURCE_GRAPHICFILTER_IDXF_DXFTBLRD_HXX +#include <sal/config.h> + +#include <string_view> + #include "dxfgrprd.hxx" #include "dxfvec.hxx" @@ -159,9 +163,9 @@ public: void Clear(); // look for table entries: - DXFLType * SearchLType(OString const& rName) const; - DXFLayer * SearchLayer(OString const& rName) const; - DXFVPort * SearchVPort(OString const& rName) const; + DXFLType * SearchLType(std::string_view rName) const; + DXFLayer * SearchLayer(std::string_view rName) const; + DXFVPort * SearchVPort(std::string_view rName) const; }; diff --git a/idl/inc/database.hxx b/idl/inc/database.hxx index 44ef25eafbcf..79d289bee697 100644 --- a/idl/inc/database.hxx +++ b/idl/inc/database.hxx @@ -115,7 +115,7 @@ public: void InsertId( const OString& rIdName, sal_uLong nVal ); bool ReadIdFile( std::string_view rFileName ); - SvMetaType * FindType( const OString& rName ); + SvMetaType * FindType( std::string_view rName ); static SvMetaType * FindType( const SvMetaType *, SvRefMemberList<SvMetaType *>& ); SvMetaType * ReadKnownType( SvTokenStream & rInStm ); @@ -123,7 +123,7 @@ public: SvMetaType * pType ); SvMetaAttribute * FindKnownAttr( const SvIdentifier& ); SvMetaClass * ReadKnownClass( SvTokenStream & rInStm ); - SvMetaClass * FindKnownClass( const OString& aName ); + SvMetaClass * FindKnownClass( std::string_view aName ); void AddDepFile(OUString const& rFileName); void WriteDepFile(SvFileStream & rStream, std::u16string_view rTarget); }; diff --git a/idl/source/prj/database.cxx b/idl/source/prj/database.cxx index de8aad3d9b74..6075a2da5fbd 100644 --- a/idl/source/prj/database.cxx +++ b/idl/source/prj/database.cxx @@ -271,7 +271,7 @@ SvMetaType * SvIdlDataBase::FindType( const SvMetaType * pPType, return nullptr; } -SvMetaType * SvIdlDataBase::FindType( const OString& rName ) +SvMetaType * SvIdlDataBase::FindType( std::string_view rName ) { for (auto const& elem : aTypeList) if( rName == elem->GetName() ) @@ -370,7 +370,7 @@ SvMetaClass * SvIdlDataBase::ReadKnownClass( SvTokenStream & rInStm ) return nullptr; } -SvMetaClass * SvIdlDataBase::FindKnownClass( const OString& aName ) +SvMetaClass * SvIdlDataBase::FindKnownClass( std::string_view aName ) { for( sal_uLong n = 0; n < aClassList.size(); n++ ) { diff --git a/idlc/inc/astscope.hxx b/idlc/inc/astscope.hxx index 5f6ed53f8df1..2e7e258e2312 100644 --- a/idlc/inc/astscope.hxx +++ b/idlc/inc/astscope.hxx @@ -19,6 +19,10 @@ #ifndef INCLUDED_IDLC_INC_ASTSCOPE_HXX #define INCLUDED_IDLC_INC_ASTSCOPE_HXX +#include <sal/config.h> + +#include <string_view> + #include "idlc.hxx" class AstExpression; @@ -43,7 +47,7 @@ public: // Name look up mechanism AstDeclaration* lookupByName(const OString& scopedName); // Look up the identifier 'name' specified only in the local scope - AstDeclaration* lookupByNameLocal(const OString& name) const; + AstDeclaration* lookupByNameLocal(std::string_view name) const; AstDeclaration* lookupInInherited(const OString& scopedName) const; diff --git a/idlc/inc/aststruct.hxx b/idlc/inc/aststruct.hxx index bb5ef15152e2..5e037d1b5a72 100644 --- a/idlc/inc/aststruct.hxx +++ b/idlc/inc/aststruct.hxx @@ -19,6 +19,10 @@ #ifndef INCLUDED_IDLC_INC_ASTSTRUCT_HXX #define INCLUDED_IDLC_INC_ASTSTRUCT_HXX +#include <sal/config.h> + +#include <string_view> + #include "asttype.hxx" #include "astscope.hxx" #include "idlctypes.hxx" @@ -43,7 +47,7 @@ public: std::size_t getTypeParameterCount() const { return m_typeParameters.size(); } - AstDeclaration const * findTypeParameter(OString const & name) const; + AstDeclaration const * findTypeParameter(std::string_view name) const; virtual bool isType() const override; diff --git a/idlc/source/astscope.cxx b/idlc/source/astscope.cxx index 26ebcdb4090a..c77ad48ceb1d 100644 --- a/idlc/source/astscope.cxx +++ b/idlc/source/astscope.cxx @@ -185,7 +185,7 @@ AstDeclaration* AstScope::lookupByName(const OString& scopedName) return pDecl; } -AstDeclaration* AstScope::lookupByNameLocal(const OString& name) const +AstDeclaration* AstScope::lookupByNameLocal(std::string_view name) const { for (auto const& declaration : m_declarations) { diff --git a/idlc/source/aststruct.cxx b/idlc/source/aststruct.cxx index e06adc2b2bd1..00ac33021141 100644 --- a/idlc/source/aststruct.cxx +++ b/idlc/source/aststruct.cxx @@ -51,7 +51,7 @@ AstStruct::~AstStruct() { } -AstDeclaration const * AstStruct::findTypeParameter(OString const & name) +AstDeclaration const * AstStruct::findTypeParameter(std::string_view name) const { for (auto const& elem : m_typeParameters) diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx index 0d770572f051..2c3352785f31 100644 --- a/include/sfx2/tabdlg.hxx +++ b/include/sfx2/tabdlg.hxx @@ -20,6 +20,8 @@ #define INCLUDED_SFX2_TABDLG_HXX #include <memory> +#include <string_view> + #include <sal/config.h> #include <sfx2/dllapi.h> #include <sfx2/basedlgs.hxx> @@ -91,7 +93,7 @@ protected: std::unique_ptr<SfxItemSet> m_xExampleSet; SfxItemSet* GetInputSetImpl(); - SfxTabPage* GetTabPage(const OString& rPageId) const; + SfxTabPage* GetTabPage(std::string_view rPageId) const; /** prepare to leave the current page. Calls the DeactivatePage method of the current page, (if necessary), handles the item sets to copy. diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx index d108f16a9dba..53b7c3b5eed2 100644 --- a/include/vcl/builder.hxx +++ b/include/vcl/builder.hxx @@ -89,7 +89,7 @@ public: vcl::Window* get_widget_root(); //sID may not exist - PopupMenu* get_menu(const OString& sID); + PopupMenu* get_menu(std::string_view sID); //release ownership of pWindow, i.e. don't delete it void drop_ownership(const vcl::Window *pWindow); @@ -307,7 +307,7 @@ private: bool m_bLegacy; std::unique_ptr<ParserState> m_pParserState; - vcl::Window *get_by_name(const OString& sID); + vcl::Window *get_by_name(std::string_view sID); void delete_by_name(const OString& sID); class sortIntoBestTabTraversalOrder @@ -392,7 +392,7 @@ private: static vcl::Window* prepareWidgetOwnScrolling(vcl::Window *pParent, WinBits &rWinStyle); void cleanupWidgetOwnScrolling(vcl::Window *pScrollParent, vcl::Window *pWindow, stringmap &rMap); - void set_response(const OString& sID, short nResponse); + void set_response(std::string_view sID, short nResponse); OString get_by_window(const vcl::Window *pWindow) const; void delete_by_window(vcl::Window *pWindow); diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index 4feef6025ddb..01bf9bc1f80b 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -21,6 +21,8 @@ #define INCLUDED_VCL_MENU_HXX #include <memory> +#include <string_view> + #include <vcl/vclenum.hxx> #include <tools/link.hxx> #include <tools/long.hxx> @@ -257,7 +259,7 @@ public: sal_uInt16 GetItemCount() const; sal_uInt16 GetItemId(sal_uInt16 nPos) const; - sal_uInt16 GetItemId(const OString &rIdent) const; + sal_uInt16 GetItemId(std::string_view rIdent) const; sal_uInt16 GetItemPos( sal_uInt16 nItemId ) const; OString GetItemIdent(sal_uInt16 nItemId) const; MenuItemType GetItemType( sal_uInt16 nPos ) const; @@ -276,13 +278,13 @@ public: vcl::KeyCode GetAccelKey( sal_uInt16 nItemId ) const; void CheckItem( sal_uInt16 nItemId, bool bCheck = true ); - void CheckItem( const OString &rIdent, bool bCheck = true ); + void CheckItem( std::string_view rIdent, bool bCheck = true ); bool IsItemChecked( sal_uInt16 nItemId ) const; virtual void SelectItem(sal_uInt16 nItemId) = 0; void EnableItem( sal_uInt16 nItemId, bool bEnable = true ); - void EnableItem(const OString &rIdent, bool bEnable = true) + void EnableItem(std::string_view rIdent, bool bEnable = true) { EnableItem(GetItemId(rIdent), bEnable); } diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index f2a1ef3f2a92..85726599b41c 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -278,7 +278,7 @@ private: /// @throws css::xml::sax::SAXException sal_Int32 GetTokenWithPrefix( const xmlChar* pPrefix, int prefixLen, const xmlChar* pName, int nameLen ); /// @throws css::xml::sax::SAXException - OUString const & GetNamespaceURL( const OString& rPrefix ); + OUString const & GetNamespaceURL( std::string_view rPrefix ); sal_Int32 GetNamespaceToken( const OUString& rNamespaceURL ); sal_Int32 GetTokenWithContextNamespace( sal_Int32 nNamespaceToken, const xmlChar* pName, int nNameLen ); void DefineNamespace( const OString& rPrefix, const OUString& namespaceURL ); @@ -740,7 +740,7 @@ sal_Int32 FastSaxParserImpl::GetNamespaceToken( const OUString& rNamespaceURL ) return FastToken::DONTKNOW; } -OUString const & FastSaxParserImpl::GetNamespaceURL( const OString& rPrefix ) +OUString const & FastSaxParserImpl::GetNamespaceURL( std::string_view rPrefix ) { Entity& rEntity = getEntity(); if( !rEntity.maNamespaceCount.empty() ) diff --git a/sdext/source/pdfimport/inc/pdfparse.hxx b/sdext/source/pdfimport/inc/pdfparse.hxx index e255b1bb9a64..abb674a48d22 100644 --- a/sdext/source/pdfimport/inc/pdfparse.hxx +++ b/sdext/source/pdfimport/inc/pdfparse.hxx @@ -24,6 +24,7 @@ #include <rtl/ustring.hxx> #include <rtl/string.hxx> +#include <string_view> #include <unordered_map> #include <vector> #include <memory> @@ -193,7 +194,7 @@ struct PDFDict : public PDFContainer // from the dictionary void insertValue( const OString& rName, std::unique_ptr<PDFEntry> pValue ); // removes a name/value pair from the dict - void eraseValue( const OString& rName ); + void eraseValue( std::string_view rName ); // builds new map as of sub elements // returns NULL if successful, else the first offending element PDFEntry* buildMap(); diff --git a/sdext/source/pdfimport/pdfparse/pdfentries.cxx b/sdext/source/pdfimport/pdfparse/pdfentries.cxx index e7fa4d511982..0789268372e4 100644 --- a/sdext/source/pdfimport/pdfparse/pdfentries.cxx +++ b/sdext/source/pdfimport/pdfparse/pdfentries.cxx @@ -550,7 +550,7 @@ void PDFDict::insertValue( const OString& rName, std::unique_ptr<PDFEntry> pValu m_aMap[ rName ] = pValueTmp; } -void PDFDict::eraseValue( const OString& rName ) +void PDFDict::eraseValue( std::string_view rName ) { unsigned int nEle = m_aSubElements.size(); for( unsigned int i = 0; i < nEle; i++ ) diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index 954db248f417..6f71e91fea88 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -20,6 +20,7 @@ #include <stdlib.h> #include <algorithm> +#include <string_view> #include <sfx2/tabdlg.hxx> #include <sfx2/app.hxx> @@ -104,7 +105,7 @@ struct TabDlg_Impl } }; -static Data_Impl* Find( const SfxTabDlgData_Impl& rArr, const OString& rId, sal_uInt16* pPos = nullptr) +static Data_Impl* Find( const SfxTabDlgData_Impl& rArr, std::string_view rId, sal_uInt16* pPos = nullptr) { const sal_uInt16 nCount = rArr.size(); @@ -1090,7 +1091,7 @@ void SfxTabDialogController::RemoveStandardButton() m_xBaseFmtBtn->hide(); } -SfxTabPage* SfxTabDialogController::GetTabPage(const OString& rPageId) const +SfxTabPage* SfxTabDialogController::GetTabPage(std::string_view rPageId) const /* [Description] diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx index e7c868e3e210..27f5cbe31425 100644 --- a/svx/source/fmcomp/fmgridcl.cxx +++ b/svx/source/fmcomp/fmgridcl.cxx @@ -73,6 +73,7 @@ #include <sal/log.hxx> #include <i18nlangtag/languagetag.hxx> #include <memory> +#include <string_view> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::view; @@ -98,7 +99,7 @@ struct FmGridHeaderData Reference< XInterface > xDroppedResultSet; }; -static void SetMenuItem(const OUString& rImgID, const OString &rID, Menu& rMenu, bool bDesignMode) +static void SetMenuItem(const OUString& rImgID, std::string_view rID, Menu& rMenu, bool bDesignMode) { Image aImage(StockImage::Yes, rImgID); sal_uInt16 nID = rMenu.GetItemId(rID); diff --git a/svx/source/stbctrls/selctrl.cxx b/svx/source/stbctrls/selctrl.cxx index 0411d3555758..3c772fc16608 100644 --- a/svx/source/stbctrls/selctrl.cxx +++ b/svx/source/stbctrls/selctrl.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> + #include <vcl/builder.hxx> #include <vcl/event.hxx> #include <vcl/menu.hxx> @@ -48,7 +52,8 @@ public: OUString GetItemTextForState(sal_uInt16 nState) { return m_xMenu->GetItemText(state_to_id(nState)); } sal_uInt16 GetState() const { return id_to_state(m_xMenu->GetCurItemIdent()); } sal_uInt16 Execute(vcl::Window* pWindow, const Point& rPopupPos) { return m_xMenu->Execute(pWindow, rPopupPos); } - void HideSelectionType(const OString& rIdent) { m_xMenu->HideItem(m_xMenu->GetItemId(rIdent)); } + void HideSelectionType(std::string_view rIdent) + { m_xMenu->HideItem(m_xMenu->GetItemId(rIdent)); } }; } diff --git a/sw/source/ui/fldui/fldtdlg.cxx b/sw/source/ui/fldui/fldtdlg.cxx index fefd2eb8cd3a..cf07d2a25b9f 100644 --- a/sw/source/ui/fldui/fldtdlg.cxx +++ b/sw/source/ui/fldui/fldtdlg.cxx @@ -194,7 +194,7 @@ void SwFieldDlg::ReInitDlg() } // newly initialise TabPage after Doc-Switch -void SwFieldDlg::ReInitTabPage(const OString& rPageId, bool bOnlyActivate) +void SwFieldDlg::ReInitTabPage(std::string_view rPageId, bool bOnlyActivate) { SwFieldPage* pPage = static_cast<SwFieldPage*>(GetTabPage(rPageId)); if (pPage) diff --git a/sw/source/uibase/inc/fldtdlg.hxx b/sw/source/uibase/inc/fldtdlg.hxx index 159881ed1192..8f690bb25f9e 100644 --- a/sw/source/uibase/inc/fldtdlg.hxx +++ b/sw/source/uibase/inc/fldtdlg.hxx @@ -18,6 +18,11 @@ */ #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_FLDTDLG_HXX #define INCLUDED_SW_SOURCE_UIBASE_INC_FLDTDLG_HXX + +#include <sal/config.h> + +#include <string_view> + #include <sfx2/tabdlg.hxx> class SfxBindings; @@ -36,7 +41,7 @@ class SwFieldDlg : public SfxTabDialogController virtual SfxItemSet* CreateInputItemSet(const OString& rId) override; virtual void PageCreated(const OString& rId, SfxTabPage& rPage) override; - void ReInitTabPage(const OString& rPageId, + void ReInitTabPage(std::string_view rPageId, bool bOnlyActivate = false); public: diff --git a/vcl/inc/verticaltabctrl.hxx b/vcl/inc/verticaltabctrl.hxx index f25f0f39d302..1152d702ea60 100644 --- a/vcl/inc/verticaltabctrl.hxx +++ b/vcl/inc/verticaltabctrl.hxx @@ -20,6 +20,8 @@ #pragma once #include <memory> +#include <string_view> + #include <vcl/dllapi.h> #include <vcl/toolkit/ivctrl.hxx> #include <vcl/layout.hxx> @@ -42,7 +44,7 @@ class VerticalTabControl final : public VclHBox void ActivatePage(); bool DeactivatePage(); - VerticalTabPageData* GetPageData(const OString& rId) const; + VerticalTabPageData* GetPageData(std::string_view rId) const; VerticalTabPageData* GetPageData(const SvxIconChoiceCtrlEntry* pEntry) const; public: @@ -55,11 +57,11 @@ public: OString GetCurPageId() const { return m_sCurrentPageId; } void SetCurPageId(const OString& rId); - sal_uInt16 GetPagePos(const OString& rPageId) const; + sal_uInt16 GetPagePos(std::string_view rPageId) const; OString GetPageId(sal_uInt16 nIndex) const; - VclPtr<vcl::Window> GetPage(const OString& rPageId); + VclPtr<vcl::Window> GetPage(std::string_view rPageId); - void RemovePage(const OString& rPageId); + void RemovePage(std::string_view rPageId); void InsertPage(const OString& rPageId, const OUString& rLabel, const Image& rImage, const OUString& rTooltip, VclPtr<vcl::Window> xPage, int nPos = -1); @@ -72,8 +74,8 @@ public: m_aDeactivateHdl = rLink; } - OUString GetPageText(const OString& rPageId) const; - void SetPageText(const OString& rPageId, const OUString& rText); + OUString GetPageText(std::string_view rPageId) const; + void SetPageText(std::string_view rPageId, const OUString& rText); vcl::Window* GetPageParent() { return m_xBox.get(); } diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 0524244ed6d2..2f487c53b6e4 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> + #include <com/sun/star/accessibility/AccessibleRelationType.hpp> #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/awt/XWindowPeer.hpp> @@ -1704,7 +1708,7 @@ private: std::vector<VclPtr<VclGrid>> m_aAddedGrids; Idle m_aUpdateRoadmapIdle; - int find_page(const OString& rIdent) const + int find_page(std::string_view rIdent) const { for (size_t i = 0; i < m_aAddedPages.size(); ++i) { diff --git a/vcl/source/control/ivctrl.cxx b/vcl/source/control/ivctrl.cxx index 87b746c88da0..f59e6784c7da 100644 --- a/vcl/source/control/ivctrl.cxx +++ b/vcl/source/control/ivctrl.cxx @@ -505,7 +505,7 @@ VerticalTabPageData* VerticalTabControl::GetPageData(const SvxIconChoiceCtrlEntr return pRet; } -VerticalTabPageData* VerticalTabControl::GetPageData(const OString& rId) const +VerticalTabPageData* VerticalTabControl::GetPageData(std::string_view rId) const { VerticalTabPageData* pRet = nullptr; for (auto & pData : maPageList) @@ -579,7 +579,7 @@ void VerticalTabControl::InsertPage(const rtl::OString &rIdent, const rtl::OUStr pNew->xPage->Hide(); } -void VerticalTabControl::RemovePage(const rtl::OString &rPageId) +void VerticalTabControl::RemovePage(std::string_view rPageId) { for (auto it = maPageList.begin(), end = maPageList.end(); it != end; ++it) { @@ -595,7 +595,7 @@ void VerticalTabControl::RemovePage(const rtl::OString &rPageId) } } -sal_uInt16 VerticalTabControl::GetPagePos(const OString& rPageId) const +sal_uInt16 VerticalTabControl::GetPagePos(std::string_view rPageId) const { VerticalTabPageData* pData = GetPageData(rPageId); if (!pData) @@ -603,7 +603,7 @@ sal_uInt16 VerticalTabControl::GetPagePos(const OString& rPageId) const return m_xChooser->GetEntryListPos(pData->pEntry); } -VclPtr<vcl::Window> VerticalTabControl::GetPage(const OString& rPageId) +VclPtr<vcl::Window> VerticalTabControl::GetPage(std::string_view rPageId) { VerticalTabPageData* pData = GetPageData(rPageId); if (!pData) @@ -611,7 +611,7 @@ VclPtr<vcl::Window> VerticalTabControl::GetPage(const OString& rPageId) return pData->xPage; } -OUString VerticalTabControl::GetPageText(const OString& rPageId) const +OUString VerticalTabControl::GetPageText(std::string_view rPageId) const { VerticalTabPageData* pData = GetPageData(rPageId); if (!pData) @@ -619,7 +619,7 @@ OUString VerticalTabControl::GetPageText(const OString& rPageId) const return pData->pEntry->GetText(); } -void VerticalTabControl::SetPageText(const OString& rPageId, const OUString& rText) +void VerticalTabControl::SetPageText(std::string_view rPageId, const OUString& rText) { VerticalTabPageData* pData = GetPageData(rPageId); if (!pData) diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 03a79f0eca8b..a9d150d6a883 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -4188,7 +4188,7 @@ vcl::Window *VclBuilder::get_widget_root() return m_aChildren.empty() ? nullptr : m_aChildren[0].m_pWindow.get(); } -vcl::Window *VclBuilder::get_by_name(const OString& sID) +vcl::Window *VclBuilder::get_by_name(std::string_view sID) { for (auto const& child : m_aChildren) { @@ -4199,7 +4199,7 @@ vcl::Window *VclBuilder::get_by_name(const OString& sID) return nullptr; } -PopupMenu *VclBuilder::get_menu(const OString& sID) +PopupMenu *VclBuilder::get_menu(std::string_view sID) { for (auto const& menu : m_aMenus) { @@ -4210,7 +4210,7 @@ PopupMenu *VclBuilder::get_menu(const OString& sID) return nullptr; } -void VclBuilder::set_response(const OString& sID, short nResponse) +void VclBuilder::set_response(std::string_view sID, short nResponse) { switch (nResponse) { diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index f14056057aa5..06aefe570199 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -641,7 +641,7 @@ sal_uInt16 Menu::GetItemId(sal_uInt16 nPos) const return 0; } -sal_uInt16 Menu::GetItemId(const OString &rIdent) const +sal_uInt16 Menu::GetItemId(std::string_view rIdent) const { for (size_t n = 0; n < pItemList->size(); ++n) { @@ -886,7 +886,7 @@ void Menu::CheckItem( sal_uInt16 nItemId, bool bCheck ) ImplCallEventListeners( bCheck ? VclEventId::MenuItemChecked : VclEventId::MenuItemUnchecked, nPos ); } -void Menu::CheckItem( const OString &rIdent , bool bCheck ) +void Menu::CheckItem( std::string_view rIdent , bool bCheck ) { CheckItem( GetItemId( rIdent ), bCheck ); } |