MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / compare_eq

Method compare_eq

Source/ThirdParty/pugixml/pugixml.cpp:8470–8556  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8468 xpath_ast_node& operator=(const xpath_ast_node&);
8469
8470 template <class Comp> static bool compare_eq(xpath_ast_node* lhs, xpath_ast_node* rhs, const xpath_context& c, const xpath_stack& stack, const Comp& comp)
8471 {
8472 xpath_value_type lt = lhs->rettype(), rt = rhs->rettype();
8473
8474 if (lt != xpath_type_node_set && rt != xpath_type_node_set)
8475 {
8476 if (lt == xpath_type_boolean || rt == xpath_type_boolean)
8477 return comp(lhs->eval_boolean(c, stack), rhs->eval_boolean(c, stack));
8478 else if (lt == xpath_type_number || rt == xpath_type_number)
8479 return comp(lhs->eval_number(c, stack), rhs->eval_number(c, stack));
8480 else if (lt == xpath_type_string || rt == xpath_type_string)
8481 {
8482 xpath_allocator_capture cr(stack.result);
8483
8484 xpath_string ls = lhs->eval_string(c, stack);
8485 xpath_string rs = rhs->eval_string(c, stack);
8486
8487 return comp(ls, rs);
8488 }
8489 }
8490 else if (lt == xpath_type_node_set && rt == xpath_type_node_set)
8491 {
8492 xpath_allocator_capture cr(stack.result);
8493
8494 xpath_node_set_raw ls = lhs->eval_node_set(c, stack, nodeset_eval_all);
8495 xpath_node_set_raw rs = rhs->eval_node_set(c, stack, nodeset_eval_all);
8496
8497 for (const xpath_node* li = ls.begin(); li != ls.end(); ++li)
8498 for (const xpath_node* ri = rs.begin(); ri != rs.end(); ++ri)
8499 {
8500 xpath_allocator_capture cri(stack.result);
8501
8502 if (comp(string_value(*li, stack.result), string_value(*ri, stack.result)))
8503 return true;
8504 }
8505
8506 return false;
8507 }
8508 else
8509 {
8510 if (lt == xpath_type_node_set)
8511 {
8512 swap(lhs, rhs);
8513 swap(lt, rt);
8514 }
8515
8516 if (lt == xpath_type_boolean)
8517 return comp(lhs->eval_boolean(c, stack), rhs->eval_boolean(c, stack));
8518 else if (lt == xpath_type_number)
8519 {
8520 xpath_allocator_capture cr(stack.result);
8521
8522 double l = lhs->eval_number(c, stack);
8523 xpath_node_set_raw rs = rhs->eval_node_set(c, stack, nodeset_eval_all);
8524
8525 for (const xpath_node* ri = rs.begin(); ri != rs.end(); ++ri)
8526 {
8527 xpath_allocator_capture cri(stack.result);

Callers

nothing calls this directly

Calls 11

string_valueClass · 0.85
convert_string_to_numberFunction · 0.85
rettypeMethod · 0.80
eval_booleanMethod · 0.80
eval_numberMethod · 0.80
eval_stringMethod · 0.80
eval_node_setMethod · 0.80
swapFunction · 0.70
beginMethod · 0.45
endMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected