| 10257 | } |
| 10258 | |
| 10259 | static void apply_predicate_boolean(xpath_node_set_raw& ns, size_t first, xpath_ast_node* expr, const xpath_stack& stack, bool once) |
| 10260 | { |
| 10261 | assert(ns.size() >= first); |
| 10262 | assert(expr->rettype() != xpath_type_number); |
| 10263 | |
| 10264 | size_t i = 1; |
| 10265 | size_t size = ns.size() - first; |
| 10266 | |
| 10267 | xpath_node* last = ns.begin() + first; |
| 10268 | |
| 10269 | // remove_if... or well, sort of |
| 10270 | for (xpath_node* it = last; it != ns.end(); ++it, ++i) |
| 10271 | { |
| 10272 | xpath_context c(*it, i, size); |
| 10273 | |
| 10274 | if (expr->eval_boolean(c, stack)) |
| 10275 | { |
| 10276 | *last++ = *it; |
| 10277 | |
| 10278 | if (once) break; |
| 10279 | } |
| 10280 | } |
| 10281 | |
| 10282 | ns.truncate(last); |
| 10283 | } |
| 10284 | |
| 10285 | static void apply_predicate_number(xpath_node_set_raw& ns, size_t first, xpath_ast_node* expr, const xpath_stack& stack, bool once) |
| 10286 | { |