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

Method find_item

src/laybasic/laybasic/layAbstractMenu.cc:1858–2000  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1856}
1857
1858std::vector<std::pair<AbstractMenuItem *, std::list<AbstractMenuItem>::iterator> >
1859AbstractMenu::find_item (tl::Extractor &extr)
1860{
1861 typedef std::vector<std::pair<AbstractMenuItem *, std::list<AbstractMenuItem>::iterator> > path_type;
1862 path_type path;
1863
1864 AbstractMenuItem *parent = &m_root;
1865 std::list<AbstractMenuItem>::iterator iter = m_root.children.end ();
1866
1867 while (parent && ! extr.at_end ()) {
1868
1869 if (extr.test (";")) {
1870
1871 break;
1872
1873 } else if (extr.test ("#")) {
1874
1875 unsigned int n = 0;
1876 extr.try_read (n);
1877 iter = parent->children.begin ();
1878 ++n;
1879 while (--n > 0 && iter != parent->children.end ()) {
1880 ++iter;
1881 }
1882 if (n > 0) {
1883 return path_type ();
1884 }
1885
1886 } else {
1887
1888 std::string n;
1889 extr.read (n, ".;+>(");
1890
1891 if (n.empty ()) {
1892
1893 // skip (avoids infinite loops on wrong paths)
1894 while (! extr.at_end () && *extr != ';') {
1895 ++extr;
1896 }
1897
1898 } else if (n == "begin") {
1899
1900 iter = parent->children.begin ();
1901
1902 } else if (n == "end") {
1903
1904 iter = parent->children.end ();
1905
1906 } else {
1907
1908 std::string nn;
1909 if (extr.test (">")) {
1910 extr.read (nn, ".;+>(");
1911 }
1912
1913 std::string name (parent->name ());
1914 if (! name.empty ()) {
1915 name += ".";

Callers

nothing calls this directly

Calls 15

read_word_or_quotedMethod · 0.80
setup_itemMethod · 0.80
set_has_submenuMethod · 0.80
set_remove_on_emptyMethod · 0.80
set_action_titleMethod · 0.80
endMethod · 0.45
at_endMethod · 0.45
testMethod · 0.45
try_readMethod · 0.45
beginMethod · 0.45
readMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected