| 8321 | } |
| 8322 | |
| 8323 | void apply_predicate(xpath_node_set_raw& ns, size_t first, xpath_ast_node* expr, const xpath_stack& stack) |
| 8324 | { |
| 8325 | assert(ns.size() >= first); |
| 8326 | |
| 8327 | size_t i = 1; |
| 8328 | size_t size = ns.size() - first; |
| 8329 | |
| 8330 | xpath_node* last = ns.begin() + first; |
| 8331 | |
| 8332 | // remove_if... or well, sort of |
| 8333 | for (xpath_node* it = last; it != ns.end(); ++it, ++i) |
| 8334 | { |
| 8335 | xpath_context c(*it, i, size); |
| 8336 | |
| 8337 | if (expr->rettype() == xpath_type_number) |
| 8338 | { |
| 8339 | if (expr->eval_number(c, stack) == i) |
| 8340 | *last++ = *it; |
| 8341 | } |
| 8342 | else if (expr->eval_boolean(c, stack)) |
| 8343 | *last++ = *it; |
| 8344 | } |
| 8345 | |
| 8346 | ns.truncate(last); |
| 8347 | } |
| 8348 | |
| 8349 | void apply_predicates(xpath_node_set_raw& ns, size_t first, const xpath_stack& stack) |
| 8350 | { |
nothing calls this directly
no test coverage detected