MCPcopy Create free account
hub / github.com/WheretIB/nullc / eval_boolean

Method eval_boolean

external/pugixml/pugixml.cpp:7403–7530  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7401 }
7402
7403 bool eval_boolean(const xpath_context& c, const xpath_stack& stack)
7404 {
7405 switch (_type)
7406 {
7407 case ast_op_or:
7408 return _left->eval_boolean(c, stack) || _right->eval_boolean(c, stack);
7409
7410 case ast_op_and:
7411 return _left->eval_boolean(c, stack) && _right->eval_boolean(c, stack);
7412
7413 case ast_op_equal:
7414 return compare_eq(_left, _right, c, stack, equal_to());
7415
7416 case ast_op_not_equal:
7417 return compare_eq(_left, _right, c, stack, not_equal_to());
7418
7419 case ast_op_less:
7420 return compare_rel(_left, _right, c, stack, less());
7421
7422 case ast_op_greater:
7423 return compare_rel(_right, _left, c, stack, less());
7424
7425 case ast_op_less_or_equal:
7426 return compare_rel(_left, _right, c, stack, less_equal());
7427
7428 case ast_op_greater_or_equal:
7429 return compare_rel(_right, _left, c, stack, less_equal());
7430
7431 case ast_func_starts_with:
7432 {
7433 xpath_allocator_capture cr(stack.result);
7434
7435 xpath_string lr = _left->eval_string(c, stack);
7436 xpath_string rr = _right->eval_string(c, stack);
7437
7438 return starts_with(lr.c_str(), rr.c_str());
7439 }
7440
7441 case ast_func_contains:
7442 {
7443 xpath_allocator_capture cr(stack.result);
7444
7445 xpath_string lr = _left->eval_string(c, stack);
7446 xpath_string rr = _right->eval_string(c, stack);
7447
7448 return find_substring(lr.c_str(), rr.c_str()) != 0;
7449 }
7450
7451 case ast_func_boolean:
7452 return _left->eval_boolean(c, stack);
7453
7454 case ast_func_not:
7455 return !_left->eval_boolean(c, stack);
7456
7457 case ast_func_true:
7458 return true;
7459
7460 case ast_func_false:

Callers 3

compare_eqMethod · 0.80
apply_predicateMethod · 0.80
evaluate_booleanMethod · 0.80

Calls 15

equal_toClass · 0.85
not_equal_toClass · 0.85
lessClass · 0.85
less_equalClass · 0.85
starts_withFunction · 0.85
find_substringFunction · 0.85
tolower_asciiFunction · 0.85
assertFunction · 0.85
eval_stringMethod · 0.80
c_strMethod · 0.80
attributeMethod · 0.80

Tested by

no test coverage detected