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

Method eval_boolean

lib/pugixml/src/pugixml.cpp:10319–10457  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10317 }
10318
10319 bool eval_boolean(const xpath_context& c, const xpath_stack& stack)
10320 {
10321 switch (_type)
10322 {
10323 case ast_op_or:
10324 return _left->eval_boolean(c, stack) || _right->eval_boolean(c, stack);
10325
10326 case ast_op_and:
10327 return _left->eval_boolean(c, stack) && _right->eval_boolean(c, stack);
10328
10329 case ast_op_equal:
10330 return compare_eq(_left, _right, c, stack, equal_to());
10331
10332 case ast_op_not_equal:
10333 return compare_eq(_left, _right, c, stack, not_equal_to());
10334
10335 case ast_op_less:
10336 return compare_rel(_left, _right, c, stack, less());
10337
10338 case ast_op_greater:
10339 return compare_rel(_right, _left, c, stack, less());
10340
10341 case ast_op_less_or_equal:
10342 return compare_rel(_left, _right, c, stack, less_equal());
10343
10344 case ast_op_greater_or_equal:
10345 return compare_rel(_right, _left, c, stack, less_equal());
10346
10347 case ast_func_starts_with:
10348 {
10349 xpath_allocator_capture cr(stack.result);
10350
10351 xpath_string lr = _left->eval_string(c, stack);
10352 xpath_string rr = _right->eval_string(c, stack);
10353
10354 return starts_with(lr.c_str(), rr.c_str());
10355 }
10356
10357 case ast_func_contains:
10358 {
10359 xpath_allocator_capture cr(stack.result);
10360
10361 xpath_string lr = _left->eval_string(c, stack);
10362 xpath_string rr = _right->eval_string(c, stack);
10363
10364 return find_substring(lr.c_str(), rr.c_str()) != 0;
10365 }
10366
10367 case ast_func_boolean:
10368 return _left->eval_boolean(c, stack);
10369
10370 case ast_func_not:
10371 return !_left->eval_boolean(c, stack);
10372
10373 case ast_func_true:
10374 return true;
10375
10376 case ast_func_false:

Callers 3

compare_eqMethod · 0.80
evaluate_booleanMethod · 0.80

Calls 15

not_equal_toClass · 0.85
lessClass · 0.85
less_equalClass · 0.85
starts_withFunction · 0.85
find_substringFunction · 0.85
tolower_asciiFunction · 0.85
strequalFunction · 0.85
is_xpath_attributeFunction · 0.85
eval_stringMethod · 0.80
attributeMethod · 0.80
nodeMethod · 0.80

Tested by

no test coverage detected