31 std::set<const EDA_GROUP*> visitedGroups;
32 std::vector<const EDA_GROUP*> pendingGroups;
34 pendingGroups.push_back(
this );
36 while( !pendingGroups.empty() )
39 pendingGroups.pop_back();
41 if( !visitedGroups.insert(
group ).second )
50 pendingGroups.push_back( childGroup );
60 wxCHECK_RET( aItem, wxT(
"Nullptr added to group." ) );
61 wxCHECK_RET( aItem !=
AsEdaItem(), wxT(
"Group added to itself." ) );
65 wxCHECK_RET( !
group->ContainsItem(
AsEdaItem() ), wxT(
"Ancestor group added to group." ) );
70 parentGroup->RemoveItem( aItem );
79 wxCHECK_RET( aItem, wxT(
"Nullptr removed from group." ) );
81 if(
m_items.erase( aItem ) == 1 )
89 item->SetParentGroup(
nullptr );
97 std::vector<KIID> members;
100 members.push_back( item->m_Uuid );
A set of EDA_ITEMs (i.e., without duplicates).
std::unordered_set< EDA_ITEM * > m_items
void RemoveItem(EDA_ITEM *aItem)
Remove item from group.
void AddItem(EDA_ITEM *aItem)
Add item to group.
bool ContainsItem(const EDA_ITEM *aItem) const
Test if an item is a direct or nested member of this group.
std::vector< KIID > GetGroupMemberIds() const
virtual EDA_ITEM * AsEdaItem()=0
A base class for most all the KiCad significant classes used in schematics and boards.
virtual EDA_GROUP * GetParentGroup() const
virtual void SetParentGroup(EDA_GROUP *aGroup)