| 6948 | } |
| 6949 | |
| 6950 | void apply_predicate(xpath_node_set_raw& ns, size_t first, xpath_ast_node* expr, const xpath_stack& stack) |
| 6951 | { |
| 6952 | assert(ns.size() >= first); |
| 6953 | |
| 6954 | size_t i = 1; |
| 6955 | size_t size = ns.size() - first; |
| 6956 | |
| 6957 | xpath_node* last = ns.begin() + first; |
| 6958 | |
| 6959 | // remove_if... or well, sort of |
| 6960 | for (xpath_node* it = last; it != ns.end(); ++it, ++i) |
| 6961 | { |
| 6962 | xpath_context c(*it, i, size); |
| 6963 | |
| 6964 | if (expr->rettype() == xpath_type_number) |
| 6965 | { |
| 6966 | if (expr->eval_number(c, stack) == i) |
| 6967 | *last++ = *it; |
| 6968 | } |
| 6969 | else if (expr->eval_boolean(c, stack)) |
| 6970 | *last++ = *it; |
| 6971 | } |
| 6972 | |
| 6973 | ns.truncate(last); |
| 6974 | } |
| 6975 | |
| 6976 | void apply_predicates(xpath_node_set_raw& ns, size_t first, const xpath_stack& stack) |
| 6977 | { |
nothing calls this directly
no test coverage detected