From dd5dc5fa113b2e346d18fa2edaeea2347e4eb9f9 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 11 Oct 2021 13:54:21 +0200 Subject: [PATCH] loplugin:moveparam in extensions Change-Id: Ibbf0fff9a3540d4f723b91e2979e4465648ff203 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123385 Tested-by: Jenkins Reviewed-by: Noel Grandin --- extensions/source/abpilot/abspilot.cxx | 2 +- extensions/source/abpilot/fieldmappingimpl.cxx | 5 +---- extensions/source/abpilot/fieldmappingimpl.hxx | 2 +- .../source/propctrlr/eformspropertyhandler.cxx | 4 ++-- .../source/propctrlr/formcomponenthandler.cxx | 12 ++++++------ extensions/source/propctrlr/handlerhelper.cxx | 17 ++++++++--------- extensions/source/propctrlr/handlerhelper.hxx | 4 ++-- extensions/source/propctrlr/propcontroller.cxx | 10 +++++----- extensions/source/propctrlr/propcontroller.hxx | 2 +- .../source/propctrlr/propertycomposer.cxx | 4 ++-- .../source/propctrlr/propertycomposer.hxx | 2 +- .../source/propctrlr/submissionhandler.cxx | 2 +- .../propctrlr/xsdvalidationpropertyhandler.cxx | 2 +- 13 files changed, 32 insertions(+), 36 deletions(-) diff --git a/extensions/source/abpilot/abspilot.cxx b/extensions/source/abpilot/abspilot.cxx index 5600e819fb07..0a5cba073f0b 100644 --- a/extensions/source/abpilot/abspilot.cxx +++ b/extensions/source/abpilot/abspilot.cxx @@ -157,7 +157,7 @@ namespace abp addressconfig::writeTemplateAddressSource( getORB(), m_aSettings.bRegisterDataSource ? m_aSettings.sRegisteredDataSourceName : m_aSettings.sDataSourceName, m_aSettings.sSelectedTable ); // 4. write the field mapping - fieldmapping::writeTemplateAddressFieldMapping( getORB(), m_aSettings.aFieldMapping ); + fieldmapping::writeTemplateAddressFieldMapping( getORB(), std::map(m_aSettings.aFieldMapping) ); } void OAddressBookSourcePilot::implCleanup() diff --git a/extensions/source/abpilot/fieldmappingimpl.cxx b/extensions/source/abpilot/fieldmappingimpl.cxx index 04fa95028b18..43a75cf19ee4 100644 --- a/extensions/source/abpilot/fieldmappingimpl.cxx +++ b/extensions/source/abpilot/fieldmappingimpl.cxx @@ -204,11 +204,8 @@ namespace abp } - void writeTemplateAddressFieldMapping( const Reference< XComponentContext >& _rxContext, const MapString2String& _rFieldAssignment ) + void writeTemplateAddressFieldMapping( const Reference< XComponentContext >& _rxContext, MapString2String&& aFieldAssignment ) { - // want to have a non-const map for easier handling - MapString2String aFieldAssignment( _rFieldAssignment ); - // access the configuration information which the driver uses for determining its column names // create a config node for this diff --git a/extensions/source/abpilot/fieldmappingimpl.hxx b/extensions/source/abpilot/fieldmappingimpl.hxx index d26172dfdb16..e4a2dd1c9649 100644 --- a/extensions/source/abpilot/fieldmappingimpl.hxx +++ b/extensions/source/abpilot/fieldmappingimpl.hxx @@ -77,7 +77,7 @@ namespace abp */ void writeTemplateAddressFieldMapping( const css::uno::Reference< css::uno::XComponentContext >& _rxContext, - const MapString2String& _rFieldAssignment + MapString2String&& _rFieldAssignment ); diff --git a/extensions/source/propctrlr/eformspropertyhandler.cxx b/extensions/source/propctrlr/eformspropertyhandler.cxx index bda8df5a0c05..23d468a7d909 100644 --- a/extensions/source/propctrlr/eformspropertyhandler.cxx +++ b/extensions/source/propctrlr/eformspropertyhandler.cxx @@ -445,10 +445,10 @@ namespace pcr switch ( nControlType ) { case PropertyControlType::ListBox: - aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, aListEntries, false, true ); + aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, std::move(aListEntries), false, true ); break; case PropertyControlType::ComboBox: - aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aListEntries, true ); + aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, std::move(aListEntries), true ); break; default: aDescriptor.Control = _rxControlFactory->createPropertyControl( nControlType, false ); diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index 6c33ecf8a9c5..1bea9150f14f 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -1264,10 +1264,10 @@ namespace pcr // create the control if ( PROPERTY_ID_TARGET_FRAME == nPropId ) - aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aListEntries, false ); + aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, std::move(aListEntries), false ); else { - aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, aListEntries, false, false ); + aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, std::move(aListEntries), false, false ); bNeedDefaultStringIfVoidAllowed = true; } } @@ -1333,7 +1333,7 @@ namespace pcr aListEntries.resize( aDatasources.getLength() ); std::copy( aDatasources.begin(), aDatasources.end(), aListEntries.begin() ); aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( - _rxControlFactory, aListEntries, true ); + _rxControlFactory, std::move(aListEntries), true ); } break; @@ -1342,7 +1342,7 @@ namespace pcr std::vector< OUString > aFieldNames; impl_initFieldList_nothrow( aFieldNames ); aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( - _rxControlFactory, aFieldNames, false ); + _rxControlFactory, std::move(aFieldNames), false ); } break; @@ -2461,7 +2461,7 @@ namespace pcr else impl_fillQueryNames_throw( aNames ); } - _out_rProperty.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aNames, true ); + _out_rProperty.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, std::move(aNames), true ); } break; @@ -2572,7 +2572,7 @@ namespace pcr else impl_fillTableNames_throw( aListEntries ); } - _out_rDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aListEntries, false ); + _out_rDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, std::move(aListEntries), false ); } break; case ListSourceType_SQL: diff --git a/extensions/source/propctrlr/handlerhelper.cxx b/extensions/source/propctrlr/handlerhelper.cxx index cc9e08561dda..5897840b7e4e 100644 --- a/extensions/source/propctrlr/handlerhelper.cxx +++ b/extensions/source/propctrlr/handlerhelper.cxx @@ -109,7 +109,7 @@ namespace pcr { Reference< XPropertyControl > lcl_implCreateListLikeControl( const Reference< XPropertyControlFactory >& _rxControlFactory, - const std::vector< OUString >& _rInitialListEntries, + std::vector< OUString >&& _rInitialListEntries, bool _bReadOnlyControl, bool _bSorted, bool _bTrueIfListBoxFalseIfComboBox @@ -122,20 +122,19 @@ namespace pcr UNO_QUERY_THROW ); - std::vector< OUString > aInitialEntries( _rInitialListEntries ); if ( _bSorted ) - std::sort( aInitialEntries.begin(), aInitialEntries.end() ); + std::sort( _rInitialListEntries.begin(), _rInitialListEntries.end() ); - for (auto const& initialEntry : aInitialEntries) + for (auto const& initialEntry : _rInitialListEntries) xListControl->appendListEntry(initialEntry); return xListControl; } } Reference< XPropertyControl > PropertyHandlerHelper::createListBoxControl( const Reference< XPropertyControlFactory >& _rxControlFactory, - const std::vector< OUString >& _rInitialListEntries, bool _bReadOnlyControl, bool _bSorted ) + std::vector< OUString >&& _rInitialListEntries, bool _bReadOnlyControl, bool _bSorted ) { - return lcl_implCreateListLikeControl(_rxControlFactory, _rInitialListEntries, _bReadOnlyControl, _bSorted, true); + return lcl_implCreateListLikeControl(_rxControlFactory, std::move(_rInitialListEntries), _bReadOnlyControl, _bSorted, true); } Reference< XPropertyControl > PropertyHandlerHelper::createListBoxControl( const Reference< XPropertyControlFactory >& _rxControlFactory, @@ -144,13 +143,13 @@ namespace pcr std::vector aInitialListEntries; for (size_t i = 0; i < nElements; ++i) aInitialListEntries.push_back(PcrRes(pTransIds[i])); - return lcl_implCreateListLikeControl(_rxControlFactory, aInitialListEntries, _bReadOnlyControl, /*_bSorted*/false, true); + return lcl_implCreateListLikeControl(_rxControlFactory, std::move(aInitialListEntries), _bReadOnlyControl, /*_bSorted*/false, true); } Reference< XPropertyControl > PropertyHandlerHelper::createComboBoxControl( const Reference< XPropertyControlFactory >& _rxControlFactory, - const std::vector< OUString >& _rInitialListEntries, bool _bSorted ) + std::vector< OUString >&& _rInitialListEntries, bool _bSorted ) { - return lcl_implCreateListLikeControl( _rxControlFactory, _rInitialListEntries, /*_bReadOnlyControl*/false, _bSorted, false ); + return lcl_implCreateListLikeControl( _rxControlFactory, std::move(_rInitialListEntries), /*_bReadOnlyControl*/false, _bSorted, false ); } diff --git a/extensions/source/propctrlr/handlerhelper.hxx b/extensions/source/propctrlr/handlerhelper.hxx index 21c0fd2fe162..761c1d03d250 100644 --- a/extensions/source/propctrlr/handlerhelper.hxx +++ b/extensions/source/propctrlr/handlerhelper.hxx @@ -91,7 +91,7 @@ namespace pcr static css::uno::Reference< css::inspection::XPropertyControl > createListBoxControl( const css::uno::Reference< css::inspection::XPropertyControlFactory >& _rxControlFactory, - const std::vector< OUString >& _rInitialListEntries, + std::vector< OUString >&& _rInitialListEntries, bool _bReadOnlyControl, bool _bSorted ); @@ -139,7 +139,7 @@ namespace pcr static css::uno::Reference< css::inspection::XPropertyControl > createComboBoxControl( const css::uno::Reference< css::inspection::XPropertyControlFactory >& _rxControlFactory, - const std::vector< OUString >& _rInitialListEntries, + std::vector< OUString >&& _rInitialListEntries, bool _bSorted ); diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx index 92c04c29d533..6f73dd80a437 100644 --- a/extensions/source/propctrlr/propcontroller.cxx +++ b/extensions/source/propctrlr/propcontroller.cxx @@ -208,7 +208,7 @@ namespace pcr // inspect again, if we already have inspectees if ( !m_aInspectedObjects.empty() ) - impl_rebindToInspectee_nothrow( m_aInspectedObjects ); + impl_rebindToInspectee_nothrow( std::vector(m_aInspectedObjects) ); } @@ -643,7 +643,7 @@ namespace pcr // Even if they had an API for this, we do not know whether they were // originally created read-only, or if they are read-only just because // the model was. - impl_rebindToInspectee_nothrow( m_aInspectedObjects ); + impl_rebindToInspectee_nothrow( std::vector(m_aInspectedObjects) ); return; } @@ -907,7 +907,7 @@ namespace pcr } - void OPropertyBrowserController::impl_rebindToInspectee_nothrow( const InterfaceArray& _rObjects ) + void OPropertyBrowserController::impl_rebindToInspectee_nothrow( InterfaceArray&& _rObjects ) { try { @@ -915,7 +915,7 @@ namespace pcr stopInspection( true ); // inspect the new object(s) - m_aInspectedObjects = _rObjects; + m_aInspectedObjects = std::move(_rObjects); doInspection(); // update the user interface @@ -1428,7 +1428,7 @@ namespace pcr // then create a handler which composes information out of those single handlers if ( !aSingleHandlers.empty() ) - _rHandlers.push_back( new PropertyComposer( aSingleHandlers ) ); + _rHandlers.push_back( new PropertyComposer( std::move(aSingleHandlers) ) ); } } diff --git a/extensions/source/propctrlr/propcontroller.hxx b/extensions/source/propctrlr/propcontroller.hxx index f919bfcf6b3f..a56a839796f4 100644 --- a/extensions/source/propctrlr/propcontroller.hxx +++ b/extensions/source/propctrlr/propcontroller.hxx @@ -223,7 +223,7 @@ namespace pcr void doInspection(); // bind the browser to m_xIntrospecteeAsProperty - void impl_rebindToInspectee_nothrow( const InterfaceArray& _rObjects ); + void impl_rebindToInspectee_nothrow( InterfaceArray&& _rObjects ); /** retrieves special property handlers for our introspectee */ diff --git a/extensions/source/propctrlr/propertycomposer.cxx b/extensions/source/propctrlr/propertycomposer.cxx index c5b5d32e341c..b19e32fd9ff1 100644 --- a/extensions/source/propctrlr/propertycomposer.cxx +++ b/extensions/source/propctrlr/propertycomposer.cxx @@ -82,9 +82,9 @@ namespace pcr // of supported properties per handler). Shouldn't we cache this? So that it is O( log k )? - PropertyComposer::PropertyComposer( const std::vector< Reference< XPropertyHandler > >& _rSlaveHandlers ) + PropertyComposer::PropertyComposer( std::vector< Reference< XPropertyHandler > >&& _rSlaveHandlers ) :PropertyComposer_Base ( m_aMutex ) - ,m_aSlaveHandlers ( _rSlaveHandlers ) + ,m_aSlaveHandlers ( std::move(_rSlaveHandlers) ) ,m_aPropertyListeners ( m_aMutex ) ,m_bSupportedPropertiesAreKnown ( false ) { diff --git a/extensions/source/propctrlr/propertycomposer.hxx b/extensions/source/propctrlr/propertycomposer.hxx index d79e08b1bfed..5bcc58e23faf 100644 --- a/extensions/source/propctrlr/propertycomposer.hxx +++ b/extensions/source/propctrlr/propertycomposer.hxx @@ -67,7 +67,7 @@ namespace pcr @param _rSlaveHandlers the set of slave handlers to invoke. Must not be */ - explicit PropertyComposer( const std::vector< css::uno::Reference< css::inspection::XPropertyHandler > >& _rSlaveHandlers ); + explicit PropertyComposer( std::vector< css::uno::Reference< css::inspection::XPropertyHandler > >&& _rSlaveHandlers ); public: // XPropertyHandler overridables diff --git a/extensions/source/propctrlr/submissionhandler.cxx b/extensions/source/propctrlr/submissionhandler.cxx index 66aeddecc19f..3d2dfeff4ee2 100644 --- a/extensions/source/propctrlr/submissionhandler.cxx +++ b/extensions/source/propctrlr/submissionhandler.cxx @@ -295,7 +295,7 @@ namespace pcr } LineDescriptor aDescriptor; - aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, aListEntries, false, true ); + aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, std::move(aListEntries), false, true ); aDescriptor.DisplayName = m_pInfoService->getPropertyTranslation( nPropId ); aDescriptor.Category = "General"; aDescriptor.HelpURL = HelpIdUrl::getHelpURL( m_pInfoService->getPropertyHelpId( nPropId ) ); diff --git a/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx b/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx index 190029bd8866..3f61549b62d0 100644 --- a/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx +++ b/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx @@ -391,7 +391,7 @@ namespace pcr switch ( nControlType ) { case PropertyControlType::ListBox: - aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, aListEntries, false, false ); + aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, std::move(aListEntries), false, false ); break; case PropertyControlType::NumericField: aDescriptor.Control = PropertyHandlerHelper::createNumericControl( _rxControlFactory, 0, aMinValue, aMaxValue );