From 8ef6067596cf4b2c52fbce94b44bf7af9fefa643 Mon Sep 17 00:00:00 2001 From: Noel Date: Fri, 13 Nov 2020 14:29:59 +0200 Subject: loplugin:stringviewparam check methods too not just functions Change-Id: Icca295dd159002b428b73f2c95d40725434f04d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105789 Tested-by: Jenkins Reviewed-by: Noel Grandin --- framework/inc/addonmenu.hxx | 2 +- framework/inc/uielement/toolbarmerger.hxx | 10 +++++----- framework/inc/uifactory/menubarfactory.hxx | 2 +- framework/source/fwe/classes/addonmenu.cxx | 4 ++-- framework/source/uielement/popuptoolbarcontroller.cxx | 6 +++--- framework/source/uielement/toolbarmerger.cxx | 10 +++++----- framework/source/uifactory/menubarfactory.cxx | 4 ++-- framework/source/uifactory/statusbarfactory.cxx | 2 +- framework/source/uifactory/toolbarfactory.cxx | 2 +- 9 files changed, 21 insertions(+), 21 deletions(-) (limited to 'framework') diff --git a/framework/inc/addonmenu.hxx b/framework/inc/addonmenu.hxx index 1f6443b48a79..461f81af2fc6 100644 --- a/framework/inc/addonmenu.hxx +++ b/framework/inc/addonmenu.hxx @@ -41,7 +41,7 @@ class AddonMenuManager static bool HasAddonMenuElements(); // Check if the context string matches the provided xModel context - static bool IsCorrectContext(const OUString& rModuleIdentifier, const OUString& rContext); + static bool IsCorrectContext(std::u16string_view rModuleIdentifier, const OUString& rContext); // Create the Add-Ons menu static VclPtr CreateAddonMenu( const css::uno::Reference< css::frame::XFrame >& rFrame ); diff --git a/framework/inc/uielement/toolbarmerger.hxx b/framework/inc/uielement/toolbarmerger.hxx index d3ccc1c8cbcb..03b9a1d8325e 100644 --- a/framework/inc/uielement/toolbarmerger.hxx +++ b/framework/inc/uielement/toolbarmerger.hxx @@ -59,7 +59,7 @@ struct ReferenceToolbarPathInfo class ToolBarMerger { public: - static bool IsCorrectContext( const OUString& aContext, const OUString& aModuleIdentifier ); + static bool IsCorrectContext( const OUString& aContext, std::u16string_view aModuleIdentifier ); static void ConvertSeqSeqToVector( const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& rSequence, AddonToolbarItemContainer& rContainer ); @@ -79,7 +79,7 @@ class ToolBarMerger ToolBox::ImplToolItems::size_type nPos, sal_uInt16& rItemId, CommandToInfoMap& rCommandMap, - const OUString& rModuleIdentifier, + std::u16string_view rModuleIdentifier, const OUString& rMergeCommand, const OUString& rMergeCommandParameter, const AddonToolbarItemContainer& rItems ); @@ -87,7 +87,7 @@ class ToolBarMerger static bool ProcessMergeFallback( ToolBox* pToolbar, sal_uInt16& rItemId, CommandToInfoMap& rCommandMap, - const OUString& rModuleIdentifier, + std::u16string_view rModuleIdentifier, const OUString& rMergeCommand, const OUString& rMergeFallback, const AddonToolbarItemContainer& rItems ); @@ -97,14 +97,14 @@ class ToolBarMerger sal_uInt16 nModIndex, sal_uInt16& rItemId, CommandToInfoMap& rCommandMap, - const OUString& rModuleIdentifier, + std::u16string_view rModuleIdentifier, const AddonToolbarItemContainer& rAddonToolbarItems ); static void ReplaceItem( ToolBox* pToolbar, ToolBox::ImplToolItems::size_type nPos, sal_uInt16& rItemId, CommandToInfoMap& rCommandMap, - const OUString& rModuleIdentifier, + std::u16string_view rModuleIdentifier, const AddonToolbarItemContainer& rAddonToolbarItems ); static void RemoveItems( ToolBox* pToolbar, diff --git a/framework/inc/uifactory/menubarfactory.hxx b/framework/inc/uifactory/menubarfactory.hxx index cadb67363edd..661b5887760f 100644 --- a/framework/inc/uifactory/menubarfactory.hxx +++ b/framework/inc/uifactory/menubarfactory.hxx @@ -62,7 +62,7 @@ typedef ::cppu::WeakImplHelper< static void CreateUIElement(const OUString& ResourceURL ,const css::uno::Sequence< css::beans::PropertyValue >& Args - ,const OUString& ResourceType + ,std::u16string_view ResourceType ,const css::uno::Reference< css::ui::XUIElement >& _xMenuBar ,const css::uno::Reference< css::uno::XComponentContext >& _rxContext); diff --git a/framework/source/fwe/classes/addonmenu.cxx b/framework/source/fwe/classes/addonmenu.cxx index 7e3103f17635..c7a52f96747a 100644 --- a/framework/source/fwe/classes/addonmenu.cxx +++ b/framework/source/fwe/classes/addonmenu.cxx @@ -281,12 +281,12 @@ void AddonMenuManager::GetMenuEntry( const Sequence< PropertyValue >& rAddonMenu } // Check if the context string matches the provided xModel context -bool AddonMenuManager::IsCorrectContext( const OUString& rModuleIdentifier, const OUString& rContext ) +bool AddonMenuManager::IsCorrectContext( std::u16string_view rModuleIdentifier, const OUString& rContext ) { if ( rContext.isEmpty() ) return true; - if ( !rModuleIdentifier.isEmpty() ) + if ( !rModuleIdentifier.empty() ) { sal_Int32 nIndex = rContext.indexOf( rModuleIdentifier ); return ( nIndex >= 0 ); diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx index af07acef9f04..efe2eb82f12c 100644 --- a/framework/source/uielement/popuptoolbarcontroller.cxx +++ b/framework/source/uielement/popuptoolbarcontroller.cxx @@ -627,7 +627,7 @@ private: void functionExecuted( const OUString &rCommand ) override; void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) override; void SAL_CALL execute( sal_Int16 KeyModifier ) override; - sal_uInt16 getMenuIdForCommand( const OUString &rCommand ); + sal_uInt16 getMenuIdForCommand( std::u16string_view rCommand ); sal_uInt16 m_nMenuId; }; @@ -719,9 +719,9 @@ void NewToolbarController::functionExecuted( const OUString &rCommand ) updateImage(); } -sal_uInt16 NewToolbarController::getMenuIdForCommand( const OUString &rCommand ) +sal_uInt16 NewToolbarController::getMenuIdForCommand( std::u16string_view rCommand ) { - if ( m_xPopupMenu.is() && !rCommand.isEmpty() ) + if ( m_xPopupMenu.is() && !rCommand.empty() ) { Menu* pVclMenu( comphelper::getUnoTunnelImplementation( m_xPopupMenu )->GetMenu() ); sal_uInt16 nCount = pVclMenu->GetItemCount(); diff --git a/framework/source/uielement/toolbarmerger.cxx b/framework/source/uielement/toolbarmerger.cxx index ad00c3b9800b..4a56afe933d9 100644 --- a/framework/source/uielement/toolbarmerger.cxx +++ b/framework/source/uielement/toolbarmerger.cxx @@ -89,7 +89,7 @@ using namespace ::com::sun::star; */ bool ToolBarMerger::IsCorrectContext( const OUString& rContext, - const OUString& rModuleIdentifier ) + std::u16string_view rModuleIdentifier ) { return ( rContext.isEmpty() || ( rContext.indexOf( rModuleIdentifier ) >= 0 )); } @@ -301,7 +301,7 @@ bool ToolBarMerger::ProcessMergeOperation( ToolBox::ImplToolItems::size_type nPos, sal_uInt16& rItemId, CommandToInfoMap& rCommandMap, - const OUString& rModuleIdentifier, + std::u16string_view rModuleIdentifier, const OUString& rMergeCommand, const OUString& rMergeCommandParameter, const AddonToolbarItemContainer& rItems ) @@ -364,7 +364,7 @@ bool ToolBarMerger::ProcessMergeFallback( ToolBox* pToolbar, sal_uInt16& rItemId, CommandToInfoMap& rCommandMap, - const OUString& rModuleIdentifier, + std::u16string_view rModuleIdentifier, const OUString& rMergeCommand, const OUString& rMergeFallback, const AddonToolbarItemContainer& rItems ) @@ -428,7 +428,7 @@ void ToolBarMerger::MergeItems( sal_uInt16 nModIndex, sal_uInt16& rItemId, CommandToInfoMap& rCommandMap, - const OUString& rModuleIdentifier, + std::u16string_view rModuleIdentifier, const AddonToolbarItemContainer& rAddonToolbarItems ) { const sal_Int32 nSize( rAddonToolbarItems.size() ); @@ -509,7 +509,7 @@ void ToolBarMerger::ReplaceItem( ToolBox::ImplToolItems::size_type nPos, sal_uInt16& rItemId, CommandToInfoMap& rCommandMap, - const OUString& rModuleIdentifier, + std::u16string_view rModuleIdentifier, const AddonToolbarItemContainer& rAddonToolbarItems ) { pToolbar->RemoveItem( nPos ); diff --git a/framework/source/uifactory/menubarfactory.cxx b/framework/source/uifactory/menubarfactory.cxx index 2899b64285cc..5c6e60425400 100644 --- a/framework/source/uifactory/menubarfactory.cxx +++ b/framework/source/uifactory/menubarfactory.cxx @@ -57,13 +57,13 @@ Reference< XUIElement > SAL_CALL MenuBarFactory::createUIElement( { Reference< css::ui::XUIElement > xMenuBar( static_cast(new MenuBarWrapper(m_xContext)), UNO_QUERY); - CreateUIElement(ResourceURL, Args, "private:resource/menubar/", xMenuBar, m_xContext); + CreateUIElement(ResourceURL, Args, u"private:resource/menubar/", xMenuBar, m_xContext); return xMenuBar; } void MenuBarFactory::CreateUIElement(const OUString& ResourceURL ,const Sequence< PropertyValue >& Args - ,const OUString& ResourceType + ,std::u16string_view ResourceType ,const Reference< css::ui::XUIElement >& _xMenuBar ,const css::uno::Reference< css::uno::XComponentContext >& _rxContext) { diff --git a/framework/source/uifactory/statusbarfactory.cxx b/framework/source/uifactory/statusbarfactory.cxx index 6791db896f80..0c59adea073b 100644 --- a/framework/source/uifactory/statusbarfactory.cxx +++ b/framework/source/uifactory/statusbarfactory.cxx @@ -68,7 +68,7 @@ Reference< XUIElement > SAL_CALL StatusBarFactory::createUIElement( { Reference< css::ui::XUIElement > xStatusBar( static_cast(new StatusBarWrapper(m_xContext)), UNO_QUERY); - MenuBarFactory::CreateUIElement(ResourceURL, Args, "private:resource/statusbar/", xStatusBar, m_xContext); + MenuBarFactory::CreateUIElement(ResourceURL, Args, u"private:resource/statusbar/", xStatusBar, m_xContext); return xStatusBar; } diff --git a/framework/source/uifactory/toolbarfactory.cxx b/framework/source/uifactory/toolbarfactory.cxx index f797ab2e6916..8af020cde45b 100644 --- a/framework/source/uifactory/toolbarfactory.cxx +++ b/framework/source/uifactory/toolbarfactory.cxx @@ -68,7 +68,7 @@ Reference< XUIElement > SAL_CALL ToolBarFactory::createUIElement( { Reference< css::ui::XUIElement > xToolBar( static_cast(new ToolBarWrapper(m_xContext)), UNO_QUERY); - CreateUIElement(ResourceURL, Args, "private:resource/toolbar/", xToolBar, m_xContext); + CreateUIElement(ResourceURL, Args, u"private:resource/toolbar/", xToolBar, m_xContext); return xToolBar; } -- cgit