Base: modernize C++: use equals default
This commit is contained in:
@@ -26,18 +26,10 @@
|
||||
|
||||
using namespace Base;
|
||||
|
||||
Axis::Axis() = default;
|
||||
|
||||
Axis::Axis(const Axis& that)
|
||||
{
|
||||
this->_base = that._base;
|
||||
this->_dir = that._dir;
|
||||
}
|
||||
|
||||
Axis::Axis(const Vector3d& Orig, const Vector3d& Dir)
|
||||
: _base{Orig}
|
||||
, _dir{Dir}
|
||||
{
|
||||
this->_base = Orig;
|
||||
this->_dir = Dir;
|
||||
}
|
||||
|
||||
void Axis::reverse()
|
||||
@@ -80,11 +72,3 @@ Axis Axis::operator *(const Placement &p) const
|
||||
a *= p;
|
||||
return a;
|
||||
}
|
||||
|
||||
Axis& Axis::operator = (const Axis &New)
|
||||
{
|
||||
this->_base = New._base;
|
||||
this->_dir = New._dir;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,8 +36,9 @@ class BaseExport Axis
|
||||
{
|
||||
public:
|
||||
/// default constructor
|
||||
Axis();
|
||||
Axis(const Axis&);
|
||||
Axis() = default;
|
||||
Axis(const Axis&) = default;
|
||||
Axis(Axis&&) = default;
|
||||
Axis(const Vector3d& Orig, const Vector3d& Dir);
|
||||
/// Destruction
|
||||
~Axis () = default;
|
||||
@@ -57,10 +58,11 @@ public:
|
||||
Axis operator *(const Placement &p) const;
|
||||
bool operator ==(const Axis&) const;
|
||||
bool operator !=(const Axis&) const;
|
||||
Axis& operator =(const Axis&);
|
||||
Axis& operator =(const Axis&) = default;
|
||||
Axis& operator =(Axis&&) = default;
|
||||
//@}
|
||||
|
||||
protected:
|
||||
private:
|
||||
Vector3d _base;
|
||||
Vector3d _dir;
|
||||
};
|
||||
|
||||
@@ -918,9 +918,7 @@ InventorBuilder::InventorBuilder(std::ostream& output)
|
||||
result << "#Inventor V2.1 ascii \n\n";
|
||||
}
|
||||
|
||||
InventorBuilder:: ~InventorBuilder()
|
||||
{
|
||||
}
|
||||
InventorBuilder:: ~InventorBuilder() = default;
|
||||
|
||||
void InventorBuilder::increaseIndent()
|
||||
{
|
||||
|
||||
@@ -45,16 +45,7 @@ Exception::Exception()
|
||||
_sErrMsg = "FreeCAD Exception";
|
||||
}
|
||||
|
||||
Exception::Exception(const Exception &inst)
|
||||
: BaseClass(inst)
|
||||
, _sErrMsg(inst._sErrMsg)
|
||||
, _file(inst._file)
|
||||
, _line(inst._line)
|
||||
, _function(inst._function)
|
||||
, _isTranslatable(inst._isTranslatable)
|
||||
, _isReported(inst._isReported)
|
||||
{
|
||||
}
|
||||
Exception::Exception(const Exception &inst) = default;
|
||||
|
||||
Exception::Exception(const char * sMessage)
|
||||
: _sErrMsg(sMessage)
|
||||
@@ -282,13 +273,6 @@ FileException::FileException()
|
||||
_sErrMsgAndFileName = _sErrMsg;
|
||||
}
|
||||
|
||||
FileException::FileException(const FileException &inst)
|
||||
: Exception(inst._sErrMsg.c_str())
|
||||
, file(inst.file)
|
||||
, _sErrMsgAndFileName(inst._sErrMsgAndFileName.c_str())
|
||||
{
|
||||
}
|
||||
|
||||
void FileException::setFileName(const char * sFileName)
|
||||
{
|
||||
file.setFile(sFileName);
|
||||
|
||||
@@ -245,7 +245,7 @@ public:
|
||||
/// standard construction
|
||||
FileException();
|
||||
/// Construction
|
||||
FileException(const FileException &inst);
|
||||
FileException(const FileException&) = default;
|
||||
/// Destruction
|
||||
~FileException() noexcept override = default;
|
||||
/// Assignment operator
|
||||
|
||||
@@ -36,24 +36,18 @@ Placement::Placement(const Base::Matrix4D& matrix)
|
||||
fromMatrix(matrix);
|
||||
}
|
||||
|
||||
Placement::Placement(const Placement& that)
|
||||
{
|
||||
this->_pos = that._pos;
|
||||
this->_rot = that._rot;
|
||||
}
|
||||
|
||||
Placement::Placement(const Vector3d& Pos, const Rotation &Rot)
|
||||
: _pos(Pos)
|
||||
, _rot(Rot)
|
||||
{
|
||||
this->_pos = Pos;
|
||||
this->_rot = Rot;
|
||||
}
|
||||
|
||||
Placement::Placement(const Vector3d& Pos, const Rotation &Rot, const Vector3d& Cnt)
|
||||
: _rot(Rot)
|
||||
{
|
||||
Vector3d RotC = Cnt;
|
||||
Rot.multVec(RotC, RotC);
|
||||
this->_pos = Pos + Cnt - RotC;
|
||||
this->_rot = Rot;
|
||||
}
|
||||
|
||||
Placement Placement::fromDualQuaternion(DualQuat qq)
|
||||
@@ -161,13 +155,6 @@ Placement Placement::operator*(const Placement & p) const
|
||||
return plm;
|
||||
}
|
||||
|
||||
Placement& Placement::operator = (const Placement& New)
|
||||
{
|
||||
this->_pos = New._pos;
|
||||
this->_rot = New._rot;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Placement Placement::pow(double t, bool shorten) const
|
||||
{
|
||||
return Placement::fromDualQuaternion(this->toDualQuaternion().pow(t, shorten));
|
||||
|
||||
@@ -40,7 +40,8 @@ class BaseExport Placement
|
||||
public:
|
||||
/// default constructor
|
||||
Placement();
|
||||
Placement(const Placement&);
|
||||
Placement(const Placement&) = default;
|
||||
Placement(Placement&&) = default;
|
||||
Placement(const Base::Matrix4D& matrix);
|
||||
Placement(const Vector3d& Pos, const Rotation &Rot);
|
||||
Placement(const Vector3d& Pos, const Rotation &Rot, const Vector3d& Cnt);
|
||||
@@ -76,7 +77,8 @@ public:
|
||||
Placement operator *(const Placement & p) const;
|
||||
bool operator == (const Placement&) const;
|
||||
bool operator != (const Placement&) const;
|
||||
Placement& operator = (const Placement&);
|
||||
Placement& operator = (const Placement&) = default;
|
||||
Placement& operator = (Placement&&) = default;
|
||||
Placement pow(double t, bool shorten = true) const;
|
||||
|
||||
Placement& multRight(const Base::Placement& p);
|
||||
@@ -89,7 +91,7 @@ public:
|
||||
static Placement slerp(const Placement & p0, const Placement & p1, double t);
|
||||
static Placement sclerp(const Placement & p0, const Placement & p1, double t, bool shorten = true);
|
||||
|
||||
protected:
|
||||
private:
|
||||
Vector3<double> _pos;
|
||||
Base::Rotation _rot;
|
||||
};
|
||||
|
||||
@@ -54,10 +54,13 @@ public:
|
||||
inline Vector2d();
|
||||
inline Vector2d(float x, float y);
|
||||
inline Vector2d(double x, double y);
|
||||
inline Vector2d(const Vector2d &v);
|
||||
inline Vector2d(const Vector2d&) = default;
|
||||
inline Vector2d(Vector2d&&) = default;
|
||||
~Vector2d() = default;
|
||||
|
||||
// operators
|
||||
inline Vector2d& operator= (const Vector2d &v);
|
||||
inline Vector2d& operator= (const Vector2d&) = default;
|
||||
inline Vector2d& operator= (Vector2d&&) = default;
|
||||
inline bool operator== (const Vector2d &v) const;
|
||||
inline Vector2d operator+ () const;
|
||||
inline Vector2d operator+ (const Vector2d &v) const;
|
||||
@@ -104,13 +107,16 @@ public:
|
||||
double MinX, MinY, MaxX, MaxY;
|
||||
|
||||
inline BoundBox2d ();
|
||||
inline BoundBox2d (const BoundBox2d &rclBB);
|
||||
inline BoundBox2d (const BoundBox2d&) = default;
|
||||
inline BoundBox2d (BoundBox2d&&) = default;
|
||||
inline BoundBox2d (double fX1, double fY1, double fX2, double fY2);
|
||||
~BoundBox2d() = default;
|
||||
inline bool IsValid ();
|
||||
inline bool IsEqual(const BoundBox2d&, double tolerance) const;
|
||||
|
||||
// operators
|
||||
inline BoundBox2d& operator= (const BoundBox2d& rclBB);
|
||||
inline BoundBox2d& operator= (const BoundBox2d&) = default;
|
||||
inline BoundBox2d& operator= (BoundBox2d&&) = default;
|
||||
inline bool operator== (const BoundBox2d& rclBB) const;
|
||||
|
||||
// methods
|
||||
@@ -139,7 +145,9 @@ public:
|
||||
Vector2d clV1, clV2;
|
||||
|
||||
Line2d () = default;
|
||||
inline Line2d (const Line2d &rclLine);
|
||||
~Line2d () = default;
|
||||
inline Line2d (const Line2d&) = default;
|
||||
inline Line2d (Line2d&&) = default;
|
||||
inline Line2d (const Vector2d &rclV1, const Vector2d &rclV2);
|
||||
|
||||
// methods
|
||||
@@ -147,7 +155,8 @@ public:
|
||||
BoundBox2d CalcBoundBox () const;
|
||||
|
||||
// operators
|
||||
inline Line2d& operator= (const Line2d& rclLine);
|
||||
inline Line2d& operator= (const Line2d&) = default;
|
||||
inline Line2d& operator= (Line2d&&) = default;
|
||||
inline bool operator== (const Line2d& rclLine) const;
|
||||
|
||||
// misc
|
||||
@@ -167,10 +176,12 @@ class BaseExport Polygon2d
|
||||
{
|
||||
public:
|
||||
Polygon2d () = default;
|
||||
inline Polygon2d (const Polygon2d &rclPoly);
|
||||
virtual ~Polygon2d () = default;
|
||||
inline Polygon2d (const Polygon2d&) = default;
|
||||
inline Polygon2d (Polygon2d&&) = default;
|
||||
~Polygon2d () = default;
|
||||
|
||||
inline Polygon2d& operator = (const Polygon2d &rclP);
|
||||
inline Polygon2d& operator = (Polygon2d &&rclP);
|
||||
|
||||
// admin-interface
|
||||
inline size_t GetCtVectors () const;
|
||||
@@ -210,18 +221,6 @@ inline Vector2d::Vector2d(double x, double y)
|
||||
{
|
||||
}
|
||||
|
||||
inline Vector2d::Vector2d(const Vector2d &v)
|
||||
: x(v.x), y(v.y)
|
||||
{
|
||||
}
|
||||
|
||||
inline Vector2d& Vector2d::operator= (const Vector2d &v)
|
||||
{
|
||||
x = v.x;
|
||||
y = v.y;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline bool Vector2d::operator== (const Vector2d &v) const
|
||||
{
|
||||
return (x == v.x) && (y == v.y);
|
||||
@@ -381,16 +380,9 @@ inline bool Vector2d::IsEqual(const Vector2d& v, double tolerance) const
|
||||
|
||||
// ========================================
|
||||
|
||||
inline Polygon2d::Polygon2d (const Polygon2d &rclPoly)
|
||||
{
|
||||
*this = rclPoly;
|
||||
}
|
||||
inline Polygon2d& Polygon2d::operator = (const Polygon2d &rclP) = default;
|
||||
|
||||
inline Polygon2d& Polygon2d::operator = (const Polygon2d &rclP)
|
||||
{
|
||||
_aclVct = rclP._aclVct;
|
||||
return *this;
|
||||
}
|
||||
inline Polygon2d& Polygon2d::operator = (Polygon2d &&rclP) = default;
|
||||
|
||||
inline void Polygon2d::DeleteAll ()
|
||||
{
|
||||
@@ -442,12 +434,6 @@ inline Vector2d& Polygon2d::At (size_t ulNdx)
|
||||
}
|
||||
|
||||
|
||||
inline Line2d::Line2d (const Line2d &rclLine)
|
||||
: clV1 (rclLine.clV1),
|
||||
clV2 (rclLine.clV2)
|
||||
{
|
||||
}
|
||||
|
||||
inline Line2d::Line2d (const Vector2d &rclV1, const Vector2d &rclV2)
|
||||
: clV1 (rclV1), clV2 (rclV2)
|
||||
{
|
||||
@@ -458,13 +444,6 @@ inline double Line2d::Length () const
|
||||
return (clV2 - clV1).Length ();
|
||||
}
|
||||
|
||||
inline Line2d& Line2d::operator= (const Line2d& rclLine)
|
||||
{
|
||||
clV1 = rclLine.clV1;
|
||||
clV2 = rclLine.clV2;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline bool Line2d::operator== (const Line2d& rclLine) const
|
||||
{
|
||||
return (clV1 == rclLine.clV1) && (clV2 == rclLine.clV2);
|
||||
@@ -481,20 +460,12 @@ inline BoundBox2d::BoundBox2d ()
|
||||
MaxX = MaxY = - DOUBLE_MAX;
|
||||
}
|
||||
|
||||
inline BoundBox2d::BoundBox2d (const BoundBox2d &rclBB)
|
||||
: MinX (rclBB.MinX),
|
||||
MinY (rclBB.MinY),
|
||||
MaxX (rclBB.MaxX),
|
||||
MaxY (rclBB.MaxY)
|
||||
{
|
||||
}
|
||||
|
||||
inline BoundBox2d::BoundBox2d (double fX1, double fY1, double fX2, double fY2)
|
||||
: MinX(std::min<double>(fX1, fX2))
|
||||
, MinY(std::min<double>(fY1, fY2))
|
||||
, MaxX(std::max<double>(fX1, fX2))
|
||||
, MaxY(std::max<double>(fY1, fY2))
|
||||
{
|
||||
MinX = std::min<double>(fX1, fX2);
|
||||
MaxX = std::max<double>(fX1, fX2);
|
||||
MinY = std::min<double>(fY1, fY2);
|
||||
MaxY = std::max<double>(fY1, fY2);
|
||||
}
|
||||
|
||||
inline bool BoundBox2d::IsValid ()
|
||||
@@ -508,15 +479,6 @@ inline bool BoundBox2d::IsEqual(const BoundBox2d& b, double tolerance) const
|
||||
Vector2d(MaxX, MaxY).IsEqual(Vector2d(b.MaxX, b.MaxY), tolerance);
|
||||
}
|
||||
|
||||
inline BoundBox2d& BoundBox2d::operator= (const BoundBox2d& rclBB)
|
||||
{
|
||||
MinX = rclBB.MinX;
|
||||
MinY = rclBB.MinY;
|
||||
MaxX = rclBB.MaxX;
|
||||
MaxY = rclBB.MaxY;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline bool BoundBox2d::operator== (const BoundBox2d& rclBB) const
|
||||
{
|
||||
return (MinX == rclBB.MinX) &&
|
||||
|
||||
@@ -34,19 +34,6 @@
|
||||
using namespace Base;
|
||||
|
||||
|
||||
template <typename float_type>
|
||||
Line3<float_type>::Line3(const Line3<float_type>& line)
|
||||
: p1(line.p1)
|
||||
, p2(line.p2)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename float_type>
|
||||
Line3<float_type>::Line3(Line3<float_type>&& line)
|
||||
{
|
||||
*this = std::move(line);
|
||||
}
|
||||
|
||||
template <typename float_type>
|
||||
Line3<float_type>::Line3(const Vector3<float_type>& p1, const Vector3<float_type>& p2)
|
||||
: p1(p1)
|
||||
@@ -54,22 +41,6 @@ Line3<float_type>::Line3(const Vector3<float_type>& p1, const Vector3<float_type
|
||||
{
|
||||
}
|
||||
|
||||
template <typename float_type>
|
||||
Line3<float_type>& Line3<float_type>::operator= (const Line3<float_type>& line)
|
||||
{
|
||||
p1 = line.p1;
|
||||
p2 = line.p2;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename float_type>
|
||||
Line3<float_type>& Line3<float_type>::operator= (Line3<float_type>&& line)
|
||||
{
|
||||
p1 = std::move(line.p1);
|
||||
p2 = std::move(line.p2);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename float_type>
|
||||
bool Line3<float_type>::operator== (const Line3<float_type>& line) const
|
||||
{
|
||||
|
||||
@@ -58,13 +58,13 @@ public:
|
||||
|
||||
Line3() = default;
|
||||
~Line3() = default;
|
||||
Line3(const Line3& line);
|
||||
Line3(Line3&& line);
|
||||
Line3(const Line3& line) = default;
|
||||
Line3(Line3&& line) = default;
|
||||
Line3(const Vector3<float_type>& p1, const Vector3<float_type>& p2);
|
||||
|
||||
// operators
|
||||
Line3& operator= (const Line3& line);
|
||||
Line3& operator= (Line3&& line);
|
||||
Line3& operator= (const Line3& line) = default;
|
||||
Line3& operator= (Line3&& line) = default;
|
||||
bool operator== (const Line3& line) const;
|
||||
|
||||
// methods
|
||||
@@ -111,8 +111,10 @@ public:
|
||||
Polygon3() = default;
|
||||
~Polygon3() = default;
|
||||
Polygon3(const Polygon3<float_type>& poly) = default;
|
||||
Polygon3(Polygon3<float_type>&& poly) = default;
|
||||
|
||||
Polygon3& operator = (const Polygon3<float_type>& poly) = default;
|
||||
Polygon3& operator = (Polygon3<float_type>&& poly) = default;
|
||||
|
||||
size_t GetSize() const;
|
||||
void Add (const Vector3<float_type>& p);
|
||||
|
||||
@@ -55,31 +55,6 @@ map<string,unsigned int> Type::typemap;
|
||||
vector<TypeData*> Type::typedata;
|
||||
set<string> Type::loadModuleSet;
|
||||
|
||||
//**************************************************************************
|
||||
// Construction/Destruction
|
||||
|
||||
/**
|
||||
* A constructor.
|
||||
* A more elaborate description of the constructor.
|
||||
*/
|
||||
Type::Type()
|
||||
: index(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Type::Type(const Type& type)
|
||||
:index(type.index)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A destructor.
|
||||
* A more elaborate description of the destructor.
|
||||
*/
|
||||
Type::~Type() = default;
|
||||
|
||||
void *Type::createInstance()
|
||||
{
|
||||
instantiationMethod method = typedata[index]->instMethod;
|
||||
|
||||
@@ -81,10 +81,11 @@ class BaseExport Type
|
||||
{
|
||||
public:
|
||||
/// Construction
|
||||
Type(const Type& type);
|
||||
Type();
|
||||
Type(const Type& type) = default;
|
||||
Type(Type&& type) = default;
|
||||
Type() = default;
|
||||
/// Destruction
|
||||
virtual ~Type();
|
||||
~Type() = default;
|
||||
|
||||
/// creates a instance of this type
|
||||
void *createInstance();
|
||||
@@ -111,7 +112,8 @@ public:
|
||||
unsigned int getKey() const;
|
||||
bool isBad() const;
|
||||
|
||||
void operator = (const Type type);
|
||||
Type& operator = (const Type& type) = default;
|
||||
Type& operator = (Type&& type) = default;
|
||||
bool operator == (const Type type) const;
|
||||
bool operator != (const Type type) const;
|
||||
|
||||
@@ -129,14 +131,10 @@ protected:
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
unsigned int index;
|
||||
|
||||
unsigned int index{0};
|
||||
|
||||
static std::map<std::string,unsigned int> typemap;
|
||||
static std::vector<TypeData*> typedata;
|
||||
|
||||
static std::set<std::string> loadModuleSet;
|
||||
|
||||
};
|
||||
@@ -154,12 +152,6 @@ Type::operator != (const Type type) const
|
||||
return (this->getKey() != type.getKey());
|
||||
}
|
||||
|
||||
inline void
|
||||
Type::operator = (const Type type)
|
||||
{
|
||||
this->index = type.getKey();
|
||||
}
|
||||
|
||||
inline bool
|
||||
Type::operator == (const Type type) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user