diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-06-02 15:55:10 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-06-02 17:43:43 +0200 |
commit | d16122e3e93c2ab4b94d089c4cf4f8ea2dbdf24c (patch) | |
tree | be1cb24a1eabba25e2deec82b3ed6e65be3b2974 /cppuhelper | |
parent | 859e0acc39c5353bc8ec2bafcf62d030bfb2bacd (diff) |
clang-tidy modernize-pass-by-value in cppuhelper
Change-Id: I231b84cd973d730fe301045cb7442af2d1ddc5d2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135311
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cppuhelper')
-rw-r--r-- | cppuhelper/source/component_context.cxx | 5 | ||||
-rw-r--r-- | cppuhelper/source/factory.cxx | 5 | ||||
-rw-r--r-- | cppuhelper/source/propertysetmixin.cxx | 5 | ||||
-rw-r--r-- | cppuhelper/source/servicemanager.cxx | 7 | ||||
-rw-r--r-- | cppuhelper/source/servicemanager.hxx | 29 | ||||
-rw-r--r-- | cppuhelper/source/typemanager.cxx | 102 | ||||
-rw-r--r-- | cppuhelper/source/unourl.cxx | 5 |
7 files changed, 80 insertions, 78 deletions
diff --git a/cppuhelper/source/component_context.cxx b/cppuhelper/source/component_context.cxx index 440fe18cfa4d..81c7d306fae3 100644 --- a/cppuhelper/source/component_context.cxx +++ b/cppuhelper/source/component_context.cxx @@ -44,6 +44,7 @@ #include <comphelper/sequence.hxx> #include <memory> +#include <utility> constexpr OUStringLiteral SMGR_SINGLETON = u"/singletons/com.sun.star.lang.theServiceManager"; constexpr OUStringLiteral TDMGR_SINGLETON = u"/singletons/com.sun.star.reflection.theTypeDescriptionManager"; @@ -127,8 +128,8 @@ protected: Any value; bool lateInit; - ContextEntry( Any const & value_, bool lateInit_ ) - : value( value_ ) + ContextEntry( Any value_, bool lateInit_ ) + : value(std::move( value_ )) , lateInit( lateInit_ ) {} }; diff --git a/cppuhelper/source/factory.cxx b/cppuhelper/source/factory.cxx index e6b920858160..c8efcab0e604 100644 --- a/cppuhelper/source/factory.cxx +++ b/cppuhelper/source/factory.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <memory> +#include <utility> using namespace osl; @@ -66,14 +67,14 @@ class OSingleFactoryHelper public: OSingleFactoryHelper( const Reference<XMultiServiceFactory > & rServiceManager, - const OUString & rImplementationName_, + OUString aImplementationName_, ComponentInstantiation pCreateFunction_, ComponentFactoryFunc fptr, const Sequence< OUString > * pServiceNames_ ) : xSMgr( rServiceManager ) , pCreateFunction( pCreateFunction_ ) , m_fptr( fptr ) - , aImplementationName( rImplementationName_ ) + , aImplementationName(std::move( aImplementationName_ )) { if( pServiceNames_ ) aServiceNames = *pServiceNames_; diff --git a/cppuhelper/source/propertysetmixin.cxx b/cppuhelper/source/propertysetmixin.cxx index 030160c65f0f..0d94e7a822a6 100644 --- a/cppuhelper/source/propertysetmixin.cxx +++ b/cppuhelper/source/propertysetmixin.cxx @@ -24,6 +24,7 @@ #include <map> #include <mutex> #include <set> +#include <utility> #include <vector> #include <com/sun/star/beans/Property.hpp> @@ -79,8 +80,8 @@ namespace { struct PropertyData { explicit PropertyData( - css::beans::Property const & theProperty, bool thePresent): - property(theProperty), present(thePresent) {} + css::beans::Property theProperty, bool thePresent): + property(std::move(theProperty)), present(thePresent) {} css::beans::Property property; bool present; diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx index 1a0e85780b21..5bcd2dfee76f 100644 --- a/cppuhelper/source/servicemanager.cxx +++ b/cppuhelper/source/servicemanager.cxx @@ -14,6 +14,7 @@ #include <iostream> #include <mutex> #include <string_view> +#include <utility> #include <vector> #include <com/sun/star/beans/NamedValue.hpp> @@ -106,7 +107,7 @@ class Parser { public: Parser( OUString const & uri, - css::uno::Reference< css::uno::XComponentContext > const & alienContext, + css::uno::Reference< css::uno::XComponentContext > alienContext, cppuhelper::ServiceManager::Data * data); Parser(const Parser&) = delete; @@ -136,9 +137,9 @@ private: Parser::Parser( OUString const & uri, - css::uno::Reference< css::uno::XComponentContext > const & alienContext, + css::uno::Reference< css::uno::XComponentContext > alienContext, cppuhelper::ServiceManager::Data * data): - reader_(uri), alienContext_(alienContext), data_(data) + reader_(uri), alienContext_(std::move(alienContext)), data_(data) { assert(data != nullptr); int ucNsId = reader_.registerNamespaceIri( diff --git a/cppuhelper/source/servicemanager.hxx b/cppuhelper/source/servicemanager.hxx index b47d188ca82b..cdf23b277040 100644 --- a/cppuhelper/source/servicemanager.hxx +++ b/cppuhelper/source/servicemanager.hxx @@ -16,6 +16,7 @@ #include <memory> #include <mutex> #include <string_view> +#include <utility> #include <vector> #include <com/sun/star/beans/XPropertySet.hpp> @@ -71,32 +72,30 @@ public: struct Implementation { Implementation( - OUString const & theName, OUString const & theLoader, - OUString const & theUri, OUString const & theEnvironment, - OUString const & theConstructorName, - OUString const & thePrefix, + OUString theName, OUString theLoader, + OUString theUri, OUString theEnvironment, + OUString theConstructorName, + OUString thePrefix, bool theIsSingleInstance, - css::uno::Reference< css::uno::XComponentContext > const & - theAlienContext, - OUString const & theRdbFile): - name(theName), loader(theLoader), uri(theUri), environment(theEnvironment), - constructorName(theConstructorName), prefix(thePrefix), + css::uno::Reference< css::uno::XComponentContext > theAlienContext, + OUString theRdbFile): + name(std::move(theName)), loader(std::move(theLoader)), uri(std::move(theUri)), environment(std::move(theEnvironment)), + constructorName(std::move(theConstructorName)), prefix(std::move(thePrefix)), isSingleInstance(theIsSingleInstance), - alienContext(theAlienContext), rdbFile(theRdbFile), + alienContext(std::move(theAlienContext)), rdbFile(std::move(theRdbFile)), constructorFn(nullptr), status(STATUS_NEW), dispose(true) {} Implementation( - OUString const & theName, + OUString theName, css::uno::Reference< css::lang::XSingleComponentFactory > const & theFactory1, css::uno::Reference< css::lang::XSingleServiceFactory > const & theFactory2, - css::uno::Reference< css::lang::XComponent > const & - theComponent): - name(theName), isSingleInstance(false), constructorFn(nullptr), + css::uno::Reference< css::lang::XComponent > theComponent): + name(std::move(theName)), isSingleInstance(false), constructorFn(nullptr), factory1(theFactory1), factory2(theFactory2), - component(theComponent), status(STATUS_LOADED), dispose(true) + component(std::move(theComponent)), status(STATUS_LOADED), dispose(true) { assert(theFactory1.is() || theFactory2.is()); } Implementation(const Implementation&) = delete; diff --git a/cppuhelper/source/typemanager.cxx b/cppuhelper/source/typemanager.cxx index ef6faef4b92a..39bec6b9cada 100644 --- a/cppuhelper/source/typemanager.cxx +++ b/cppuhelper/source/typemanager.cxx @@ -82,8 +82,8 @@ class SimpleTypeDescription: { public: SimpleTypeDescription( - css::uno::TypeClass typeClass, OUString const & name): - typeClass_(typeClass), name_(name) + css::uno::TypeClass typeClass, OUString name): + typeClass_(typeClass), name_(std::move(name)) {} private: @@ -105,8 +105,8 @@ class SequenceTypeDescription: public: SequenceTypeDescription( rtl::Reference< cppuhelper::TypeManager > const & manager, - OUString const & name, OUString const & componentType): - manager_(manager), name_(name), componentType_(componentType) + OUString name, OUString componentType): + manager_(manager), name_(std::move(name)), componentType_(std::move(componentType)) { assert(manager.is()); } private: @@ -148,9 +148,9 @@ class ModuleDescription: public: ModuleDescription( rtl::Reference< cppuhelper::TypeManager > const & manager, - OUString const & name, + OUString name, rtl::Reference< unoidl::ModuleEntity > const & entity): - manager_(manager), name_(name), entity_(entity) + manager_(manager), name_(std::move(name)), entity_(entity) { assert(manager.is()); assert(entity.is()); } private: @@ -199,9 +199,9 @@ EnumTypeDescription_Base; class EnumTypeDescription: public EnumTypeDescription_Base { public: EnumTypeDescription( - OUString const & name, + OUString name, rtl::Reference< unoidl::EnumTypeEntity > const & entity): - EnumTypeDescription_Base(entity->isPublished()), name_(name), + EnumTypeDescription_Base(entity->isPublished()), name_(std::move(name)), entity_(entity) { assert(entity.is()); } @@ -257,10 +257,10 @@ class PlainStructTypeDescription: public PlainStructTypeDescription_Base { public: PlainStructTypeDescription( rtl::Reference< cppuhelper::TypeManager > const & manager, - OUString const & name, + OUString name, rtl::Reference< unoidl::PlainStructTypeEntity > const & entity): PlainStructTypeDescription_Base(entity->isPublished()), - manager_(manager), name_(name), entity_(entity) + manager_(manager), name_(std::move(name)), entity_(entity) { assert(manager.is()); assert(entity.is()); } private: @@ -333,8 +333,8 @@ class ParameterizedMemberTypeDescription: { public: explicit ParameterizedMemberTypeDescription( - OUString const & typeParameterName): - typeParameterName_(typeParameterName) + OUString typeParameterName): + typeParameterName_(std::move(typeParameterName)) {} private: @@ -359,11 +359,11 @@ class PolymorphicStructTypeTemplateDescription: public: PolymorphicStructTypeTemplateDescription( rtl::Reference< cppuhelper::TypeManager > const & manager, - OUString const & name, + OUString name, rtl::Reference< unoidl::PolymorphicStructTypeTemplateEntity > const & entity): PolymorphicStructTypeTemplateDescription_Base(entity->isPublished()), - manager_(manager), name_(name), entity_(entity) + manager_(manager), name_(std::move(name)), entity_(entity) { assert(manager.is()); assert(entity.is()); } private: @@ -450,11 +450,11 @@ class InstantiatedPolymorphicStructTypeDescription: public: InstantiatedPolymorphicStructTypeDescription( rtl::Reference< cppuhelper::TypeManager > const & manager, - OUString const & name, + OUString name, rtl::Reference< unoidl::PolymorphicStructTypeTemplateEntity > const & entity, std::vector< OUString >&& arguments): - manager_(manager), name_(name), entity_(entity), arguments_(std::move(arguments)) + manager_(manager), name_(std::move(name)), entity_(entity), arguments_(std::move(arguments)) { assert(manager.is()); assert(entity.is()); @@ -553,10 +553,10 @@ class ExceptionTypeDescription: public ExceptionTypeDescription_Base { public: ExceptionTypeDescription( rtl::Reference< cppuhelper::TypeManager > const & manager, - OUString const & name, + OUString name, rtl::Reference< unoidl::ExceptionTypeEntity > const & entity): ExceptionTypeDescription_Base(entity->isPublished()), manager_(manager), - name_(name), entity_(entity) + name_(std::move(name)), entity_(entity) { assert(manager.is()); assert(entity.is()); } private: @@ -619,10 +619,10 @@ class AttributeDescription: public: AttributeDescription( rtl::Reference< cppuhelper::TypeManager > const & manager, - OUString const & name, - unoidl::InterfaceTypeEntity::Attribute const & attribute, + OUString name, + unoidl::InterfaceTypeEntity::Attribute attribute, sal_Int32 position): - manager_(manager), name_(name), attribute_(attribute), + manager_(manager), name_(std::move(name)), attribute_(std::move(attribute)), position_(position) { assert(manager.is()); } @@ -705,9 +705,9 @@ class MethodParameter: public: MethodParameter( rtl::Reference< cppuhelper::TypeManager > const & manager, - unoidl::InterfaceTypeEntity::Method::Parameter const & parameter, + unoidl::InterfaceTypeEntity::Method::Parameter parameter, sal_Int32 position): - manager_(manager), parameter_(parameter), position_(position) + manager_(manager), parameter_(std::move(parameter)), position_(position) { assert(manager.is()); } private: @@ -753,9 +753,9 @@ class MethodDescription: public: MethodDescription( rtl::Reference< cppuhelper::TypeManager > const & manager, - OUString const & name, - unoidl::InterfaceTypeEntity::Method const & method, sal_Int32 position): - manager_(manager), name_(name), method_(method), position_(position) + OUString name, + unoidl::InterfaceTypeEntity::Method method, sal_Int32 position): + manager_(manager), name_(std::move(name)), method_(std::move(method)), position_(position) { assert(manager.is()); } private: @@ -887,10 +887,10 @@ class InterfaceTypeDescription: public InterfaceTypeDescription_Base { public: InterfaceTypeDescription( rtl::Reference< cppuhelper::TypeManager > const & manager, - OUString const & name, + OUString name, rtl::Reference< unoidl::InterfaceTypeEntity > const & entity): InterfaceTypeDescription_Base(entity->isPublished()), manager_(manager), - name_(name), entity_(entity) + name_(std::move(name)), entity_(entity) { assert(manager.is()); assert(entity.is()); } private: @@ -1062,9 +1062,9 @@ ConstantGroupDescription_Base; class ConstantGroupDescription: public ConstantGroupDescription_Base { public: ConstantGroupDescription( - OUString const & name, + OUString name, rtl::Reference< unoidl::ConstantGroupEntity > const & entity): - ConstantGroupDescription_Base(entity->isPublished()), name_(name), + ConstantGroupDescription_Base(entity->isPublished()), name_(std::move(name)), entity_(entity) { assert(entity.is()); } @@ -1108,10 +1108,10 @@ class TypedefDescription: public TypedefDescription_Base { public: TypedefDescription( rtl::Reference< cppuhelper::TypeManager > const & manager, - OUString const & name, + OUString name, rtl::Reference< unoidl::TypedefEntity > const & entity): TypedefDescription_Base(entity->isPublished()), manager_(manager), - name_(name), entity_(entity) + name_(std::move(name)), entity_(entity) { assert(manager.is()); assert(entity.is()); } private: @@ -1138,10 +1138,9 @@ class ConstructorParameter: public: ConstructorParameter( rtl::Reference< cppuhelper::TypeManager > const & manager, - unoidl::SingleInterfaceBasedServiceEntity::Constructor::Parameter - const & parameter, + unoidl::SingleInterfaceBasedServiceEntity::Constructor::Parameter parameter, sal_Int32 position): - manager_(manager), parameter_(parameter), position_(position) + manager_(manager), parameter_(std::move(parameter)), position_(position) { assert(manager.is()); } private: @@ -1179,9 +1178,8 @@ class ConstructorDescription: public: ConstructorDescription( rtl::Reference< cppuhelper::TypeManager > const & manager, - unoidl::SingleInterfaceBasedServiceEntity::Constructor const & - constructor): - manager_(manager), constructor_(constructor) + unoidl::SingleInterfaceBasedServiceEntity::Constructor constructor): + manager_(manager), constructor_(std::move(constructor)) { assert(manager.is()); } private: @@ -1247,11 +1245,11 @@ class SingleInterfaceBasedServiceDescription: public: SingleInterfaceBasedServiceDescription( rtl::Reference< cppuhelper::TypeManager > const & manager, - OUString const & name, + OUString name, rtl::Reference< unoidl::SingleInterfaceBasedServiceEntity > const & entity): SingleInterfaceBasedServiceDescription_Base(entity->isPublished()), - manager_(manager), name_(name), entity_(entity) + manager_(manager), name_(std::move(name)), entity_(entity) { assert(manager.is()); assert(entity.is()); } private: @@ -1351,8 +1349,8 @@ class PropertyDescription: public: PropertyDescription( rtl::Reference< cppuhelper::TypeManager > const & manager, - unoidl::AccumulationBasedServiceEntity::Property const & property): - manager_(manager), property_(property) + unoidl::AccumulationBasedServiceEntity::Property property): + manager_(manager), property_(std::move(property)) { assert(manager.is()); } private: @@ -1385,11 +1383,11 @@ class AccumulationBasedServiceDescription: public: AccumulationBasedServiceDescription( rtl::Reference< cppuhelper::TypeManager > const & manager, - OUString const & name, + OUString name, rtl::Reference< unoidl::AccumulationBasedServiceEntity > const & entity): AccumulationBasedServiceDescription_Base(entity->isPublished()), - manager_(manager), name_(name), entity_(entity) + manager_(manager), name_(std::move(name)), entity_(entity) { assert(manager.is()); assert(entity.is()); } private: @@ -1554,10 +1552,10 @@ class InterfaceBasedSingletonDescription: public: InterfaceBasedSingletonDescription( rtl::Reference< cppuhelper::TypeManager > const & manager, - OUString const & name, + OUString name, rtl::Reference< unoidl::InterfaceBasedSingletonEntity > const & entity): InterfaceBasedSingletonDescription_Base(entity->isPublished()), - manager_(manager), name_(name), entity_(entity) + manager_(manager), name_(std::move(name)), entity_(entity) { assert(manager.is()); assert(entity.is()); } private: @@ -1598,10 +1596,10 @@ class ServiceBasedSingletonDescription: public: ServiceBasedSingletonDescription( rtl::Reference< cppuhelper::TypeManager > const & manager, - OUString const & name, + OUString name, rtl::Reference< unoidl::ServiceBasedSingletonEntity > const & entity): ServiceBasedSingletonDescription_Base(entity->isPublished()), - manager_(manager), name_(name), entity_(entity) + manager_(manager), name_(std::move(name)), entity_(entity) { assert(manager.is()); assert(entity.is()); } private: @@ -1666,16 +1664,16 @@ private: struct Position { Position( - OUString const & thePrefix, + OUString thePrefix, rtl::Reference< unoidl::MapCursor > const & theCursor): - prefix(thePrefix), cursor(theCursor) + prefix(std::move(thePrefix)), cursor(theCursor) { assert(theCursor.is()); } Position( - OUString const & thePrefix, + OUString thePrefix, rtl::Reference< unoidl::ConstantGroupEntity > const & theConstantGroup): - prefix(thePrefix), constantGroup(theConstantGroup), + prefix(std::move(thePrefix)), constantGroup(theConstantGroup), constantGroupIndex(constantGroup->getMembers().begin()) { assert(theConstantGroup.is()); } diff --git a/cppuhelper/source/unourl.cxx b/cppuhelper/source/unourl.cxx index 8ee7e593ad20..9656dd078ba1 100644 --- a/cppuhelper/source/unourl.cxx +++ b/cppuhelper/source/unourl.cxx @@ -31,6 +31,7 @@ #include <map> #include <memory> +#include <utility> using cppu::UnoUrl; using cppu::UnoUrlDescriptor; @@ -187,10 +188,10 @@ public: private: Impl(OUString const & rConnectionDescriptor, OUString const & rProtocolDescriptor, - OUString const & rObjectName): + OUString aObjectName): m_aConnection(rConnectionDescriptor), m_aProtocol(rProtocolDescriptor), - m_aObjectName(rObjectName) + m_aObjectName(std::move(aObjectName)) {} }; |