MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / eval_node_set

Method eval_node_set

Source/ThirdParty/pugixml/pugixml.cpp:9791–9917  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9789 }
9790
9791 xpath_node_set_raw eval_node_set(const xpath_context& c, const xpath_stack& stack, nodeset_eval_t eval)
9792 {
9793 switch (_type)
9794 {
9795 case ast_op_union:
9796 {
9797 xpath_allocator_capture cr(stack.temp);
9798
9799 xpath_stack swapped_stack = {stack.temp, stack.result};
9800
9801 xpath_node_set_raw ls = _left->eval_node_set(c, swapped_stack, eval);
9802 xpath_node_set_raw rs = _right->eval_node_set(c, stack, eval);
9803
9804 // we can optimize merging two sorted sets, but this is a very rare operation, so don't bother
9805 rs.set_type(xpath_node_set::type_unsorted);
9806
9807 rs.append(ls.begin(), ls.end(), stack.result);
9808 rs.remove_duplicates();
9809
9810 return rs;
9811 }
9812
9813 case ast_filter:
9814 {
9815 xpath_node_set_raw set = _left->eval_node_set(c, stack, _test == predicate_constant_one ? nodeset_eval_first : nodeset_eval_all);
9816
9817 // either expression is a number or it contains position() call; sort by document order
9818 if (_test != predicate_posinv) set.sort_do();
9819
9820 bool once = eval_once(set.type(), eval);
9821
9822 apply_predicate(set, 0, stack, once);
9823
9824 return set;
9825 }
9826
9827 case ast_func_id:
9828 return xpath_node_set_raw();
9829
9830 case ast_step:
9831 {
9832 switch (_axis)
9833 {
9834 case axis_ancestor:
9835 return step_do(c, stack, eval, axis_to_type<axis_ancestor>());
9836
9837 case axis_ancestor_or_self:
9838 return step_do(c, stack, eval, axis_to_type<axis_ancestor_or_self>());
9839
9840 case axis_attribute:
9841 return step_do(c, stack, eval, axis_to_type<axis_attribute>());
9842
9843 case axis_child:
9844 return step_do(c, stack, eval, axis_to_type<axis_child>());
9845
9846 case axis_descendant:
9847 return step_do(c, stack, eval, axis_to_type<axis_descendant>());
9848

Callers 7

compare_eqMethod · 0.80
compare_relMethod · 0.80
step_doMethod · 0.80
eval_numberMethod · 0.80
eval_stringMethod · 0.80
evaluate_node_setMethod · 0.80
evaluate_nodeMethod · 0.80

Calls 13

xpath_node_set_rawClass · 0.85
set_typeMethod · 0.80
remove_duplicatesMethod · 0.80
sort_doMethod · 0.80
nodeMethod · 0.80
rootMethod · 0.80
attributeMethod · 0.80
parentMethod · 0.80
appendMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected