MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / eval_number

Method eval_number

lib/pugixml/src/pugixml.cpp:10459–10595  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10457 }
10458
10459 double eval_number(const xpath_context& c, const xpath_stack& stack)
10460 {
10461 switch (_type)
10462 {
10463 case ast_op_add:
10464 return _left->eval_number(c, stack) + _right->eval_number(c, stack);
10465
10466 case ast_op_subtract:
10467 return _left->eval_number(c, stack) - _right->eval_number(c, stack);
10468
10469 case ast_op_multiply:
10470 return _left->eval_number(c, stack) * _right->eval_number(c, stack);
10471
10472 case ast_op_divide:
10473 return _left->eval_number(c, stack) / _right->eval_number(c, stack);
10474
10475 case ast_op_mod:
10476 return fmod(_left->eval_number(c, stack), _right->eval_number(c, stack));
10477
10478 case ast_op_negate:
10479 return -_left->eval_number(c, stack);
10480
10481 case ast_number_constant:
10482 return _data.number;
10483
10484 case ast_func_last:
10485 return static_cast<double>(c.size);
10486
10487 case ast_func_position:
10488 return static_cast<double>(c.position);
10489
10490 case ast_func_count:
10491 {
10492 xpath_allocator_capture cr(stack.result);
10493
10494 return static_cast<double>(_left->eval_node_set(c, stack, nodeset_eval_all).size());
10495 }
10496
10497 case ast_func_string_length_0:
10498 {
10499 xpath_allocator_capture cr(stack.result);
10500
10501 return static_cast<double>(string_value(c.n, stack.result).length());
10502 }
10503
10504 case ast_func_string_length_1:
10505 {
10506 xpath_allocator_capture cr(stack.result);
10507
10508 return static_cast<double>(_left->eval_string(c, stack).length());
10509 }
10510
10511 case ast_func_number_0:
10512 {
10513 xpath_allocator_capture cr(stack.result);
10514
10515 return convert_string_to_number(string_value(c.n, stack.result).c_str());
10516 }

Callers 6

compare_eqMethod · 0.80
compare_relMethod · 0.80
eval_stringMethod · 0.80
evaluate_numberMethod · 0.80

Calls 13

fmodFunction · 0.85
convert_string_to_numberFunction · 0.85
floorFunction · 0.85
round_nearest_nzeroFunction · 0.85
eval_node_setMethod · 0.80
eval_stringMethod · 0.80
get_numberMethod · 0.80
sizeMethod · 0.45
lengthMethod · 0.45
c_strMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected