MCPcopy Create free account
hub / github.com/KLayout/klayout / delete_item

Method delete_item

src/laybasic/laybasic/layAbstractMenu.cc:1717–1741  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1715}
1716
1717void
1718AbstractMenu::delete_item (const std::string &p)
1719{
1720 typedef std::vector<std::pair<AbstractMenuItem *, std::list<AbstractMenuItem>::iterator > > path_type;
1721 tl::Extractor extr (p.c_str ());
1722 path_type path = find_item (extr);
1723 if (! path.empty ()) {
1724
1725 for (path_type::const_reverse_iterator p = path.rbegin (); p != path.rend (); ++p) {
1726
1727 if (p->second == p->first->children.end ()) {
1728 break;
1729 } else if (p != path.rbegin () && (! p->second->remove_on_empty () || ! p->second->children.empty ())) {
1730 // stop on non-empty parent menus
1731 break;
1732 }
1733
1734 p->first->children.erase (p->second);
1735
1736 }
1737
1738 }
1739
1740 emit_changed ();
1741}
1742
1743static void do_delete_items (AbstractMenuItem &parent, Action *action)
1744{

Callers 6

test_1Method · 0.80
test_5Method · 0.80
update_menuMethod · 0.80
update_menuMethod · 0.80
do_update_menuMethod · 0.80

Calls 6

rbeginMethod · 0.80
rendMethod · 0.80
c_strMethod · 0.45
emptyMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45

Tested by 2

test_1Method · 0.64
test_5Method · 0.64