Check for self-assignment, by comparing the pointers.
--HG-- branch : develop
This commit is contained in:
parent
c0c407f8a8
commit
13d369f560
|
@ -55,6 +55,10 @@ VContainer::VContainer()
|
||||||
*/
|
*/
|
||||||
VContainer &VContainer::operator =(const VContainer &data)
|
VContainer &VContainer::operator =(const VContainer &data)
|
||||||
{
|
{
|
||||||
|
if ( &data == this )
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
setData(data);
|
setData(data);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,10 @@ VIncrement::VIncrement(const VIncrement &incr)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VIncrement &VIncrement::operator=(const VIncrement &incr)
|
VIncrement &VIncrement::operator=(const VIncrement &incr)
|
||||||
{
|
{
|
||||||
|
if ( &incr == this )
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
VVariable::operator=(incr);
|
VVariable::operator=(incr);
|
||||||
this->id = incr.getId();
|
this->id = incr.getId();
|
||||||
return *this;
|
return *this;
|
||||||
|
|
|
@ -74,6 +74,10 @@ VMeasurement::VMeasurement(const VMeasurement &m)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VMeasurement &VMeasurement::operator=(const VMeasurement &m)
|
VMeasurement &VMeasurement::operator=(const VMeasurement &m)
|
||||||
{
|
{
|
||||||
|
if ( &m == this )
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
VVariable::operator=(m);
|
VVariable::operator=(m);
|
||||||
this->gui_text = m.GetGuiText();
|
this->gui_text = m.GetGuiText();
|
||||||
this->_tagName = m.TagName();
|
this->_tagName = m.TagName();
|
||||||
|
|
|
@ -57,6 +57,10 @@ VVariable::VVariable(const VVariable &var)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VVariable &VVariable::operator=(const VVariable &var)
|
VVariable &VVariable::operator=(const VVariable &var)
|
||||||
{
|
{
|
||||||
|
if ( &var == this )
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
this->base = var.GetBase();
|
this->base = var.GetBase();
|
||||||
this->ksize = var.GetKsize();
|
this->ksize = var.GetKsize();
|
||||||
this->kheight = var.GetKheight();
|
this->kheight = var.GetKheight();
|
||||||
|
|
|
@ -43,6 +43,10 @@ VAbstractCurve::VAbstractCurve(const VAbstractCurve &curve)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VAbstractCurve &VAbstractCurve::operator=(const VAbstractCurve &curve)
|
VAbstractCurve &VAbstractCurve::operator=(const VAbstractCurve &curve)
|
||||||
{
|
{
|
||||||
|
if ( &curve == this )
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
VGObject::operator=(curve);
|
VGObject::operator=(curve);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,10 @@ VArc::VArc(const VArc &arc)
|
||||||
*/
|
*/
|
||||||
VArc &VArc::operator =(const VArc &arc)
|
VArc &VArc::operator =(const VArc &arc)
|
||||||
{
|
{
|
||||||
|
if ( &arc == this )
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
VAbstractCurve::operator=(arc);
|
VAbstractCurve::operator=(arc);
|
||||||
this->f1 = arc.GetF1();
|
this->f1 = arc.GetF1();
|
||||||
this->formulaF1 = arc.GetFormulaF1();
|
this->formulaF1 = arc.GetFormulaF1();
|
||||||
|
|
|
@ -53,6 +53,10 @@ VDetail::VDetail(const VDetail &detail)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VDetail &VDetail::operator =(const VDetail &detail)
|
VDetail &VDetail::operator =(const VDetail &detail)
|
||||||
{
|
{
|
||||||
|
if ( &detail == this )
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
_id = detail.id();
|
_id = detail.id();
|
||||||
nodes = detail.getNodes();
|
nodes = detail.getNodes();
|
||||||
name = detail.getName();
|
name = detail.getName();
|
||||||
|
|
|
@ -64,6 +64,10 @@ VGObject::VGObject(const VGObject &obj)
|
||||||
*/
|
*/
|
||||||
VGObject &VGObject::operator=(const VGObject &obj)
|
VGObject &VGObject::operator=(const VGObject &obj)
|
||||||
{
|
{
|
||||||
|
if ( &obj == this )
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
this->_id = obj.id();
|
this->_id = obj.id();
|
||||||
this->type = obj.getType();
|
this->type = obj.getType();
|
||||||
this->idObject = obj.getIdObject();
|
this->idObject = obj.getIdObject();
|
||||||
|
|
|
@ -46,6 +46,10 @@ VNodeDetail::VNodeDetail(const VNodeDetail &node)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VNodeDetail &VNodeDetail::operator =(const VNodeDetail &node)
|
VNodeDetail &VNodeDetail::operator =(const VNodeDetail &node)
|
||||||
{
|
{
|
||||||
|
if ( &node == this )
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
id = node.getId();
|
id = node.getId();
|
||||||
typeTool = node.getTypeTool();
|
typeTool = node.getTypeTool();
|
||||||
typeNode = node.getTypeNode();
|
typeNode = node.getTypeNode();
|
||||||
|
|
|
@ -84,6 +84,10 @@ VPointF::VPointF(const QPointF &point) :VGObject(VPointF()), _mx(0), _my(0), _x(
|
||||||
*/
|
*/
|
||||||
VPointF &VPointF::operator =(const VPointF &point)
|
VPointF &VPointF::operator =(const VPointF &point)
|
||||||
{
|
{
|
||||||
|
if ( &point == this )
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
VGObject::operator=(point);
|
VGObject::operator=(point);
|
||||||
_mx = point.mx();
|
_mx = point.mx();
|
||||||
_my = point.my();
|
_my = point.my();
|
||||||
|
|
|
@ -688,6 +688,10 @@ QVector<QPointF> VSpline::SplinePoints(const QPointF &p1, const QPointF &p4, qre
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VSpline &VSpline::operator =(const VSpline &spline)
|
VSpline &VSpline::operator =(const VSpline &spline)
|
||||||
{
|
{
|
||||||
|
if ( &spline == this )
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
VAbstractCurve::operator=(spline);
|
VAbstractCurve::operator=(spline);
|
||||||
this->p1 = spline.GetP1 ();
|
this->p1 = spline.GetP1 ();
|
||||||
this->p2 = spline.GetP2 ();
|
this->p2 = spline.GetP2 ();
|
||||||
|
|
|
@ -158,6 +158,10 @@ VSplinePoint VSplinePath::GetSplinePoint(qint32 indexSpline, SplinePointPosition
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VSplinePath &VSplinePath::operator =(const VSplinePath &path)
|
VSplinePath &VSplinePath::operator =(const VSplinePath &path)
|
||||||
{
|
{
|
||||||
|
if ( &path == this )
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
VAbstractCurve::operator=(path);
|
VAbstractCurve::operator=(path);
|
||||||
this->path = path.GetSplinePath();
|
this->path = path.GetSplinePath();
|
||||||
this->kCurve = path.getKCurve();
|
this->kCurve = path.getKCurve();
|
||||||
|
|
|
@ -69,6 +69,10 @@ VSplinePoint::VSplinePoint(const VSplinePoint &point)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VSplinePoint &VSplinePoint::operator=(const VSplinePoint &point)
|
VSplinePoint &VSplinePoint::operator=(const VSplinePoint &point)
|
||||||
{
|
{
|
||||||
|
if ( &point == this )
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
this->pSpline = point.P();
|
this->pSpline = point.P();
|
||||||
this->angle1 = point.Angle1();
|
this->angle1 = point.Angle1();
|
||||||
this->angle2 = point.Angle2();
|
this->angle2 = point.Angle2();
|
||||||
|
|
|
@ -48,6 +48,10 @@ VDataTool::VDataTool(VContainer *data, QObject *parent)
|
||||||
*/
|
*/
|
||||||
VDataTool &VDataTool::operator =(const VDataTool &tool)
|
VDataTool &VDataTool::operator =(const VDataTool &tool)
|
||||||
{
|
{
|
||||||
|
if ( &tool == this )
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
data = tool.getData();
|
data = tool.getData();
|
||||||
_referens = tool.referens();
|
_referens = tool.referens();
|
||||||
return *this;
|
return *this;
|
||||||
|
|
|
@ -53,8 +53,11 @@ VTranslation::VTranslation(const QString &context, const QString &sourceText, co
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VTranslation &VTranslation::operator=(const VTranslation &tr)
|
VTranslation &VTranslation::operator=(const VTranslation &tr)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
if ( &tr == this )
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
this->mcontext = tr.getMcontext();
|
this->mcontext = tr.getMcontext();
|
||||||
this->msourceText = tr.getMsourceText();
|
this->msourceText = tr.getMsourceText();
|
||||||
this->mdisambiguation = tr.getMdisambiguation();
|
this->mdisambiguation = tr.getMdisambiguation();
|
||||||
|
|
|
@ -98,6 +98,10 @@ public:
|
||||||
*/
|
*/
|
||||||
QmuParserToken& operator= ( const QmuParserToken &a_Tok )
|
QmuParserToken& operator= ( const QmuParserToken &a_Tok )
|
||||||
{
|
{
|
||||||
|
if ( &a_Tok == this )
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
Assign ( a_Tok );
|
Assign ( a_Tok );
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user