include/unotools/charclass.hxx | 4 ++-- include/unotools/configitem.hxx | 2 +- include/unotools/intlwrapper.hxx | 2 +- include/unotools/localedatawrapper.hxx | 4 ++-- include/unotools/progresshandlerwrap.hxx | 2 +- include/unotools/streamhelper.hxx | 5 +++-- include/unotools/viewoptions.hxx | 3 +-- unotools/source/config/configitem.cxx | 5 +++-- unotools/source/config/configvaluecontainer.cxx | 7 ++++--- unotools/source/config/viewoptions.cxx | 5 +++-- unotools/source/i18n/charclass.cxx | 9 +++++---- unotools/source/i18n/intlwrapper.cxx | 6 +++--- unotools/source/i18n/localedatawrapper.cxx | 9 +++++---- unotools/source/misc/ServiceDocumenter.hxx | 5 +++-- unotools/source/ucbhelper/progresshandlerwrap.cxx | 5 +++-- unotools/source/ucbhelper/ucblockbytes.cxx | 11 ++++++----- 16 files changed, 46 insertions(+), 38 deletions(-)
New commits: commit 7b87afa899be289306c709d35eb1d32c0b73b1ed Author: Noel Grandin <[email protected]> AuthorDate: Mon May 30 14:59:16 2022 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Mon May 30 19:16:45 2022 +0200 clang-tidy modernize-pass-by-value in unotools Change-Id: Ifa67ab7198f5d3b06171869f57703acdaa959f7d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135128 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/include/unotools/charclass.hxx b/include/unotools/charclass.hxx index ab695beb52cb..c76c7ae35f0b 100644 --- a/include/unotools/charclass.hxx +++ b/include/unotools/charclass.hxx @@ -69,11 +69,11 @@ public: /// Preferred ctor with service manager specified CharClass( const css::uno::Reference< css::uno::XComponentContext > & rxContext, - const LanguageTag& rLanguageTag ); + LanguageTag aLanguageTag ); /// Deprecated ctor, tries to get a process service manager or to load the /// library directly. - CharClass( const LanguageTag& rLanguageTag ); + CharClass( LanguageTag aLanguageTag ); ~CharClass(); diff --git a/include/unotools/configitem.hxx b/include/unotools/configitem.hxx index 63bd38dce6b4..7692bd3d6c9e 100644 --- a/include/unotools/configitem.hxx +++ b/include/unotools/configitem.hxx @@ -109,7 +109,7 @@ namespace utl virtual void ImplCommit() = 0; protected: - explicit ConfigItem(const OUString &rSubTree, + explicit ConfigItem(OUString aSubTree, ConfigItemMode nMode = ConfigItemMode::NONE); void SetModified (); // mark item as modified diff --git a/include/unotools/intlwrapper.hxx b/include/unotools/intlwrapper.hxx index 49d1f8bf5438..e86346a9552e 100644 --- a/include/unotools/intlwrapper.hxx +++ b/include/unotools/intlwrapper.hxx @@ -61,7 +61,7 @@ private: void ImplNewCollator( bool bCaseSensitive ) const; public: - IntlWrapper(const LanguageTag& rLanguageTag); + IntlWrapper(LanguageTag aLanguageTag); ~IntlWrapper(); const LocaleDataWrapper* getLocaleData() const diff --git a/include/unotools/localedatawrapper.hxx b/include/unotools/localedatawrapper.hxx index 2c408b4a0cf9..5fbdcd0782b7 100644 --- a/include/unotools/localedatawrapper.hxx +++ b/include/unotools/localedatawrapper.hxx @@ -118,14 +118,14 @@ class UNOTOOLS_DLLPUBLIC LocaleDataWrapper public: LocaleDataWrapper( const css::uno::Reference< css::uno::XComponentContext > & rxContext, - const LanguageTag& rLanguageTag + LanguageTag aLanguageTag ); /** @param rOverrideDateAcceptancePatterns Override locale's date acceptance patterns. An empty sequence resets the patterns to the locale's pattern sequence. */ LocaleDataWrapper( - const LanguageTag& rLanguageTag, + LanguageTag aLanguageTag, const std::vector<OUString> & rOverrideDateAcceptancePatterns = {} ); ~LocaleDataWrapper(); diff --git a/include/unotools/progresshandlerwrap.hxx b/include/unotools/progresshandlerwrap.hxx index 207ba2af8c1b..4fcfd36da044 100644 --- a/include/unotools/progresshandlerwrap.hxx +++ b/include/unotools/progresshandlerwrap.hxx @@ -38,7 +38,7 @@ class UNLESS_MERGELIBS(UNOTOOLS_DLLPUBLIC) ProgressHandlerWrap final css::uno::Reference<css::task::XStatusIndicator> m_xStatusIndicator; public: - ProgressHandlerWrap(css::uno::Reference<css::task::XStatusIndicator> const& xSI); + ProgressHandlerWrap(css::uno::Reference<css::task::XStatusIndicator> xSI); // XProgressHandler virtual void SAL_CALL push(const css::uno::Any& Status) override; diff --git a/include/unotools/streamhelper.hxx b/include/unotools/streamhelper.hxx index 5d0a3792855b..a727869bfea6 100644 --- a/include/unotools/streamhelper.hxx +++ b/include/unotools/streamhelper.hxx @@ -26,6 +26,7 @@ #include <cppuhelper/implbase.hxx> #include <tools/stream.hxx> #include <mutex> +#include <utility> namespace utl { @@ -41,9 +42,9 @@ class UNOTOOLS_DLLPUBLIC OInputStreamHelper final : public cppu::WeakImplHelper< sal_Int32 m_nAvailable; // this is typically the chunk(buffer) size public: - OInputStreamHelper(const SvLockBytesRef& _xLockBytes, + OInputStreamHelper(SvLockBytesRef _xLockBytes, sal_uInt32 _nAvailable) - :m_xLockBytes(_xLockBytes) + :m_xLockBytes(std::move(_xLockBytes)) ,m_nActPos(0) ,m_nAvailable(_nAvailable){} diff --git a/include/unotools/viewoptions.hxx b/include/unotools/viewoptions.hxx index 734c9cada7bb..273e38817c58 100644 --- a/include/unotools/viewoptions.hxx +++ b/include/unotools/viewoptions.hxx @@ -113,8 +113,7 @@ class SAL_WARN_UNUSED UNOTOOLS_DLLPUBLIC SvtViewOptions final @onerror An assertion is thrown in debug version. Otherwise we do nothing! *//*-*****************************************************************************************************/ - SvtViewOptions( EViewType eType , - const OUString& sViewName ); + SvtViewOptions( EViewType eType, OUString sViewName ); // interface diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx index 2632a79fb3b7..90da75c043eb 100644 --- a/unotools/source/config/configitem.cxx +++ b/unotools/source/config/configitem.cxx @@ -49,6 +49,7 @@ using namespace com::sun::star::container; using namespace com::sun::star::configuration; #include <cppuhelper/implbase.hxx> +#include <utility> /* The ConfigChangeListener_Impl receives notifications from the configuration about changes that @@ -137,8 +138,8 @@ void ConfigChangeListener_Impl::disposing( const EventObject& /*rSource*/ ) pParent->RemoveChangesListener(); } -ConfigItem::ConfigItem(const OUString &rSubTree, ConfigItemMode nSetMode ) : - sSubTree(rSubTree), +ConfigItem::ConfigItem(OUString aSubTree, ConfigItemMode nSetMode ) : + sSubTree(std::move(aSubTree)), m_nMode(nSetMode), m_bIsModified(false), m_bEnableInternalNotification(false), diff --git a/unotools/source/config/configvaluecontainer.cxx b/unotools/source/config/configvaluecontainer.cxx index 6fc60d753113..10abeaf12896 100644 --- a/unotools/source/config/configvaluecontainer.cxx +++ b/unotools/source/config/configvaluecontainer.cxx @@ -24,6 +24,7 @@ #include <unotools/confignode.hxx> #include <uno/data.h> #include <algorithm> +#include <utility> #include <vector> namespace utl @@ -53,7 +54,7 @@ namespace utl Type aDataType; // the type object pointed to by pLocation public: - explicit NodeValueAccessor( const OUString& _rNodePath ); + explicit NodeValueAccessor( OUString _aNodePath ); void bind( void* _pLocation, const Type& _rType ); @@ -66,8 +67,8 @@ namespace utl bool operator == ( const NodeValueAccessor& rhs ) const; }; - NodeValueAccessor::NodeValueAccessor( const OUString& _rNodePath ) - :sRelativePath( _rNodePath ) + NodeValueAccessor::NodeValueAccessor( OUString _aNodePath ) + :sRelativePath(std::move( _aNodePath )) ,eLocationType( LocationType::Unbound ) ,pLocation( nullptr ) { diff --git a/unotools/source/config/viewoptions.cxx b/unotools/source/config/viewoptions.cxx index c94e683c08d0..173ccdc10f66 100644 --- a/unotools/source/config/viewoptions.cxx +++ b/unotools/source/config/viewoptions.cxx @@ -27,6 +27,7 @@ #include <unotools/configmgr.hxx> #include <comphelper/configurationhelper.hxx> #include <comphelper/processfactory.hxx> +#include <utility> #include <tools/diagnose_ex.h> constexpr OUStringLiteral PACKAGE_VIEWS = u"org.openoffice.Office.Views"; @@ -36,9 +37,9 @@ constexpr OUStringLiteral PROPERTY_VISIBLE = u"Visible"; constexpr OUStringLiteral PROPERTY_USERDATA = u"UserData"; -SvtViewOptions::SvtViewOptions( EViewType eType, const OUString& sViewName ) +SvtViewOptions::SvtViewOptions( EViewType eType, OUString sViewName ) : m_eViewType ( eType ) - , m_sViewName ( sViewName ) + , m_sViewName (std::move( sViewName )) { (void)m_eViewType; // so the release build does not complain, since we only use it in assert // we must know, which view type we must support diff --git a/unotools/source/i18n/charclass.cxx b/unotools/source/i18n/charclass.cxx index 05bc2dd6bf48..b577d2577884 100644 --- a/unotools/source/i18n/charclass.cxx +++ b/unotools/source/i18n/charclass.cxx @@ -23,6 +23,7 @@ #include <tools/diagnose_ex.h> #include <com/sun/star/i18n/CharacterClassification.hpp> +#include <utility> using namespace ::com::sun::star; using namespace ::com::sun::star::i18n; @@ -30,15 +31,15 @@ using namespace ::com::sun::star::uno; CharClass::CharClass( const Reference< uno::XComponentContext > & rxContext, - const LanguageTag& rLanguageTag + LanguageTag aLanguageTag ) - : maLanguageTag( rLanguageTag) + : maLanguageTag(std::move( aLanguageTag)) { xCC = CharacterClassification::create( rxContext ); } -CharClass::CharClass( const LanguageTag& rLanguageTag ) - : maLanguageTag( rLanguageTag) +CharClass::CharClass( LanguageTag aLanguageTag ) + : maLanguageTag(std::move( aLanguageTag)) { xCC = CharacterClassification::create( comphelper::getProcessComponentContext() ); } diff --git a/unotools/source/i18n/intlwrapper.cxx b/unotools/source/i18n/intlwrapper.cxx index f15869fb6255..a4c21ea940aa 100644 --- a/unotools/source/i18n/intlwrapper.cxx +++ b/unotools/source/i18n/intlwrapper.cxx @@ -22,11 +22,11 @@ #include <unotools/localedatawrapper.hxx> #include <com/sun/star/i18n/CollatorOptions.hpp> #include <comphelper/processfactory.hxx> +#include <utility> -IntlWrapper::IntlWrapper( - const LanguageTag& rLanguageTag ) +IntlWrapper::IntlWrapper( LanguageTag aLanguageTag ) : - maLanguageTag( rLanguageTag ), + maLanguageTag(std::move( aLanguageTag )), m_xContext( comphelper::getProcessComponentContext() ) { } diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx index 469457986f56..55cde4a360a4 100644 --- a/unotools/source/i18n/localedatawrapper.cxx +++ b/unotools/source/i18n/localedatawrapper.cxx @@ -42,6 +42,7 @@ #include <tools/date.hxx> #include <tools/time.hxx> #include <o3tl/string_view.hxx> +#include <utility> const sal_uInt16 nCurrFormatDefault = 0; @@ -59,25 +60,25 @@ sal_uInt8 LocaleDataWrapper::nLocaleDataChecking = 0; LocaleDataWrapper::LocaleDataWrapper( const Reference< uno::XComponentContext > & rxContext, - const LanguageTag& rLanguageTag + LanguageTag aLanguageTag ) : m_xContext( rxContext ), xLD( LocaleData2::create(rxContext) ), - maLanguageTag( rLanguageTag ) + maLanguageTag(std::move( aLanguageTag )) { loadData(); loadDateAcceptancePatterns({}); } LocaleDataWrapper::LocaleDataWrapper( - const LanguageTag& rLanguageTag, + LanguageTag aLanguageTag, const std::vector<OUString> & rOverrideDateAcceptancePatterns ) : m_xContext( comphelper::getProcessComponentContext() ), xLD( LocaleData2::create(m_xContext) ), - maLanguageTag( rLanguageTag ) + maLanguageTag(std::move( aLanguageTag )) { loadData(); loadDateAcceptancePatterns(rOverrideDateAcceptancePatterns); diff --git a/unotools/source/misc/ServiceDocumenter.hxx b/unotools/source/misc/ServiceDocumenter.hxx index 9cef2bf01172..0c94b5ac7e83 100644 --- a/unotools/source/misc/ServiceDocumenter.hxx +++ b/unotools/source/misc/ServiceDocumenter.hxx @@ -11,6 +11,7 @@ #include <cppuhelper/implbase.hxx> #include <com/sun/star/script/XServiceDocumenter.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> +#include <utility> namespace com::sun::star::uno { class XComponentContext; } @@ -20,8 +21,8 @@ class ServiceDocumenter : public ::cppu::WeakImplHelper< css::script::XServiceDocumenter, css::lang::XServiceInfo> { public: - ServiceDocumenter(css::uno::Reference< css::uno::XComponentContext> const& xContext) - : m_xContext(xContext) + ServiceDocumenter(css::uno::Reference< css::uno::XComponentContext> xContext) + : m_xContext(std::move(xContext)) , m_sCoreBaseUrl("http://example.com") , m_sServiceBaseUrl("https://api.libreoffice.org/docs/idl/ref") {}; diff --git a/unotools/source/ucbhelper/progresshandlerwrap.cxx b/unotools/source/ucbhelper/progresshandlerwrap.cxx index 0934633836a6..29c1067ec7fc 100644 --- a/unotools/source/ucbhelper/progresshandlerwrap.cxx +++ b/unotools/source/ucbhelper/progresshandlerwrap.cxx @@ -19,6 +19,7 @@ #include <unotools/progresshandlerwrap.hxx> #include <com/sun/star/task/XStatusIndicator.hpp> +#include <utility> namespace utl { @@ -27,8 +28,8 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::task; using namespace ::com::sun::star::ucb; -ProgressHandlerWrap::ProgressHandlerWrap( css::uno::Reference< css::task::XStatusIndicator > const & xSI ) -: m_xStatusIndicator( xSI ) +ProgressHandlerWrap::ProgressHandlerWrap( css::uno::Reference< css::task::XStatusIndicator > xSI ) +: m_xStatusIndicator(std::move( xSI )) { } diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx b/unotools/source/ucbhelper/ucblockbytes.cxx index 9cbee8ef6b95..ad116eff294f 100644 --- a/unotools/source/ucbhelper/ucblockbytes.cxx +++ b/unotools/source/ucbhelper/ucblockbytes.cxx @@ -60,6 +60,7 @@ #include <comphelper/storagehelper.hxx> #include <ucbhelper/content.hxx> #include <mutex> +#include <utility> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::io; @@ -156,8 +157,8 @@ class UcbPropertiesChangeListener_Impl : public ::cppu::WeakImplHelper< XPropert public: UcbLockBytesRef m_xLockBytes; - explicit UcbPropertiesChangeListener_Impl( UcbLockBytesRef const & rRef ) - : m_xLockBytes( rRef ) + explicit UcbPropertiesChangeListener_Impl( UcbLockBytesRef xRef ) + : m_xLockBytes(std::move( xRef )) {} virtual void SAL_CALL disposing ( const EventObject &/*rEvent*/) override {} @@ -193,7 +194,7 @@ public: Moderator( Reference < XContent > const & xContent, Reference < XInteractionHandler > const & xInteract, - const Command& rArg + Command aArg ); enum class ResultType { @@ -419,14 +420,14 @@ ModeratorsInteractionHandler::handle( Moderator::Moderator( Reference < XContent > const & xContent, Reference < XInteractionHandler > const & xInteract, - const Command& rArg + Command aArg ) : m_aRes(m_aMutex,*this), m_aResultType(ResultType::NORESULT), m_nIOErrorCode(IOErrorCode_ABORT), m_aRep(m_aMutex,*this), m_aReplyType(NOREPLY), - m_aArg(rArg), + m_aArg(std::move(aArg)), m_aContent( xContent, new UcbTaskEnvironment(
