diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-08-22 15:42:36 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-08-23 11:48:53 +0200 |
commit | 63dfd069b3a957361881c12ccba38c5a23b9a42f (patch) | |
tree | e7a9bd1027b19f44a7c58ea9c445ded435c838bc /include | |
parent | 61ed17cafc90d9b4303b52260f729638eed107c7 (diff) |
Mark move ctors/assignments noexcept
This should enable using move semantics where possible e.g. in standard
containers.
According to https://en.cppreference.com/w/cpp/language/move_constructor:
To make strong exception guarantee possible, user-defined move
constructors should not throw exceptions. For example, std::vector
relies on std::move_if_noexcept to choose between move and copy
when the elements need to be relocated.
Change-Id: I6e1e1cdd5cd430b139ffa2fa7031fb0bb625decb
Reviewed-on: https://gerrit.libreoffice.org/77957
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/canvas/vclwrapper.hxx | 7 | ||||
-rw-r--r-- | include/comphelper/namedvaluecollection.hxx | 4 | ||||
-rw-r--r-- | include/connectivity/FValue.hxx | 8 | ||||
-rw-r--r-- | include/connectivity/dbmetadata.hxx | 4 | ||||
-rw-r--r-- | include/drawinglayer/primitive2d/baseprimitive2d.hxx | 4 | ||||
-rw-r--r-- | include/drawinglayer/primitive3d/baseprimitive3d.hxx | 4 | ||||
-rw-r--r-- | include/editeng/brushitem.hxx | 2 | ||||
-rw-r--r-- | include/o3tl/cow_wrapper.hxx | 4 | ||||
-rw-r--r-- | include/svl/itemset.hxx | 2 | ||||
-rw-r--r-- | include/svl/sharedstring.hxx | 4 | ||||
-rw-r--r-- | include/svl/svdde.hxx | 4 | ||||
-rw-r--r-- | include/svx/dataaccessdescriptor.hxx | 4 | ||||
-rw-r--r-- | include/svx/sdr/attribute/sdrformtextattribute.hxx | 4 | ||||
-rw-r--r-- | include/svx/sdr/attribute/sdrtextattribute.hxx | 4 | ||||
-rw-r--r-- | include/tools/ref.hxx | 2 | ||||
-rw-r--r-- | include/ucbhelper/content.hxx | 4 | ||||
-rw-r--r-- | include/vcl/bitmap.hxx | 2 | ||||
-rw-r--r-- | include/vcl/graph.hxx | 4 | ||||
-rw-r--r-- | include/vcl/transfer.hxx | 2 |
19 files changed, 36 insertions, 37 deletions
diff --git a/include/canvas/vclwrapper.hxx b/include/canvas/vclwrapper.hxx index 0a80cb282986..3913219143bc 100644 --- a/include/canvas/vclwrapper.hxx +++ b/include/canvas/vclwrapper.hxx @@ -78,10 +78,9 @@ namespace canvas mpWrappee = nullptr; } - VCLObject( VCLObject&& rOrig ) - : mpWrappee(rOrig.mpWrappee) + VCLObject(VCLObject&& rOrig) noexcept + : mpWrappee(std::move(rOrig.mpWrappee)) { - rOrig.mpWrappee = nullptr; } // This object has value semantics, thus, forward copy @@ -111,7 +110,7 @@ namespace canvas return *this; } - VCLObject& operator=( VCLObject&& rhs ) + VCLObject& operator=(VCLObject&& rhs) noexcept { std::swap(mpWrappee, rhs.mpWrappee); diff --git a/include/comphelper/namedvaluecollection.hxx b/include/comphelper/namedvaluecollection.hxx index 46a2594d1028..b6986b13033b 100644 --- a/include/comphelper/namedvaluecollection.hxx +++ b/include/comphelper/namedvaluecollection.hxx @@ -48,10 +48,10 @@ namespace comphelper NamedValueCollection(); NamedValueCollection( const NamedValueCollection& _rCopySource ); - NamedValueCollection( NamedValueCollection&& _rCopySource ); + NamedValueCollection(NamedValueCollection&& _rCopySource) noexcept; NamedValueCollection& operator=( const NamedValueCollection& i_rCopySource ); - NamedValueCollection& operator=( NamedValueCollection&& i_rCopySource ); + NamedValueCollection& operator=(NamedValueCollection&& i_rCopySource) noexcept; /** constructs a collection @param _rElements diff --git a/include/connectivity/FValue.hxx b/include/connectivity/FValue.hxx index e79ef73f0a13..c9f9c86cbb0b 100644 --- a/include/connectivity/FValue.hxx +++ b/include/connectivity/FValue.hxx @@ -74,7 +74,7 @@ namespace connectivity bool m_bModified : 1; // value was changed bool m_bSigned : 1; // value is signed - void free(); + void free() noexcept; public: ORowSetValue() @@ -98,7 +98,7 @@ namespace connectivity operator=(_rRH); } - ORowSetValue(ORowSetValue&& _rRH) + ORowSetValue(ORowSetValue&& _rRH) noexcept :m_eTypeKind(css::sdbc::DataType::VARCHAR) ,m_bNull(true) ,m_bBound(true) @@ -106,7 +106,7 @@ namespace connectivity ,m_bSigned(true) { m_aValue.m_pString = nullptr; - operator=(_rRH); + operator=(std::move(_rRH)); } ORowSetValue(const OUString& _rRH) @@ -279,7 +279,7 @@ namespace connectivity } ORowSetValue& operator=(const ORowSetValue& _rRH); - ORowSetValue& operator=(ORowSetValue&& _rRH); + ORowSetValue& operator=(ORowSetValue&& _rRH) noexcept; // simple types ORowSetValue& operator=(bool _rRH); diff --git a/include/connectivity/dbmetadata.hxx b/include/connectivity/dbmetadata.hxx index 085b30b52875..17a392dfe568 100644 --- a/include/connectivity/dbmetadata.hxx +++ b/include/connectivity/dbmetadata.hxx @@ -72,8 +72,8 @@ namespace dbtools const css::uno::Reference< css::sdbc::XConnection >& _connection ); DatabaseMetaData( const DatabaseMetaData& _copyFrom ); DatabaseMetaData& operator=( const DatabaseMetaData& _copyFrom ); - DatabaseMetaData( DatabaseMetaData&& _copyFrom ); - DatabaseMetaData& operator=( DatabaseMetaData&& _copyFrom ); + DatabaseMetaData(DatabaseMetaData&& _copyFrom) noexcept; + DatabaseMetaData& operator=(DatabaseMetaData&& _copyFrom) noexcept; ~DatabaseMetaData(); diff --git a/include/drawinglayer/primitive2d/baseprimitive2d.hxx b/include/drawinglayer/primitive2d/baseprimitive2d.hxx index e7e83d9e06c3..0d0921850588 100644 --- a/include/drawinglayer/primitive2d/baseprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/baseprimitive2d.hxx @@ -76,7 +76,7 @@ namespace drawinglayer { namespace primitive2d { explicit Primitive2DContainer( size_type count ) : deque(count) {} virtual ~Primitive2DContainer() override; Primitive2DContainer( const Primitive2DContainer& other ) : deque(other) {} - Primitive2DContainer( Primitive2DContainer&& other ) : deque(std::move(other)) {} + Primitive2DContainer( Primitive2DContainer&& other ) noexcept : deque(std::move(other)) {} Primitive2DContainer( const std::deque< Primitive2DReference >& other ) : deque(other) {} Primitive2DContainer( std::initializer_list<Primitive2DReference> init ) : deque(init) {} template <class Iter> @@ -87,7 +87,7 @@ namespace drawinglayer { namespace primitive2d { virtual void append(Primitive2DContainer&& rSource) override; void append(const Primitive2DSequence& rSource); Primitive2DContainer& operator=(const Primitive2DContainer& r) { deque::operator=(r); return *this; } - Primitive2DContainer& operator=(Primitive2DContainer&& r) { deque::operator=(std::move(r)); return *this; } + Primitive2DContainer& operator=(Primitive2DContainer&& r) noexcept { deque::operator=(std::move(r)); return *this; } bool operator==(const Primitive2DContainer& rB) const; bool operator!=(const Primitive2DContainer& rB) const { return !operator==(rB); } basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& aViewInformation) const; diff --git a/include/drawinglayer/primitive3d/baseprimitive3d.hxx b/include/drawinglayer/primitive3d/baseprimitive3d.hxx index 8d4f683ef267..2d2fd1b68963 100644 --- a/include/drawinglayer/primitive3d/baseprimitive3d.hxx +++ b/include/drawinglayer/primitive3d/baseprimitive3d.hxx @@ -60,14 +60,14 @@ namespace drawinglayer { namespace primitive3d { explicit Primitive3DContainer() {} explicit Primitive3DContainer( size_type count ) : deque(count) {} Primitive3DContainer( const Primitive3DContainer& other ) : deque(other) {} - Primitive3DContainer( Primitive3DContainer&& other ) : deque(std::move(other)) {} + Primitive3DContainer( Primitive3DContainer&& other ) noexcept : deque(std::move(other)) {} Primitive3DContainer( std::initializer_list<Primitive3DReference> init ) : deque(init) {} template <class Iter> Primitive3DContainer(Iter first, Iter last) : deque(first, last) {} void append(const Primitive3DContainer& rSource); Primitive3DContainer& operator=(const Primitive3DContainer& r) { deque::operator=(r); return *this; } - Primitive3DContainer& operator=(Primitive3DContainer&& r) { deque::operator=(std::move(r)); return *this; } + Primitive3DContainer& operator=(Primitive3DContainer&& r) noexcept { deque::operator=(std::move(r)); return *this; } bool operator==(const Primitive3DContainer& rB) const; bool operator!=(const Primitive3DContainer& rB) const { return !operator==(rB); } basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& aViewInformation) const; diff --git a/include/editeng/brushitem.hxx b/include/editeng/brushitem.hxx index 8f298bd43408..944b481d7973 100644 --- a/include/editeng/brushitem.hxx +++ b/include/editeng/brushitem.hxx @@ -69,7 +69,7 @@ public: SvxBrushItem( const OUString& rLink, const OUString& rFilter, SvxGraphicPosition ePos, sal_uInt16 nWhich ); SvxBrushItem( const SvxBrushItem& ); - SvxBrushItem( SvxBrushItem&& ); + SvxBrushItem(SvxBrushItem&&) noexcept; virtual ~SvxBrushItem() override; diff --git a/include/o3tl/cow_wrapper.hxx b/include/o3tl/cow_wrapper.hxx index 79a4630f27ec..2fa7f03f276f 100644 --- a/include/o3tl/cow_wrapper.hxx +++ b/include/o3tl/cow_wrapper.hxx @@ -237,7 +237,7 @@ int cow_wrapper_client::queryUnmodified() const /** Move-construct and steal rSrc shared resource */ - explicit cow_wrapper( cow_wrapper&& rSrc ) : + explicit cow_wrapper( cow_wrapper&& rSrc ) noexcept : m_pimpl( rSrc.m_pimpl ) { rSrc.m_pimpl = nullptr; @@ -261,7 +261,7 @@ int cow_wrapper_client::queryUnmodified() const } /// stealing rSrc's resource - cow_wrapper& operator=( cow_wrapper&& rSrc ) + cow_wrapper& operator=(cow_wrapper&& rSrc) noexcept { // self-movement guts ourself, see also 17.6.4.9 release(); diff --git a/include/svl/itemset.hxx b/include/svl/itemset.hxx index 9892855657d1..94ee142a2e77 100644 --- a/include/svl/itemset.hxx +++ b/include/svl/itemset.hxx @@ -112,7 +112,7 @@ public: struct Pair { sal_uInt16 wid1, wid2; }; SfxItemSet( const SfxItemSet& ); - SfxItemSet( SfxItemSet&& ); + SfxItemSet( SfxItemSet&& ) noexcept; SfxItemSet( SfxItemPool&); template<sal_uInt16... WIDs> SfxItemSet( diff --git a/include/svl/sharedstring.hxx b/include/svl/sharedstring.hxx index 5e757f79bcf3..71aad67ba2c6 100644 --- a/include/svl/sharedstring.hxx +++ b/include/svl/sharedstring.hxx @@ -27,11 +27,11 @@ public: SharedString( rtl_uString* pData, rtl_uString* pDataIgnoreCase ); explicit SharedString( const OUString& rStr ); SharedString( const SharedString& r ); - SharedString( SharedString&& r ); + SharedString(SharedString&& r) noexcept; ~SharedString(); SharedString& operator= ( const SharedString& r ); - SharedString& operator= ( SharedString&& r ); + SharedString& operator=(SharedString&& r) noexcept; bool operator== ( const SharedString& r ) const; bool operator!= ( const SharedString& r ) const; diff --git a/include/svl/svdde.hxx b/include/svl/svdde.hxx index f27e2135700f..07b5bcfd9f73 100644 --- a/include/svl/svdde.hxx +++ b/include/svl/svdde.hxx @@ -61,7 +61,7 @@ public: DdeData(SAL_UNUSED_PARAMETER const void*, SAL_UNUSED_PARAMETER long, SAL_UNUSED_PARAMETER SotClipboardFormatId = SotClipboardFormatId::STRING); DdeData(SAL_UNUSED_PARAMETER const OUString&); DdeData(const DdeData&); - DdeData(DdeData&&); + DdeData(DdeData&&) noexcept; ~DdeData(); void const * getData() const; @@ -70,7 +70,7 @@ public: SotClipboardFormatId GetFormat() const; DdeData& operator=(const DdeData&); - DdeData& operator=(DdeData&&); + DdeData& operator=(DdeData&&) noexcept; static sal_uLong GetExternalFormat(SotClipboardFormatId nFmt); static SotClipboardFormatId GetInternalFormat(sal_uLong nFmt); diff --git a/include/svx/dataaccessdescriptor.hxx b/include/svx/dataaccessdescriptor.hxx index 92e992c2ce74..c06e6474f3fe 100644 --- a/include/svx/dataaccessdescriptor.hxx +++ b/include/svx/dataaccessdescriptor.hxx @@ -68,7 +68,7 @@ namespace svx public: ODataAccessDescriptor(); ODataAccessDescriptor( const ODataAccessDescriptor& _rSource ); - ODataAccessDescriptor( ODataAccessDescriptor&& _rSource ); + ODataAccessDescriptor(ODataAccessDescriptor&& _rSource) noexcept; ODataAccessDescriptor( const css::uno::Reference< css::beans::XPropertySet >& _rValues ); ODataAccessDescriptor( const css::uno::Sequence< css::beans::PropertyValue >& _rValues ); @@ -76,7 +76,7 @@ namespace svx ODataAccessDescriptor( const css::uno::Any& _rValues ); ODataAccessDescriptor& operator=(const ODataAccessDescriptor& _rSource); - ODataAccessDescriptor& operator=(ODataAccessDescriptor&& _rSource); + ODataAccessDescriptor& operator=(ODataAccessDescriptor&& _rSource) noexcept; ~ODataAccessDescriptor(); diff --git a/include/svx/sdr/attribute/sdrformtextattribute.hxx b/include/svx/sdr/attribute/sdrformtextattribute.hxx index 6fe6b31164e3..1260509b4234 100644 --- a/include/svx/sdr/attribute/sdrformtextattribute.hxx +++ b/include/svx/sdr/attribute/sdrformtextattribute.hxx @@ -52,9 +52,9 @@ namespace drawinglayer SdrFormTextAttribute(const SfxItemSet& rSet); SdrFormTextAttribute(); SdrFormTextAttribute(const SdrFormTextAttribute& rCandidate); - SdrFormTextAttribute(SdrFormTextAttribute&& rCandidate); + SdrFormTextAttribute(SdrFormTextAttribute&& rCandidate) noexcept; SdrFormTextAttribute& operator=(const SdrFormTextAttribute& rCandidate); - SdrFormTextAttribute& operator=(SdrFormTextAttribute&& rCandidate); + SdrFormTextAttribute& operator=(SdrFormTextAttribute&& rCandidate) noexcept; ~SdrFormTextAttribute(); // checks if the incarnation is default constructed diff --git a/include/svx/sdr/attribute/sdrtextattribute.hxx b/include/svx/sdr/attribute/sdrtextattribute.hxx index 8aaaaf02989c..b81853ac637c 100644 --- a/include/svx/sdr/attribute/sdrtextattribute.hxx +++ b/include/svx/sdr/attribute/sdrtextattribute.hxx @@ -80,9 +80,9 @@ namespace drawinglayer SdrTextAttribute(); SdrTextAttribute(const SdrTextAttribute& rCandidate); - SdrTextAttribute(SdrTextAttribute&& rCandidate); + SdrTextAttribute(SdrTextAttribute&& rCandidate) noexcept; SdrTextAttribute& operator=(const SdrTextAttribute& rCandidate); - SdrTextAttribute& operator=(SdrTextAttribute&& rCandidate); + SdrTextAttribute& operator=(SdrTextAttribute&& rCandidate) noexcept; ~SdrTextAttribute(); // checks if the incarnation is default constructed diff --git a/include/tools/ref.hxx b/include/tools/ref.hxx index 9f76af3238f4..44e0f50c99d0 100644 --- a/include/tools/ref.hxx +++ b/include/tools/ref.hxx @@ -35,7 +35,7 @@ template<typename T> class SAL_DLLPUBLIC_RTTI SvRef final { public: SvRef(): pObj(nullptr) {} - SvRef(SvRef&& rObj) + SvRef(SvRef&& rObj) noexcept { pObj = rObj.pObj; rObj.pObj = nullptr; diff --git a/include/ucbhelper/content.hxx b/include/ucbhelper/content.hxx index 6ec7148f1e51..da312323033f 100644 --- a/include/ucbhelper/content.hxx +++ b/include/ucbhelper/content.hxx @@ -144,7 +144,7 @@ public: /** * Move constructor. */ - Content( Content&& rOther ); + Content(Content&& rOther) noexcept; /** * Destructor. @@ -161,7 +161,7 @@ public: /** * Move assignment operator. */ - Content& operator=( Content&& rOther ); + Content& operator=(Content&& rOther) noexcept; /** * Constructor. This method should be used, if the exception thrown diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx index 59c6c9ac28d6..3d57e5dfe741 100644 --- a/include/vcl/bitmap.hxx +++ b/include/vcl/bitmap.hxx @@ -113,7 +113,7 @@ public: virtual ~Bitmap(); Bitmap& operator=( const Bitmap& rBitmap ); - Bitmap& operator=( Bitmap&& rBitmap ); + Bitmap& operator=( Bitmap&& rBitmap ) noexcept; inline bool operator!() const; bool operator==( const Bitmap& rBitmap ) const; bool operator!=( const Bitmap& rBitmap ) const { return !operator==(rBitmap); } diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx index 4adac78b48c4..f3f0c0aa1ab3 100644 --- a/include/vcl/graph.hxx +++ b/include/vcl/graph.hxx @@ -116,7 +116,7 @@ public: Graphic(); Graphic( const GraphicExternalLink& rGraphicLink ); Graphic( const Graphic& rGraphic ); - Graphic( Graphic&& rGraphic ); + Graphic( Graphic&& rGraphic ) noexcept; Graphic( const Bitmap& rBmp ); Graphic( const BitmapEx& rBmpEx ); Graphic( const VectorGraphicDataPtr& rVectorGraphicDataPtr ); @@ -125,7 +125,7 @@ public: Graphic( const css::uno::Reference< css::graphic::XGraphic >& rxGraphic ); Graphic& operator=( const Graphic& rGraphic ); - Graphic& operator=( Graphic&& rGraphic ); + Graphic& operator=( Graphic&& rGraphic ) noexcept; bool operator==( const Graphic& rGraphic ) const; bool operator!=( const Graphic& rGraphic ) const; diff --git a/include/vcl/transfer.hxx b/include/vcl/transfer.hxx index 722d3f26b42b..3373f3e032a9 100644 --- a/include/vcl/transfer.hxx +++ b/include/vcl/transfer.hxx @@ -284,7 +284,7 @@ public: TransferableDataHelper(); TransferableDataHelper( const TransferableDataHelper& rDataHelper ); - TransferableDataHelper( TransferableDataHelper&& rDataHelper ); + TransferableDataHelper( TransferableDataHelper&& rDataHelper ) noexcept; TransferableDataHelper( const css::uno::Reference< css::datatransfer::XTransferable >& rxTransferable ); ~TransferableDataHelper(); |