MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / apply_predicate_number_const

Method apply_predicate_number_const

lib/pugixml/src/pugixml.cpp:9770–9796  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9768 }
9769
9770 static void apply_predicate_number_const(xpath_node_set_raw& ns, size_t first, xpath_ast_node* expr, const xpath_stack& stack)
9771 {
9772 assert(ns.size() >= first);
9773 assert(expr->rettype() == xpath_type_number);
9774
9775 size_t size = ns.size() - first;
9776
9777 xpath_node* last = ns.begin() + first;
9778
9779 xpath_context c(xpath_node(), 1, size);
9780
9781 double er = expr->eval_number(c, stack);
9782
9783 if (er >= 1.0 && er <= static_cast<double>(size))
9784 {
9785 size_t eri = static_cast<size_t>(er);
9786
9787 if (er == static_cast<double>(eri))
9788 {
9789 xpath_node r = last[eri - 1];
9790
9791 *last++ = r;
9792 }
9793 }
9794
9795 ns.truncate(last);
9796 }
9797
9798 void apply_predicate(xpath_node_set_raw& ns, size_t first, const xpath_stack& stack, bool once)
9799 {

Callers

nothing calls this directly

Calls 6

xpath_nodeClass · 0.85
rettypeMethod · 0.80
eval_numberMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45
truncateMethod · 0.45

Tested by

no test coverage detected