| 8245 | |
| 8246 | template<class Comp> |
| 8247 | static bool compare_rel( |
| 8248 | xpath_ast_node* lhs, |
| 8249 | xpath_ast_node* rhs, |
| 8250 | const xpath_context& c, |
| 8251 | const xpath_stack& stack, |
| 8252 | const Comp& comp) |
| 8253 | { |
| 8254 | xpath_value_type lt = lhs->rettype(), rt = rhs->rettype(); |
| 8255 | |
| 8256 | if (lt != xpath_type_node_set && rt != xpath_type_node_set) |
| 8257 | return comp(lhs->eval_number(c, stack), rhs->eval_number(c, stack)); |
| 8258 | else if (lt == xpath_type_node_set && rt == xpath_type_node_set) |
| 8259 | { |
| 8260 | xpath_allocator_capture cr(stack.result); |
| 8261 | |
| 8262 | xpath_node_set_raw ls = lhs->eval_node_set(c, stack); |
| 8263 | xpath_node_set_raw rs = rhs->eval_node_set(c, stack); |
| 8264 | |
| 8265 | for (const xpath_node* li = ls.begin(); li != ls.end(); ++li) |
| 8266 | { |
| 8267 | xpath_allocator_capture cri(stack.result); |
| 8268 | |
| 8269 | double l = convert_string_to_number(string_value(*li, stack.result).c_str()); |
| 8270 | |
| 8271 | for (const xpath_node* ri = rs.begin(); ri != rs.end(); ++ri) |
| 8272 | { |
| 8273 | xpath_allocator_capture crii(stack.result); |
| 8274 | |
| 8275 | if (comp(l, convert_string_to_number(string_value(*ri, stack.result).c_str()))) |
| 8276 | return true; |
| 8277 | } |
| 8278 | } |
| 8279 | |
| 8280 | return false; |
| 8281 | } |
| 8282 | else if (lt != xpath_type_node_set && rt == xpath_type_node_set) |
| 8283 | { |
| 8284 | xpath_allocator_capture cr(stack.result); |
| 8285 | |
| 8286 | double l = lhs->eval_number(c, stack); |
| 8287 | xpath_node_set_raw rs = rhs->eval_node_set(c, stack); |
| 8288 | |
| 8289 | for (const xpath_node* ri = rs.begin(); ri != rs.end(); ++ri) |
| 8290 | { |
| 8291 | xpath_allocator_capture cri(stack.result); |
| 8292 | |
| 8293 | if (comp(l, convert_string_to_number(string_value(*ri, stack.result).c_str()))) |
| 8294 | return true; |
| 8295 | } |
| 8296 | |
| 8297 | return false; |
| 8298 | } |
| 8299 | else if (lt == xpath_type_node_set && rt != xpath_type_node_set) |
| 8300 | { |
| 8301 | xpath_allocator_capture cr(stack.result); |
| 8302 | |
| 8303 | xpath_node_set_raw ls = lhs->eval_node_set(c, stack); |
| 8304 | double r = rhs->eval_number(c, stack); |
nothing calls this directly
no test coverage detected