eeschema: Move comparison for DANGLING_ENDS
The comparison functions belong inside the class if we are using them to test the validity of the class.
This commit is contained in:
parent
b18b08e944
commit
3fb085a0b4
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||||
* Copyright (C) 2004-2019 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 2004-2020 KiCad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -97,6 +97,28 @@ public:
|
||||||
m_parent = aParent;
|
m_parent = aParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool operator==( const DANGLING_END_ITEM& aB )
|
||||||
|
{
|
||||||
|
return GetItem() == aB.GetItem()
|
||||||
|
&& GetPosition() == aB.GetPosition()
|
||||||
|
&& GetType() == aB.GetType()
|
||||||
|
&& GetParent() == aB.GetParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator!=( const DANGLING_END_ITEM& aB )
|
||||||
|
{
|
||||||
|
return GetItem() != aB.GetItem()
|
||||||
|
|| GetPosition() != aB.GetPosition()
|
||||||
|
|| GetType() != aB.GetType()
|
||||||
|
|| GetParent() != aB.GetParent();;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator<( const DANGLING_END_ITEM& rhs ) const
|
||||||
|
{
|
||||||
|
return( m_pos.x < rhs.m_pos.x || ( m_pos.x == rhs.m_pos.x && m_pos.y < rhs.m_pos.y )
|
||||||
|
|| ( m_pos == rhs.m_pos && m_item < rhs.m_item ) );
|
||||||
|
}
|
||||||
|
|
||||||
wxPoint GetPosition() const { return m_pos; }
|
wxPoint GetPosition() const { return m_pos; }
|
||||||
EDA_ITEM* GetItem() const { return m_item; }
|
EDA_ITEM* GetItem() const { return m_item; }
|
||||||
const EDA_ITEM* GetParent() const { return m_parent; }
|
const EDA_ITEM* GetParent() const { return m_parent; }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019 KiCad Developers, see CHANGELOG.TXT for contributors.
|
* Copyright (C) 2019-2020 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -60,19 +60,6 @@ std::ostream& operator<<( std::ostream& os, DANGLING_END_ITEM const& d )
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==( const DANGLING_END_ITEM& aA, const DANGLING_END_ITEM& aB )
|
|
||||||
{
|
|
||||||
return aA.GetItem() == aB.GetItem()
|
|
||||||
&& aA.GetPosition() == aB.GetPosition()
|
|
||||||
&& aA.GetType() == aB.GetType()
|
|
||||||
&& aA.GetParent() == aB.GetParent();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator!=( const DANGLING_END_ITEM& aA, const DANGLING_END_ITEM& aB )
|
|
||||||
{
|
|
||||||
return !( aA == aB );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Declare the test suite
|
* Declare the test suite
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue