MCPcopy Create free account
hub / github.com/axmolengine/axmol / eval_number

Method eval_number

3rdparty/pugixml/pugixml.cpp:10666–10802  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10664 }
10665
10666 double eval_number(const xpath_context& c, const xpath_stack& stack)
10667 {
10668 switch (_type)
10669 {
10670 case ast_op_add:
10671 return _left->eval_number(c, stack) + _right->eval_number(c, stack);
10672
10673 case ast_op_subtract:
10674 return _left->eval_number(c, stack) - _right->eval_number(c, stack);
10675
10676 case ast_op_multiply:
10677 return _left->eval_number(c, stack) * _right->eval_number(c, stack);
10678
10679 case ast_op_divide:
10680 return _left->eval_number(c, stack) / _right->eval_number(c, stack);
10681
10682 case ast_op_mod:
10683 return fmod(_left->eval_number(c, stack), _right->eval_number(c, stack));
10684
10685 case ast_op_negate:
10686 return -_left->eval_number(c, stack);
10687
10688 case ast_number_constant:
10689 return _data.number;
10690
10691 case ast_func_last:
10692 return static_cast<double>(c.size);
10693
10694 case ast_func_position:
10695 return static_cast<double>(c.position);
10696
10697 case ast_func_count:
10698 {
10699 xpath_allocator_capture cr(stack.result);
10700
10701 return static_cast<double>(_left->eval_node_set(c, stack, nodeset_eval_all).size());
10702 }
10703
10704 case ast_func_string_length_0:
10705 {
10706 xpath_allocator_capture cr(stack.result);
10707
10708 return static_cast<double>(string_value(c.n, stack.result).length());
10709 }
10710
10711 case ast_func_string_length_1:
10712 {
10713 xpath_allocator_capture cr(stack.result);
10714
10715 return static_cast<double>(_left->eval_string(c, stack).length());
10716 }
10717
10718 case ast_func_number_0:
10719 {
10720 xpath_allocator_capture cr(stack.result);
10721
10722 return convert_string_to_number(string_value(c.n, stack.result).c_str());
10723 }

Callers 6

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

Calls 12

string_valueClass · 0.85
convert_string_to_numberFunction · 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
typeMethod · 0.45

Tested by

no test coverage detected