MCPcopy Create free account
hub / github.com/MyGUI/mygui / find_node

Function find_node

Tools/EditorFramework/pugixml.hpp:506–528  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

504
505 // Find node from subtree using predicate. Returns first node from subtree (depth-first), for which predicate returned true.
506 template <typename Predicate> xml_node find_node(Predicate pred) const
507 {
508 if (!_root)
509 return {};
510
511 xml_node cur = first_child();
512
513 while (cur._root && cur._root != _root)
514 {
515 if (pred(cur)) return cur;
516
517 if (cur.first_child()) cur = cur.first_child();
518 else if (cur.next_sibling()) cur = cur.next_sibling();
519 else
520 {
521 while (!cur.next_sibling() && cur._root != _root) cur = cur.parent();
522
523 if (cur._root != _root) cur = cur.next_sibling();
524 }
525 }
526
527 return {};
528 }
529
530 // Find child node by attribute name/value
531 xml_node find_child_by_attribute(const char_t* name, const char_t* attr_name, const char_t* attr_value) const;

Callers

nothing calls this directly

Calls 3

first_childMethod · 0.45
next_siblingMethod · 0.45
parentMethod · 0.45

Tested by

no test coverage detected