diff --git a/eeschema/sch_item.h b/eeschema/sch_item.h index 3cd2edbb93..f9906e7d01 100644 --- a/eeschema/sch_item.h +++ b/eeschema/sch_item.h @@ -2,7 +2,7 @@ * 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-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 * modify it under the terms of the GNU General Public License @@ -68,13 +68,13 @@ class DANGLING_END_ITEM { private: /// A pointer to the connectable object. - EDA_ITEM* m_item; + EDA_ITEM* m_item; /// The position of the connection point. - wxPoint m_pos; + wxPoint m_pos; /// The type of connection of #m_item. - DANGLING_END_T m_type; + DANGLING_END_T m_type; /// A pointer to the parent object (in the case of pins) const EDA_ITEM* m_parent; @@ -97,6 +97,28 @@ public: 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; } EDA_ITEM* GetItem() const { return m_item; } const EDA_ITEM* GetParent() const { return m_parent; } diff --git a/qa/eeschema/test_sch_sheet.cpp b/qa/eeschema/test_sch_sheet.cpp index 36fa54f9a1..9eebb3415f 100644 --- a/qa/eeschema/test_sch_sheet.cpp +++ b/qa/eeschema/test_sch_sheet.cpp @@ -1,7 +1,7 @@ /* * 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 * 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; } -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 */ @@ -240,4 +227,4 @@ BOOST_AUTO_TEST_CASE( EndconnectionPoints ) } -BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file +BOOST_AUTO_TEST_SUITE_END()