Added generalized move constructor and assignment operator to initialize TopoDS_Shape by object of this or derived type.
Added move constructor and assignment operator for TopLoc_SListOfItemLocation.
Macro OCCT_NO_RVALUE_REFERENCE is used in Standard_Handle.hxx instead of direct check of compiler version.
BeginScope();
}
-#if(defined(_MSC_VER) && (_MSC_VER < 1600))
-#else
+#ifndef OCCT_NO_RVALUE_REFERENCE
//! Move constructor
handle (handle&& theHandle) : entity(theHandle.entity)
{
return *this;
}
-#if(defined(_MSC_VER) && (_MSC_VER < 1600))
-#else
+#ifndef OCCT_NO_RVALUE_REFERENCE
//! Move operator
handle& operator= (handle&& theHandle)
{
BeginScope();
}
-#if(defined(_MSC_VER) && (_MSC_VER < 1600))
-#else
+#ifndef OCCT_NO_RVALUE_REFERENCE
//! Generalized move constructor
template <class T2>
handle (handle<T2>&& theHandle, typename std::enable_if <is_base_but_not_same <T, T2>::value>::type* = nullptr)
return *this;
}
-#if(defined(_MSC_VER) && (_MSC_VER < 1600))
-#else
+#ifndef OCCT_NO_RVALUE_REFERENCE
//! Generalized move operator
template <class T2>
handle& operator= (handle<T2>&& theHandle)
TopLoc_SListNodeOfItemLocation.lxx
TopLoc_SListOfItemLocation.cxx
TopLoc_SListOfItemLocation.hxx
-TopLoc_SListOfItemLocation.lxx
DEFINE_STANDARD_ALLOC
-
//! Creates an empty List.
- TopLoc_SListOfItemLocation();
+ TopLoc_SListOfItemLocation() {}
//! Creates a List with <anItem> as value and <aTail> as tail.
Standard_EXPORT TopLoc_SListOfItemLocation(const TopLoc_ItemLocation& anItem, const TopLoc_SListOfItemLocation& aTail);
//! Creates a list from an other one. The lists are shared.
- TopLoc_SListOfItemLocation(const TopLoc_SListOfItemLocation& Other);
+ TopLoc_SListOfItemLocation(const TopLoc_SListOfItemLocation& Other)
+ : myNode(Other.myNode)
+ {
+ }
//! Sets a list from an other one. The lists are
//! shared. The list itself is returned.
Standard_EXPORT TopLoc_SListOfItemLocation& Assign (const TopLoc_SListOfItemLocation& Other);
-TopLoc_SListOfItemLocation& operator = (const TopLoc_SListOfItemLocation& Other)
-{
- return Assign(Other);
-}
+
+ //! Assignment
+ TopLoc_SListOfItemLocation& operator = (const TopLoc_SListOfItemLocation& Other)
+ {
+ return Assign(Other);
+ }
- Standard_Boolean IsEmpty() const;
+#ifndef OCCT_NO_RVALUE_REFERENCE
+
+ //! Move constructor
+ TopLoc_SListOfItemLocation (TopLoc_SListOfItemLocation&& theOther)
+ : myNode(std::move (theOther.myNode))
+ {
+ }
+
+ //! Move operator
+ TopLoc_SListOfItemLocation& operator= (TopLoc_SListOfItemLocation&& theOther)
+ {
+ myNode = std::move (theOther.myNode);
+ return *this;
+ }
+
+#endif
+
+ //! Returne true if this list is empty
+ Standard_Boolean IsEmpty() const
+ {
+ return myNode.IsNull();
+ }
//! Sets the list to be empty.
- void Clear();
-~TopLoc_SListOfItemLocation()
-{
- Clear();
-}
+ void Clear()
+ {
+ myNode.Nullify();
+ }
+
+ //! Destructor
+ ~TopLoc_SListOfItemLocation()
+ {
+ Clear();
+ }
//! Returns the current value of the list. An error is
//! raised if the list is empty.
//! Replaces the list by a list with <anItem> as Value
//! and the list <me> as tail.
- void Construct (const TopLoc_ItemLocation& anItem);
+ void Construct(const TopLoc_ItemLocation& anItem)
+ {
+ Assign(TopLoc_SListOfItemLocation(anItem, *this));
+ }
//! Replaces the list <me> by its tail.
- void ToTail();
+ void ToTail()
+ {
+ Assign(Tail());
+ }
//! Returns True if the iterator has a current value.
//! This is !IsEmpty()
- Standard_Boolean More() const;
+ Standard_Boolean More() const
+ {
+ return !IsEmpty();
+ }
//! Moves the iterator to the next object in the list.
//! If the iterator is empty it will stay empty. This is ToTail()
- void Next();
-
-
-
-
-protected:
-
-
-
-
+ void Next()
+ {
+ ToTail();
+ }
private:
-
-
-
Handle(TopLoc_SListNodeOfItemLocation) myNode;
-
-
};
-
-#include <TopLoc_SListOfItemLocation.lxx>
-
-
-
-
-
#endif // _TopLoc_SListOfItemLocation_HeaderFile
+++ /dev/null
-// Created on: 1993-02-26
-// Created by: Remi LEQUETTE
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-//=======================================================================
-//function : TopLoc_SListOfItemLocation
-//purpose :
-//=======================================================================
-
-inline TopLoc_SListOfItemLocation::TopLoc_SListOfItemLocation()
-{}
-
-//=======================================================================
-//function : TopLoc_SListOfItemLocation
-//purpose :
-//=======================================================================
-
-inline TopLoc_SListOfItemLocation::TopLoc_SListOfItemLocation(const TopLoc_SListOfItemLocation& Other) :
- myNode(Other.myNode)
-{
-}
-
-//=======================================================================
-//function : IsEmpty
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TopLoc_SListOfItemLocation::IsEmpty() const
-{
- return myNode.IsNull();
-}
-
-//=======================================================================
-//function : Clear
-//purpose :
-//=======================================================================
-
-inline void TopLoc_SListOfItemLocation::Clear()
-{
- if (!myNode.IsNull()) {
- myNode.Nullify();
- }
-}
-
-//=======================================================================
-//function : Construct
-//purpose :
-//=======================================================================
-
-inline void TopLoc_SListOfItemLocation::Construct(const TopLoc_ItemLocation& anItem)
-{
- Assign(TopLoc_SListOfItemLocation(anItem,*this));
-}
-
-//=======================================================================
-//function : ToTail
-//purpose :
-//=======================================================================
-
-inline void TopLoc_SListOfItemLocation::ToTail()
-{
- Assign(Tail());
-}
-
-//=======================================================================
-//function : More
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TopLoc_SListOfItemLocation::More() const
-{
- return !IsEmpty();
-}
-
-//=======================================================================
-//function : Next
-//purpose :
-//=======================================================================
-
-inline void TopLoc_SListOfItemLocation::Next()
-{
- ToTail();
-}
//! Creates a NULL Shape referring to nothing.
TopoDS_Shape() : myOrient (TopAbs_EXTERNAL) {}
+#ifndef OCCT_NO_RVALUE_REFERENCE
+
+ //! Generalized move constructor, accepting also sub-classes
+ //! (TopoDS_Shape hierarchy declares only fake sub-classes with no extra fields).
+ template<class T2>
+ TopoDS_Shape (T2&& theOther, typename std::enable_if<opencascade::std::is_base_of<TopoDS_Shape, T2>::value>::type* = 0)
+ : myTShape (std::forward<T2> (theOther).myTShape),
+ myLocation(std::forward<T2> (theOther).myLocation),
+ myOrient (std::forward<T2> (theOther).myOrient)
+ {
+ }
+
+ //! Generalized move assignment operator.
+ template<class T2>
+ typename std::enable_if<opencascade::std::is_base_of<TopoDS_Shape, T2>::value, TopoDS_Shape>::type&
+ operator= (T2&& theOther)
+ {
+ myTShape = std::forward<T2> (theOther).myTShape;
+ myLocation = std::forward<T2> (theOther).myLocation;
+ myOrient = std::forward<T2> (theOther).myOrient;
+ return *this;
+ }
+
+#endif
+
//! Returns true if this shape is null. In other words, it
//! references no underlying shape with the potential to
//! be given a location and an orientation.