From 8332d6d8200e8ca1f22dd98d9373efd5a431d09c Mon Sep 17 00:00:00 2001 From: Noel Date: Wed, 25 Nov 2020 08:14:07 +0200 Subject: loplugin:stringviewparam include comparisons with string literals Change-Id: I8ba1214500dddaf413c506a4b82f43d63cda804b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106559 Tested-by: Jenkins Reviewed-by: Noel Grandin --- framework/inc/targets.h | 12 ++++++------ framework/inc/uielement/statusbarmerger.hxx | 2 +- framework/inc/xml/acceleratorconfigurationreader.hxx | 4 ++-- framework/source/inc/loadenv/targethelper.hxx | 2 +- framework/source/loadenv/targethelper.cxx | 2 +- framework/source/uielement/statusbarmerger.cxx | 8 ++++---- .../source/uielement/styletoolbarcontroller.cxx | 18 +++++++++--------- .../source/xml/acceleratorconfigurationreader.cxx | 20 ++++++++++---------- 8 files changed, 34 insertions(+), 34 deletions(-) (limited to 'framework') diff --git a/framework/inc/targets.h b/framework/inc/targets.h index b0bf251f0e8d..061b532fb6f2 100644 --- a/framework/inc/targets.h +++ b/framework/inc/targets.h @@ -24,13 +24,13 @@ namespace framework{ // Values for special frame search ... sTargetFrameName of findFrame() or queryDispatch() or loadComponentFromURL() -#define SPECIALTARGET_SELF "_self" // The frame himself is searched. -#define SPECIALTARGET_PARENT "_parent" // The direct parent frame is searched. -#define SPECIALTARGET_TOP "_top" // Search at our parents for the first task (if any exist) or a frame without a parent. -#define SPECIALTARGET_BLANK "_blank" // Create a new task. -#define SPECIALTARGET_DEFAULT "_default" // Create a new task or recycle an existing one +#define SPECIALTARGET_SELF u"_self" // The frame himself is searched. +#define SPECIALTARGET_PARENT u"_parent" // The direct parent frame is searched. +#define SPECIALTARGET_TOP u"_top" // Search at our parents for the first task (if any exist) or a frame without a parent. +#define SPECIALTARGET_BLANK u"_blank" // Create a new task. +#define SPECIALTARGET_DEFAULT u"_default" // Create a new task or recycle an existing one #define SPECIALTARGET_BEAMER u"_beamer" // special frame in hierarchy -#define SPECIALTARGET_HELPTASK "OFFICE_HELP_TASK" // special name for our help task +#define SPECIALTARGET_HELPTASK u"OFFICE_HELP_TASK" // special name for our help task } // namespace framework diff --git a/framework/inc/uielement/statusbarmerger.hxx b/framework/inc/uielement/statusbarmerger.hxx index 964559de777e..d7fecfaa881e 100644 --- a/framework/inc/uielement/statusbarmerger.hxx +++ b/framework/inc/uielement/statusbarmerger.hxx @@ -67,7 +67,7 @@ namespace StatusbarMerger bool ProcessMergeFallback( StatusBar* pStatusbar, sal_uInt16& rItemId, const OUString& rMergeCommand, - const OUString& rMergeFallback, + std::u16string_view rMergeFallback, const AddonStatusbarItemContainer& rItems ); } diff --git a/framework/inc/xml/acceleratorconfigurationreader.hxx b/framework/inc/xml/acceleratorconfigurationreader.hxx index 76a0a159ca69..b86bb1095e83 100644 --- a/framework/inc/xml/acceleratorconfigurationreader.hxx +++ b/framework/inc/xml/acceleratorconfigurationreader.hxx @@ -120,10 +120,10 @@ class AcceleratorConfigurationReader final : public ::cppu::WeakImplHelper< css: private: /** TODO document me */ - static EXMLElement implst_classifyElement(const OUString& sElement); + static EXMLElement implst_classifyElement(std::u16string_view sElement); /** TODO document me */ - static EXMLAttribute implst_classifyAttribute(const OUString& sAttribute); + static EXMLAttribute implst_classifyAttribute(std::u16string_view sAttribute); /** TODO document me */ OUString implts_getErrorLineString(); diff --git a/framework/source/inc/loadenv/targethelper.hxx b/framework/source/inc/loadenv/targethelper.hxx index 046cdfeb1bdc..54f0e761e803 100644 --- a/framework/source/inc/loadenv/targethelper.hxx +++ b/framework/source/inc/loadenv/targethelper.hxx @@ -61,7 +61,7 @@ class TargetHelper @return It returns if sCheckTarget represent the expected eSpecialTarget value; otherwise. */ - static bool matchSpecialTarget(const OUString& sCheckTarget , + static bool matchSpecialTarget(std::u16string_view sCheckTarget , ESpecialTarget eSpecialTarget); /** @short it checks, if the given name can be used diff --git a/framework/source/loadenv/targethelper.cxx b/framework/source/loadenv/targethelper.cxx index aab509b0fc6d..d531f81bc04f 100644 --- a/framework/source/loadenv/targethelper.cxx +++ b/framework/source/loadenv/targethelper.cxx @@ -22,7 +22,7 @@ namespace framework{ -bool TargetHelper::matchSpecialTarget(const OUString& sCheckTarget , +bool TargetHelper::matchSpecialTarget(std::u16string_view sCheckTarget , ESpecialTarget eSpecialTarget) { switch(eSpecialTarget) diff --git a/framework/source/uielement/statusbarmerger.cxx b/framework/source/uielement/statusbarmerger.cxx index c2b9e3abca47..b9f21c5f8a89 100644 --- a/framework/source/uielement/statusbarmerger.cxx +++ b/framework/source/uielement/statusbarmerger.cxx @@ -209,11 +209,11 @@ bool StatusbarMerger::ProcessMergeFallback( StatusBar* pStatusbar, sal_uInt16& rItemId, const OUString& rMergeCommand, - const OUString& rMergeFallback, + std::u16string_view rMergeFallback, const AddonStatusbarItemContainer& rItems ) { // fallback IGNORE or REPLACE/REMOVE item not found - if (( rMergeFallback == "Ignore" ) || + if (( rMergeFallback == u"Ignore" ) || ( rMergeCommand == MERGECOMMAND_REPLACE ) || ( rMergeCommand == MERGECOMMAND_REMOVE ) ) { @@ -222,9 +222,9 @@ bool StatusbarMerger::ProcessMergeFallback( else if (( rMergeCommand == MERGECOMMAND_ADDBEFORE ) || ( rMergeCommand == MERGECOMMAND_ADDAFTER ) ) { - if ( rMergeFallback == "AddFirst" ) + if ( rMergeFallback == u"AddFirst" ) return lcl_MergeItems( pStatusbar, 0, 0, rItemId, rItems ); - else if ( rMergeFallback == "AddLast" ) + else if ( rMergeFallback == u"AddLast" ) return lcl_MergeItems( pStatusbar, STATUSBAR_APPEND, 0, rItemId, rItems ); } diff --git a/framework/source/uielement/styletoolbarcontroller.cxx b/framework/source/uielement/styletoolbarcontroller.cxx index dfc8fa5bf007..a5c2715095ec 100644 --- a/framework/source/uielement/styletoolbarcontroller.cxx +++ b/framework/source/uielement/styletoolbarcontroller.cxx @@ -22,21 +22,21 @@ namespace { -OUString MapFamilyToCommand( const OUString& rFamily ) +OUString MapFamilyToCommand( std::u16string_view rFamily ) { - if ( rFamily == "ParagraphStyles" || - rFamily == "CellStyles" || // In sc - rFamily == "graphics" ) // In sd + if ( rFamily == u"ParagraphStyles" || + rFamily == u"CellStyles" || // In sc + rFamily == u"graphics" ) // In sd return ".uno:ParaStyle"; - else if ( rFamily == "CharacterStyles" ) + else if ( rFamily == u"CharacterStyles" ) return ".uno:CharStyle"; - else if ( rFamily == "PageStyles" ) + else if ( rFamily == u"PageStyles" ) return ".uno:PageStyle"; - else if ( rFamily == "FrameStyles" ) + else if ( rFamily == u"FrameStyles" ) return ".uno:FrameStyle"; - else if ( rFamily == "NumberingStyles" ) + else if ( rFamily == u"NumberingStyles" ) return ".uno:ListStyle"; - else if ( rFamily == "TableStyles" ) + else if ( rFamily == u"TableStyles" ) return ".uno:TableStyle"; return OUString(); diff --git a/framework/source/xml/acceleratorconfigurationreader.cxx b/framework/source/xml/acceleratorconfigurationreader.cxx index 2ff467f6845e..1b36119f2fd6 100644 --- a/framework/source/xml/acceleratorconfigurationreader.cxx +++ b/framework/source/xml/acceleratorconfigurationreader.cxx @@ -203,13 +203,13 @@ void SAL_CALL AcceleratorConfigurationReader::setDocumentLocator(const css::uno: m_xLocator = xLocator; } -AcceleratorConfigurationReader::EXMLElement AcceleratorConfigurationReader::implst_classifyElement(const OUString& sElement) +AcceleratorConfigurationReader::EXMLElement AcceleratorConfigurationReader::implst_classifyElement(std::u16string_view sElement) { AcceleratorConfigurationReader::EXMLElement eElement; - if (sElement == "http://openoffice.org/2001/accel^acceleratorlist") + if (sElement == u"http://openoffice.org/2001/accel^acceleratorlist") eElement = E_ELEMENT_ACCELERATORLIST; - else if (sElement == "http://openoffice.org/2001/accel^item") + else if (sElement == u"http://openoffice.org/2001/accel^item") eElement = E_ELEMENT_ITEM; else throw css::uno::RuntimeException( @@ -219,21 +219,21 @@ AcceleratorConfigurationReader::EXMLElement AcceleratorConfigurationReader::impl return eElement; } -AcceleratorConfigurationReader::EXMLAttribute AcceleratorConfigurationReader::implst_classifyAttribute(const OUString& sAttribute) +AcceleratorConfigurationReader::EXMLAttribute AcceleratorConfigurationReader::implst_classifyAttribute(std::u16string_view sAttribute) { AcceleratorConfigurationReader::EXMLAttribute eAttribute; - if (sAttribute == "http://openoffice.org/2001/accel^code") + if (sAttribute == u"http://openoffice.org/2001/accel^code") eAttribute = E_ATTRIBUTE_KEYCODE; - else if (sAttribute == "http://openoffice.org/2001/accel^shift") + else if (sAttribute == u"http://openoffice.org/2001/accel^shift") eAttribute = E_ATTRIBUTE_MOD_SHIFT; - else if (sAttribute == "http://openoffice.org/2001/accel^mod1") + else if (sAttribute == u"http://openoffice.org/2001/accel^mod1") eAttribute = E_ATTRIBUTE_MOD_MOD1; - else if (sAttribute == "http://openoffice.org/2001/accel^mod2") + else if (sAttribute == u"http://openoffice.org/2001/accel^mod2") eAttribute = E_ATTRIBUTE_MOD_MOD2; - else if (sAttribute == "http://openoffice.org/2001/accel^mod3") + else if (sAttribute == u"http://openoffice.org/2001/accel^mod3") eAttribute = E_ATTRIBUTE_MOD_MOD3; - else if (sAttribute == "http://www.w3.org/1999/xlink^href") + else if (sAttribute == u"http://www.w3.org/1999/xlink^href") eAttribute = E_ATTRIBUTE_URL; else throw css::uno::RuntimeException( -- cgit