MCPcopy Create free account
hub / github.com/Aloshi/EmulationStation / step_do

Method step_do

src/pugiXML/pugixml.cpp:7930–7976  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7928 }
7929
7930 template <class T> xpath_node_set_raw step_do(const xpath_context& c, const xpath_stack& stack, T v)
7931 {
7932 const axis_t axis = T::axis;
7933 bool attributes = (axis == axis_ancestor || axis == axis_ancestor_or_self || axis == axis_descendant_or_self || axis == axis_following || axis == axis_parent || axis == axis_preceding || axis == axis_self);
7934
7935 xpath_node_set_raw ns;
7936 ns.set_type((axis == axis_ancestor || axis == axis_ancestor_or_self || axis == axis_preceding || axis == axis_preceding_sibling) ? xpath_node_set::type_sorted_reverse : xpath_node_set::type_sorted);
7937
7938 if (_left)
7939 {
7940 xpath_node_set_raw s = _left->eval_node_set(c, stack);
7941
7942 // self axis preserves the original order
7943 if (axis == axis_self) ns.set_type(s.type());
7944
7945 for (const xpath_node* it = s.begin(); it != s.end(); ++it)
7946 {
7947 size_t size = ns.size();
7948
7949 // in general, all axes generate elements in a particular order, but there is no order guarantee if axis is applied to two nodes
7950 if (axis != axis_self && size != 0) ns.set_type(xpath_node_set::type_unsorted);
7951
7952 if (it->node())
7953 step_fill(ns, it->node(), stack.result, v);
7954 else if (attributes)
7955 step_fill(ns, it->attribute(), it->parent(), stack.result, v);
7956
7957 apply_predicates(ns, size, stack);
7958 }
7959 }
7960 else
7961 {
7962 if (c.n.node())
7963 step_fill(ns, c.n.node(), stack.result, v);
7964 else if (attributes)
7965 step_fill(ns, c.n.attribute(), c.n.parent(), stack.result, v);
7966
7967 apply_predicates(ns, 0, stack);
7968 }
7969
7970 // child, attribute and self axes always generate unique set of nodes
7971 // for other axis, if the set stayed sorted, it stayed unique because the traversal algorithms do not visit the same node twice
7972 if (axis != axis_child && axis != axis_attribute && axis != axis_self && ns.type() == xpath_node_set::type_unsorted)
7973 ns.remove_duplicates();
7974
7975 return ns;
7976 }
7977
7978 public:
7979 xpath_ast_node(ast_type_t type, xpath_value_type rettype_, const char_t* value):

Callers

nothing calls this directly

Calls 10

set_typeMethod · 0.80
eval_node_setMethod · 0.80
nodeMethod · 0.80
attributeMethod · 0.80
parentMethod · 0.80
remove_duplicatesMethod · 0.80
typeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected