1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-21 10:13:43 +03:00

0032957: Add Standard_Noexcept definition

into Standard_Macro.hxx and
employ Standard_Noexcept.
This commit is contained in:
ddzama 2022-08-17 11:11:26 +03:00
parent fd5c113a03
commit 1a1739b200
8 changed files with 36 additions and 13 deletions

View File

@ -18,6 +18,7 @@
#include <Standard_OutOfMemory.hxx> #include <Standard_OutOfMemory.hxx>
#include <Standard_OutOfRange.hxx> #include <Standard_OutOfRange.hxx>
#include <Standard_TypeMismatch.hxx> #include <Standard_TypeMismatch.hxx>
#include <Standard_Macro.hxx>
//! Defines an array of values of configurable size. //! Defines an array of values of configurable size.
//! For instance, this class allows defining an array of 32-bit or 64-bit integer values with bitness determined in runtime. //! For instance, this class allows defining an array of 32-bit or 64-bit integer values with bitness determined in runtime.
@ -63,7 +64,7 @@ public:
} }
//! Move constructor //! Move constructor
NCollection_AliasedArray (NCollection_AliasedArray&& theOther) noexcept NCollection_AliasedArray (NCollection_AliasedArray&& theOther) Standard_Noexcept
: myData (theOther.myData), myStride (theOther.myStride), mySize (theOther.mySize), myDeletable (theOther.myDeletable) : myData (theOther.myData), myStride (theOther.myStride), mySize (theOther.mySize), myDeletable (theOther.myDeletable)
{ {
theOther.myDeletable = false; theOther.myDeletable = false;

View File

@ -17,6 +17,7 @@
#include <NCollection_AliasedArray.hxx> #include <NCollection_AliasedArray.hxx>
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
#include <gp_Vec3f.hxx> #include <gp_Vec3f.hxx>
#include <Standard_Macro.hxx>
//! Defines an array of 3D nodes of single/double precision configurable at construction time. //! Defines an array of 3D nodes of single/double precision configurable at construction time.
class Poly_ArrayOfNodes : public NCollection_AliasedArray<> class Poly_ArrayOfNodes : public NCollection_AliasedArray<>
@ -85,14 +86,14 @@ public:
Poly_ArrayOfNodes& operator= (const Poly_ArrayOfNodes& theOther) { return Assign (theOther); } Poly_ArrayOfNodes& operator= (const Poly_ArrayOfNodes& theOther) { return Assign (theOther); }
//! Move constructor //! Move constructor
Poly_ArrayOfNodes (Poly_ArrayOfNodes&& theOther) noexcept Poly_ArrayOfNodes (Poly_ArrayOfNodes&& theOther) Standard_Noexcept
: NCollection_AliasedArray (std::move (theOther)) : NCollection_AliasedArray (std::move (theOther))
{ {
// //
} }
//! Move assignment operator; @sa Move() //! Move assignment operator; @sa Move()
Poly_ArrayOfNodes& operator= (Poly_ArrayOfNodes&& theOther) noexcept Poly_ArrayOfNodes& operator= (Poly_ArrayOfNodes&& theOther) Standard_Noexcept
{ {
return Move (theOther); return Move (theOther);
} }

View File

@ -17,6 +17,7 @@
#include <NCollection_AliasedArray.hxx> #include <NCollection_AliasedArray.hxx>
#include <gp_Pnt2d.hxx> #include <gp_Pnt2d.hxx>
#include <gp_Vec2f.hxx> #include <gp_Vec2f.hxx>
#include <Standard_Macro.hxx>
//! Defines an array of 2D nodes of single/double precision configurable at construction time. //! Defines an array of 2D nodes of single/double precision configurable at construction time.
class Poly_ArrayOfUVNodes : public NCollection_AliasedArray<> class Poly_ArrayOfUVNodes : public NCollection_AliasedArray<>
@ -85,14 +86,14 @@ public:
Poly_ArrayOfUVNodes& operator= (const Poly_ArrayOfUVNodes& theOther) { return Assign (theOther); } Poly_ArrayOfUVNodes& operator= (const Poly_ArrayOfUVNodes& theOther) { return Assign (theOther); }
//! Move constructor //! Move constructor
Poly_ArrayOfUVNodes (Poly_ArrayOfUVNodes&& theOther) noexcept Poly_ArrayOfUVNodes (Poly_ArrayOfUVNodes&& theOther) Standard_Noexcept
: NCollection_AliasedArray (std::move (theOther)) : NCollection_AliasedArray (std::move (theOther))
{ {
// //
} }
//! Move assignment operator; @sa Move() //! Move assignment operator; @sa Move()
Poly_ArrayOfUVNodes& operator= (Poly_ArrayOfUVNodes&& theOther) noexcept Poly_ArrayOfUVNodes& operator= (Poly_ArrayOfUVNodes&& theOther) Standard_Noexcept
{ {
return Move (theOther); return Move (theOther);
} }

View File

@ -18,6 +18,7 @@
#include <Standard_Std.hxx> #include <Standard_Std.hxx>
#include <Standard_Stream.hxx> #include <Standard_Stream.hxx>
#include <Standard_Transient.hxx> #include <Standard_Transient.hxx>
#include <Standard_Macro.hxx>
class Standard_Transient; class Standard_Transient;
@ -71,7 +72,7 @@ namespace opencascade {
} }
//! Move constructor //! Move constructor
handle (handle&& theHandle) noexcept : entity(theHandle.entity) handle (handle&& theHandle) Standard_Noexcept : entity(theHandle.entity)
{ {
theHandle.entity = 0; theHandle.entity = 0;
} }
@ -112,7 +113,7 @@ namespace opencascade {
} }
//! Move operator //! Move operator
handle& operator= (handle&& theHandle) noexcept handle& operator= (handle&& theHandle) Standard_Noexcept
{ {
std::swap (this->entity, theHandle.entity); std::swap (this->entity, theHandle.entity);
return *this; return *this;

View File

@ -315,5 +315,21 @@
#define Standard_ATOMIC(theType) theType #define Standard_ATOMIC(theType) theType
#endif #endif
//! @def Standard_Noexcept
//! Definition of Standard_Noexcept:
//! if noexcept is accessible, Standard_Noexcept is "noexcept" and "throw()" otherwise.
#ifdef _MSC_VER
#if _MSC_VER >= 1900
#define Standard_Noexcept noexcept
#else
#define Standard_Noexcept throw()
#endif
#else
#if __cplusplus >= 201103L
#define Standard_Noexcept noexcept
#else
#define Standard_Noexcept throw()
#endif
#endif
#endif #endif

View File

@ -26,6 +26,7 @@
#include <Standard_Real.hxx> #include <Standard_Real.hxx>
#include <Standard_OStream.hxx> #include <Standard_OStream.hxx>
#include <Standard_IStream.hxx> #include <Standard_IStream.hxx>
#include <Standard_Macro.hxx>
class TCollection_ExtendedString; class TCollection_ExtendedString;
//! Class defines a variable-length sequence of 8-bit characters. //! Class defines a variable-length sequence of 8-bit characters.
@ -74,7 +75,7 @@ public:
Standard_EXPORT TCollection_AsciiString(const TCollection_AsciiString& astring); Standard_EXPORT TCollection_AsciiString(const TCollection_AsciiString& astring);
//! Move constructor //! Move constructor
TCollection_AsciiString (TCollection_AsciiString&& theOther) noexcept TCollection_AsciiString (TCollection_AsciiString&& theOther) Standard_Noexcept
: mystring (theOther.mystring), : mystring (theOther.mystring),
mylength (theOther.mylength) mylength (theOther.mylength)
{ {
@ -276,7 +277,7 @@ void operator = (const TCollection_AsciiString& fromwhere)
Standard_EXPORT void Swap (TCollection_AsciiString& theOther); Standard_EXPORT void Swap (TCollection_AsciiString& theOther);
//! Move assignment operator //! Move assignment operator
TCollection_AsciiString& operator= (TCollection_AsciiString&& theOther) noexcept { Swap (theOther); return *this; } TCollection_AsciiString& operator= (TCollection_AsciiString&& theOther) Standard_Noexcept { Swap (theOther); return *this; }
//! Frees memory allocated by AsciiString. //! Frees memory allocated by AsciiString.
Standard_EXPORT ~TCollection_AsciiString(); Standard_EXPORT ~TCollection_AsciiString();

View File

@ -31,6 +31,7 @@
#include <Standard_Real.hxx> #include <Standard_Real.hxx>
#include <Standard_OStream.hxx> #include <Standard_OStream.hxx>
#include <Standard_PCharacter.hxx> #include <Standard_PCharacter.hxx>
#include <Standard_Macro.hxx>
class TCollection_AsciiString; class TCollection_AsciiString;
@ -98,7 +99,7 @@ public:
Standard_EXPORT TCollection_ExtendedString(const TCollection_ExtendedString& astring); Standard_EXPORT TCollection_ExtendedString(const TCollection_ExtendedString& astring);
//! Move constructor //! Move constructor
TCollection_ExtendedString (TCollection_ExtendedString&& theOther) noexcept TCollection_ExtendedString (TCollection_ExtendedString&& theOther) Standard_Noexcept
: mystring (theOther.mystring), : mystring (theOther.mystring),
mylength (theOther.mylength) mylength (theOther.mylength)
{ {
@ -153,7 +154,7 @@ void operator = (const TCollection_ExtendedString& fromwhere)
Standard_EXPORT void Swap (TCollection_ExtendedString& theOther); Standard_EXPORT void Swap (TCollection_ExtendedString& theOther);
//! Move assignment operator //! Move assignment operator
TCollection_ExtendedString& operator= (TCollection_ExtendedString&& theOther) noexcept { Swap (theOther); return *this; } TCollection_ExtendedString& operator= (TCollection_ExtendedString&& theOther) Standard_Noexcept { Swap (theOther); return *this; }
//! Frees memory allocated by ExtendedString. //! Frees memory allocated by ExtendedString.
Standard_EXPORT ~TCollection_ExtendedString(); Standard_EXPORT ~TCollection_ExtendedString();

View File

@ -21,6 +21,7 @@
#include <Standard_DefineAlloc.hxx> #include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <Standard_Macro.hxx>
class TopLoc_SListNodeOfItemLocation; class TopLoc_SListNodeOfItemLocation;
class TopLoc_ItemLocation; class TopLoc_ItemLocation;
@ -69,13 +70,13 @@ public:
} }
//! Move constructor //! Move constructor
TopLoc_SListOfItemLocation (TopLoc_SListOfItemLocation&& theOther) noexcept TopLoc_SListOfItemLocation (TopLoc_SListOfItemLocation&& theOther) Standard_Noexcept
: myNode(std::move (theOther.myNode)) : myNode(std::move (theOther.myNode))
{ {
} }
//! Move operator //! Move operator
TopLoc_SListOfItemLocation& operator= (TopLoc_SListOfItemLocation&& theOther) noexcept TopLoc_SListOfItemLocation& operator= (TopLoc_SListOfItemLocation&& theOther) Standard_Noexcept
{ {
myNode = std::move (theOther.myNode); myNode = std::move (theOther.myNode);
return *this; return *this;