From 165d0a149d631d96a91118dfc7686bd2ebb0b6b9 Mon Sep 17 00:00:00 2001 From: Jochen Nitschke Date: Sat, 30 Sep 2017 23:58:17 +0200 Subject: clang-tidy modernize-use-equals-default in svl SfxPoolItem has a copy constructor and its copy assignment operator is deleted. Derived classes have a implicit defined copy constructor too, if all members are copy constructible. This patch removes default able copy constructors on such items. Note: clang-tidy only finds functions defined in source, inlined functions in headers are picked manualy. Change-Id: I7e642a2ecf139420c53f6fcb39208918dd1a8d52 Reviewed-on: https://gerrit.libreoffice.org/43003 Tested-by: Jenkins Reviewed-by: Noel Grandin --- include/svl/cenumitm.hxx | 3 +-- include/svl/cintitem.hxx | 16 ---------------- include/svl/custritm.hxx | 4 ---- include/svl/eitem.hxx | 10 +--------- include/svl/flagitem.hxx | 1 - include/svl/ilstitem.hxx | 1 - include/svl/int64item.hxx | 1 - include/svl/intitem.hxx | 4 ---- include/svl/lckbitem.hxx | 1 - include/svl/macitem.hxx | 7 +------ include/svl/metitem.hxx | 1 - include/svl/poolitem.hxx | 2 -- include/svl/ptitem.hxx | 1 - include/svl/rectitem.hxx | 1 - include/svl/rngitem.hxx | 1 - include/svl/slstitm.hxx | 1 - include/svl/visitem.hxx | 4 ---- svl/source/items/flagitem.cxx | 7 ------- svl/source/items/ilstitem.cxx | 6 ------ svl/source/items/imageitm.cxx | 2 +- svl/source/items/int64item.cxx | 5 ----- svl/source/items/intitem.cxx | 5 ----- svl/source/items/lckbitem.cxx | 7 ------- svl/source/items/poolitem.cxx | 6 ------ svl/source/items/ptitem.cxx | 7 ------- svl/source/items/rectitem.cxx | 7 ------- svl/source/items/rngitem.cxx | 8 -------- svl/source/items/sitem.cxx | 2 +- svl/source/items/slstitm.cxx | 8 -------- 29 files changed, 5 insertions(+), 124 deletions(-) diff --git a/include/svl/cenumitm.hxx b/include/svl/cenumitm.hxx index 1857be8cc886..92a537cb390a 100644 --- a/include/svl/cenumitm.hxx +++ b/include/svl/cenumitm.hxx @@ -28,8 +28,7 @@ class SVL_DLLPUBLIC SfxEnumItemInterface: public SfxPoolItem protected: explicit SfxEnumItemInterface(sal_uInt16 which): SfxPoolItem(which) {} - SfxEnumItemInterface(const SfxEnumItemInterface & rItem): - SfxPoolItem(rItem) {} + SfxEnumItemInterface(const SfxEnumItemInterface &) = default; public: diff --git a/include/svl/cintitem.hxx b/include/svl/cintitem.hxx index 9b265179cd77..f8e1ea3f0fa3 100644 --- a/include/svl/cintitem.hxx +++ b/include/svl/cintitem.hxx @@ -33,10 +33,6 @@ public: CntByteItem(sal_uInt16 which, sal_uInt8 nTheValue): SfxPoolItem(which), m_nValue(nTheValue) {} - CntByteItem(const CntByteItem & rItem): - SfxPoolItem(rItem), m_nValue(rItem.m_nValue) - {} - virtual bool operator ==(const SfxPoolItem & rItem) const override; virtual bool GetPresentation(SfxItemPresentation, @@ -80,10 +76,6 @@ public: CntUInt16Item(sal_uInt16 which, SvStream & rStream); - CntUInt16Item(const CntUInt16Item & rItem): - SfxPoolItem(rItem), m_nValue(rItem.m_nValue) - {} - virtual bool operator ==(const SfxPoolItem & rItem) const override; virtual bool GetPresentation(SfxItemPresentation, @@ -127,10 +119,6 @@ public: CntInt32Item(sal_uInt16 which, SvStream & rStream); - CntInt32Item(const CntInt32Item & rItem): - SfxPoolItem(rItem), m_nValue(rItem.m_nValue) - {} - virtual bool operator ==(const SfxPoolItem & rItem) const override; virtual bool GetPresentation(SfxItemPresentation, @@ -174,10 +162,6 @@ public: CntUInt32Item(sal_uInt16 nWhich, SvStream & rStream); - CntUInt32Item(const CntUInt32Item & rItem): - SfxPoolItem(rItem), m_nValue(rItem.m_nValue) - {} - virtual bool operator ==(const SfxPoolItem & rItem) const override; virtual bool GetPresentation(SfxItemPresentation, diff --git a/include/svl/custritm.hxx b/include/svl/custritm.hxx index c48988448418..65facd5cd54e 100644 --- a/include/svl/custritm.hxx +++ b/include/svl/custritm.hxx @@ -37,10 +37,6 @@ public: SfxPoolItem(which), m_aValue(rTheValue) {} - CntUnencodedStringItem(const CntUnencodedStringItem & rItem): - SfxPoolItem(rItem), m_aValue(rItem.m_aValue) - {} - virtual bool operator ==(const SfxPoolItem & rItem) const override; virtual bool GetPresentation(SfxItemPresentation, diff --git a/include/svl/eitem.hxx b/include/svl/eitem.hxx index cbfc1a4930a0..eb488f65b251 100644 --- a/include/svl/eitem.hxx +++ b/include/svl/eitem.hxx @@ -36,10 +36,7 @@ protected: , m_nValue(nValue) { } - SfxEnumItem(const SfxEnumItem & rItem) - : SfxEnumItemInterface(rItem) - , m_nValue(rItem.m_nValue) - { } + SfxEnumItem(const SfxEnumItem &) = default; SfxEnumItem(sal_uInt16 const nWhich, SvStream & rStream) : SfxEnumItemInterface(nWhich) @@ -95,11 +92,6 @@ public: , m_bValue(bValue) { } - SfxBoolItem(SfxBoolItem const& rItem) - : SfxPoolItem(rItem) - , m_bValue(rItem.m_bValue) - { } - SfxBoolItem(sal_uInt16 nWhich, SvStream & rStream); bool GetValue() const { return m_bValue; } diff --git a/include/svl/flagitem.hxx b/include/svl/flagitem.hxx index 56965d68ba8b..ce88c35f96f6 100644 --- a/include/svl/flagitem.hxx +++ b/include/svl/flagitem.hxx @@ -31,7 +31,6 @@ class SVL_DLLPUBLIC SfxFlagItem: public SfxPoolItem public: explicit SfxFlagItem( sal_uInt16 nWhich = 0, sal_uInt16 nValue = 0 ); - SfxFlagItem( const SfxFlagItem& ); virtual sal_uInt8 GetFlagCount() const; diff --git a/include/svl/ilstitem.hxx b/include/svl/ilstitem.hxx index 422d38d6c023..a5916eadf1f1 100644 --- a/include/svl/ilstitem.hxx +++ b/include/svl/ilstitem.hxx @@ -34,7 +34,6 @@ public: SfxIntegerListItem(); SfxIntegerListItem( sal_uInt16 nWhich, const ::std::vector < sal_Int32 >& rList ); SfxIntegerListItem( sal_uInt16 nWhich, const css::uno::Sequence < sal_Int32 >& rList ); - SfxIntegerListItem( const SfxIntegerListItem& rItem ); virtual ~SfxIntegerListItem() override; const std::vector< sal_Int32 >& GetList() const { return m_aList; } diff --git a/include/svl/int64item.hxx b/include/svl/int64item.hxx index 3c2148e2411f..9a4defcd0e8b 100644 --- a/include/svl/int64item.hxx +++ b/include/svl/int64item.hxx @@ -20,7 +20,6 @@ class SVL_DLLPUBLIC SfxInt64Item : public SfxPoolItem public: SfxInt64Item( sal_uInt16 nWhich, sal_Int64 nVal ); SfxInt64Item( sal_uInt16 nWhich, SvStream & rStream ); - SfxInt64Item( const SfxInt64Item& rItem ); virtual ~SfxInt64Item() override; diff --git a/include/svl/intitem.hxx b/include/svl/intitem.hxx index 5c73398864ad..448eda8a514b 100644 --- a/include/svl/intitem.hxx +++ b/include/svl/intitem.hxx @@ -51,10 +51,6 @@ public: SfxInt16Item(sal_uInt16 nWhich, SvStream & rStream); - SfxInt16Item(const SfxInt16Item & rItem): - SfxPoolItem(rItem), m_nValue(rItem.m_nValue) - {} - virtual bool operator ==(const SfxPoolItem & rItem) const override; virtual bool GetPresentation(SfxItemPresentation, diff --git a/include/svl/lckbitem.hxx b/include/svl/lckbitem.hxx index b6548256c559..ca5402cf2933 100644 --- a/include/svl/lckbitem.hxx +++ b/include/svl/lckbitem.hxx @@ -31,7 +31,6 @@ public: static SfxPoolItem* CreateDefault(); SfxLockBytesItem(); SfxLockBytesItem( sal_uInt16 nWhich, SvStream & ); - SfxLockBytesItem( const SfxLockBytesItem& ); virtual ~SfxLockBytesItem() override; virtual bool operator==( const SfxPoolItem& ) const override; diff --git a/include/svl/macitem.hxx b/include/svl/macitem.hxx index 54ca627a632f..7d17b3349dd3 100644 --- a/include/svl/macitem.hxx +++ b/include/svl/macitem.hxx @@ -137,17 +137,12 @@ public: private: SvxMacroTableDtor aMacroTable; - inline SvxMacroItem( const SvxMacroItem& ); - SvxMacroItem &operator=( const SvxMacroItem & ) = delete; + SvxMacroItem( const SvxMacroItem& ) = default; }; inline SvxMacroItem::SvxMacroItem( const sal_uInt16 nId ) : SfxPoolItem( nId ) {} -inline SvxMacroItem::SvxMacroItem( const SvxMacroItem &rCpy ) - : SfxPoolItem( rCpy ), - aMacroTable( rCpy.GetMacroTable() ) -{} inline bool SvxMacroItem::HasMacro( SvMacroItemId nEvent ) const { diff --git a/include/svl/metitem.hxx b/include/svl/metitem.hxx index bcace549a956..be5b1b7ba497 100644 --- a/include/svl/metitem.hxx +++ b/include/svl/metitem.hxx @@ -26,7 +26,6 @@ class SVL_DLLPUBLIC SfxMetricItem: public SfxInt32Item { public: explicit SfxMetricItem( sal_uInt16 nWhich, sal_uInt32 nValue ); - SfxMetricItem( const SfxMetricItem& ); virtual void ScaleMetrics( long lMult, long lDiv ) override; virtual bool HasMetrics() const override; diff --git a/include/svl/poolitem.hxx b/include/svl/poolitem.hxx index 5a7c5073396b..7f9540c166a2 100644 --- a/include/svl/poolitem.hxx +++ b/include/svl/poolitem.hxx @@ -243,11 +243,9 @@ inline bool IsInvalidItem(const SfxPoolItem *pItem) class SVL_DLLPUBLIC SfxVoidItem final: public SfxPoolItem { - SfxVoidItem & operator=( const SfxVoidItem& ) = delete; public: static SfxPoolItem* CreateDefault(); explicit SfxVoidItem( sal_uInt16 nWhich ); - SfxVoidItem( const SfxVoidItem& ); virtual ~SfxVoidItem() override; virtual bool operator==( const SfxPoolItem& ) const override; diff --git a/include/svl/ptitem.hxx b/include/svl/ptitem.hxx index 7854c089abeb..b4513c9e85fc 100644 --- a/include/svl/ptitem.hxx +++ b/include/svl/ptitem.hxx @@ -33,7 +33,6 @@ public: static SfxPoolItem* CreateDefault(); SfxPointItem(); SfxPointItem( sal_uInt16 nWhich, const Point& rVal ); - SfxPointItem( const SfxPointItem& ); virtual bool GetPresentation( SfxItemPresentation ePres, MapUnit eCoreMetric, diff --git a/include/svl/rectitem.hxx b/include/svl/rectitem.hxx index 25a722227355..d37be512bc47 100644 --- a/include/svl/rectitem.hxx +++ b/include/svl/rectitem.hxx @@ -34,7 +34,6 @@ public: static SfxPoolItem* CreateDefault(); SfxRectangleItem(); SfxRectangleItem( sal_uInt16 nWhich, const tools::Rectangle& rVal ); - SfxRectangleItem( const SfxRectangleItem& ); virtual bool GetPresentation( SfxItemPresentation ePres, MapUnit eCoreMetric, diff --git a/include/svl/rngitem.hxx b/include/svl/rngitem.hxx index e07f21f9cb6e..316b9c334f3d 100644 --- a/include/svl/rngitem.hxx +++ b/include/svl/rngitem.hxx @@ -33,7 +33,6 @@ private: sal_uInt16 nTo; public: SfxRangeItem( sal_uInt16 nWID, sal_uInt16 nFrom, sal_uInt16 nTo ); - SfxRangeItem( const SfxRangeItem& rItem ); virtual bool operator==( const SfxPoolItem& ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, MapUnit eCoreMetric, diff --git a/include/svl/slstitm.hxx b/include/svl/slstitm.hxx index c22a5bf6bf20..7f11ecbe4597 100644 --- a/include/svl/slstitm.hxx +++ b/include/svl/slstitm.hxx @@ -36,7 +36,6 @@ public: SfxStringListItem(); SfxStringListItem( sal_uInt16 nWhich, const std::vector *pList=nullptr ); SfxStringListItem( sal_uInt16 nWhich, SvStream& rStream ); - SfxStringListItem( const SfxStringListItem& rItem ); virtual ~SfxStringListItem() override; std::vector& GetList(); diff --git a/include/svl/visitem.hxx b/include/svl/visitem.hxx index c73bd970f863..a5a481fa2a6c 100644 --- a/include/svl/visitem.hxx +++ b/include/svl/visitem.hxx @@ -38,10 +38,6 @@ public: SfxVisibilityItem(sal_uInt16 which, SvStream & rStream); - SfxVisibilityItem(const SfxVisibilityItem & rItem): - SfxPoolItem(rItem), m_nValue(rItem.m_nValue) - {} - virtual bool operator ==(const SfxPoolItem & rItem) const override; virtual bool GetPresentation(SfxItemPresentation, MapUnit, MapUnit, diff --git a/svl/source/items/flagitem.cxx b/svl/source/items/flagitem.cxx index 916c94ef961b..6c4f41abb586 100644 --- a/svl/source/items/flagitem.cxx +++ b/svl/source/items/flagitem.cxx @@ -30,13 +30,6 @@ SfxFlagItem::SfxFlagItem( sal_uInt16 nW, sal_uInt16 nV ) : } -SfxFlagItem::SfxFlagItem( const SfxFlagItem& rItem ) : - SfxPoolItem( rItem ), - nVal( rItem.nVal ) -{ -} - - SvStream& SfxFlagItem::Store(SvStream &rStream, sal_uInt16) const { rStream.WriteUInt16( nVal ); diff --git a/svl/source/items/ilstitem.cxx b/svl/source/items/ilstitem.cxx index c020901e583b..bf95e3afd52f 100644 --- a/svl/source/items/ilstitem.cxx +++ b/svl/source/items/ilstitem.cxx @@ -46,12 +46,6 @@ SfxIntegerListItem::SfxIntegerListItem( sal_uInt16 which, const css::uno::Sequen m_aList[n] = rList[n]; } -SfxIntegerListItem::SfxIntegerListItem( const SfxIntegerListItem& rItem ) - : SfxPoolItem( rItem ) - , m_aList( rItem.m_aList ) -{ -} - SfxIntegerListItem::~SfxIntegerListItem() { } diff --git a/svl/source/items/imageitm.cxx b/svl/source/items/imageitm.cxx index a77f52f8b2fa..269e80936af3 100644 --- a/svl/source/items/imageitm.cxx +++ b/svl/source/items/imageitm.cxx @@ -44,7 +44,7 @@ SfxImageItem::SfxImageItem( sal_uInt16 which ) SfxImageItem::SfxImageItem( const SfxImageItem& rItem ) : SfxInt16Item( rItem ), - pImpl( new SfxImageItem_Impl( *(rItem.pImpl.get()) ) ) + pImpl( new SfxImageItem_Impl( *rItem.pImpl ) ) { } diff --git a/svl/source/items/int64item.cxx b/svl/source/items/int64item.cxx index afe284520bb8..b5dc818b9d46 100644 --- a/svl/source/items/int64item.cxx +++ b/svl/source/items/int64item.cxx @@ -21,11 +21,6 @@ SfxInt64Item::SfxInt64Item( sal_uInt16 nWhich, SvStream& rStream ) : rStream.ReadInt64(mnValue); } -SfxInt64Item::SfxInt64Item( const SfxInt64Item& rItem ) : - SfxPoolItem(rItem), mnValue(rItem.mnValue) -{ -} - SfxInt64Item::~SfxInt64Item() {} bool SfxInt64Item::operator== ( const SfxPoolItem& rItem ) const diff --git a/svl/source/items/intitem.cxx b/svl/source/items/intitem.cxx index 6fdd060a9676..37d07926e2bf 100644 --- a/svl/source/items/intitem.cxx +++ b/svl/source/items/intitem.cxx @@ -153,11 +153,6 @@ SfxMetricItem::SfxMetricItem(sal_uInt16 which, sal_uInt32 nValue): { } -SfxMetricItem::SfxMetricItem(const SfxMetricItem & rItem): - SfxInt32Item(rItem) -{ -} - // virtual void SfxMetricItem::ScaleMetrics(long nMult, long nDiv) { diff --git a/svl/source/items/lckbitem.cxx b/svl/source/items/lckbitem.cxx index a3f89de4c339..4d47efa937e2 100644 --- a/svl/source/items/lckbitem.cxx +++ b/svl/source/items/lckbitem.cxx @@ -44,13 +44,6 @@ SfxLockBytesItem::SfxLockBytesItem( sal_uInt16 nW, SvStream &rStream ) } -SfxLockBytesItem::SfxLockBytesItem( const SfxLockBytesItem& rItem ) -: SfxPoolItem( rItem ), - _xVal( rItem._xVal ) -{ -} - - SfxLockBytesItem::~SfxLockBytesItem() { } diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx index aebe8cda4389..5fe5c480ff07 100644 --- a/svl/source/items/poolitem.cxx +++ b/svl/source/items/poolitem.cxx @@ -149,12 +149,6 @@ SfxVoidItem::SfxVoidItem( sal_uInt16 which ): { } -SfxVoidItem::SfxVoidItem( const SfxVoidItem& rCopy): - SfxPoolItem(rCopy) -{ -} - - bool SfxVoidItem::operator==( const SfxPoolItem& rCmp ) const { assert(SfxPoolItem::operator==(rCmp)); diff --git a/svl/source/items/ptitem.cxx b/svl/source/items/ptitem.cxx index dd6f3a6bd3bb..03493d143e04 100644 --- a/svl/source/items/ptitem.cxx +++ b/svl/source/items/ptitem.cxx @@ -46,13 +46,6 @@ SfxPointItem::SfxPointItem( sal_uInt16 nW, const Point& rVal ) : } -SfxPointItem::SfxPointItem( const SfxPointItem& rItem ) : - SfxPoolItem( rItem ), - aVal( rItem.aVal ) -{ -} - - bool SfxPointItem::GetPresentation ( SfxItemPresentation /*ePresentation*/, diff --git a/svl/source/items/rectitem.cxx b/svl/source/items/rectitem.cxx index e4bd0d9b97c2..d481a78df22d 100644 --- a/svl/source/items/rectitem.cxx +++ b/svl/source/items/rectitem.cxx @@ -43,13 +43,6 @@ SfxRectangleItem::SfxRectangleItem( sal_uInt16 nW, const tools::Rectangle& rVal } -SfxRectangleItem::SfxRectangleItem( const SfxRectangleItem& rItem ) : - SfxPoolItem( rItem ), - aVal( rItem.aVal ) -{ -} - - bool SfxRectangleItem::GetPresentation ( SfxItemPresentation /*ePresentation*/, diff --git a/svl/source/items/rngitem.cxx b/svl/source/items/rngitem.cxx index efb837eaab98..6b0a3768d555 100644 --- a/svl/source/items/rngitem.cxx +++ b/svl/source/items/rngitem.cxx @@ -32,14 +32,6 @@ SfxRangeItem::SfxRangeItem( sal_uInt16 which, sal_uInt16 from, sal_uInt16 to ): } -SfxRangeItem::SfxRangeItem( const SfxRangeItem& rItem ) : - SfxPoolItem( rItem ) -{ - nFrom = rItem.nFrom; - nTo = rItem.nTo; -} - - bool SfxRangeItem::GetPresentation ( SfxItemPresentation /*ePresentation*/, diff --git a/svl/source/items/sitem.cxx b/svl/source/items/sitem.cxx index ef50cc1a9037..7b9264910597 100644 --- a/svl/source/items/sitem.cxx +++ b/svl/source/items/sitem.cxx @@ -42,7 +42,7 @@ SfxSetItem::SfxSetItem( sal_uInt16 which, std::unique_ptr &&pS) : SfxSetItem::SfxSetItem( const SfxSetItem& rCopy, SfxItemPool *pPool ) : - SfxPoolItem(rCopy.Which()), + SfxPoolItem(rCopy), pSet(rCopy.pSet->Clone(true, pPool)) { } diff --git a/svl/source/items/slstitm.cxx b/svl/source/items/slstitm.cxx index 4a5e40595530..a0acd09fc532 100644 --- a/svl/source/items/slstitm.cxx +++ b/svl/source/items/slstitm.cxx @@ -64,14 +64,6 @@ SfxStringListItem::SfxStringListItem( sal_uInt16 which, SvStream& rStream ) : } } - -SfxStringListItem::SfxStringListItem( const SfxStringListItem& rItem ) : - SfxPoolItem( rItem ), - mpList(rItem.mpList) -{ -} - - SfxStringListItem::~SfxStringListItem() { } -- cgit