| 9716 | } |
| 9717 | |
| 9718 | static void apply_predicate_boolean(xpath_node_set_raw& ns, size_t first, xpath_ast_node* expr, const xpath_stack& stack, bool once) |
| 9719 | { |
| 9720 | assert(ns.size() >= first); |
| 9721 | assert(expr->rettype() != xpath_type_number); |
| 9722 | |
| 9723 | size_t i = 1; |
| 9724 | size_t size = ns.size() - first; |
| 9725 | |
| 9726 | xpath_node* last = ns.begin() + first; |
| 9727 | |
| 9728 | // remove_if... or well, sort of |
| 9729 | for (xpath_node* it = last; it != ns.end(); ++it, ++i) |
| 9730 | { |
| 9731 | xpath_context c(*it, i, size); |
| 9732 | |
| 9733 | if (expr->eval_boolean(c, stack)) |
| 9734 | { |
| 9735 | *last++ = *it; |
| 9736 | |
| 9737 | if (once) break; |
| 9738 | } |
| 9739 | } |
| 9740 | |
| 9741 | ns.truncate(last); |
| 9742 | } |
| 9743 | |
| 9744 | static void apply_predicate_number(xpath_node_set_raw& ns, size_t first, xpath_ast_node* expr, const xpath_stack& stack, bool once) |
| 9745 | { |