MCPcopy Create free account
hub / github.com/MyGUI/mygui / eval_boolean

Method eval_boolean

Tools/EditorFramework/pugixml.cpp:8831–8945  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8829 }
8830
8831 bool eval_boolean(const xpath_context& c, const xpath_stack& stack)
8832 {
8833 switch (_type)
8834 {
8835 case ast_op_or: return _left->eval_boolean(c, stack) || _right->eval_boolean(c, stack);
8836
8837 case ast_op_and: return _left->eval_boolean(c, stack) && _right->eval_boolean(c, stack);
8838
8839 case ast_op_equal: return compare_eq(_left, _right, c, stack, equal_to());
8840
8841 case ast_op_not_equal: return compare_eq(_left, _right, c, stack, not_equal_to());
8842
8843 case ast_op_less: return compare_rel(_left, _right, c, stack, less());
8844
8845 case ast_op_greater: return compare_rel(_right, _left, c, stack, less());
8846
8847 case ast_op_less_or_equal: return compare_rel(_left, _right, c, stack, less_equal());
8848
8849 case ast_op_greater_or_equal: return compare_rel(_right, _left, c, stack, less_equal());
8850
8851 case ast_func_starts_with:
8852 {
8853 xpath_allocator_capture cr(stack.result);
8854
8855 xpath_string lr = _left->eval_string(c, stack);
8856 xpath_string rr = _right->eval_string(c, stack);
8857
8858 return starts_with(lr.c_str(), rr.c_str());
8859 }
8860
8861 case ast_func_contains:
8862 {
8863 xpath_allocator_capture cr(stack.result);
8864
8865 xpath_string lr = _left->eval_string(c, stack);
8866 xpath_string rr = _right->eval_string(c, stack);
8867
8868 return find_substring(lr.c_str(), rr.c_str()) != 0;
8869 }
8870
8871 case ast_func_boolean: return _left->eval_boolean(c, stack);
8872
8873 case ast_func_not: return !_left->eval_boolean(c, stack);
8874
8875 case ast_func_true: return true;
8876
8877 case ast_func_false: return false;
8878
8879 case ast_func_lang:
8880 {
8881 if (c.n.attribute())
8882 return false;
8883
8884 xpath_allocator_capture cr(stack.result);
8885
8886 xpath_string lang = _left->eval_string(c, stack);
8887
8888 for (xml_node n = c.n.node(); n; n = n.parent())

Callers 3

compare_eqMethod · 0.45
apply_predicateMethod · 0.45
evaluate_booleanMethod · 0.45

Calls 15

not_equal_toClass · 0.70
lessClass · 0.70
less_equalClass · 0.70
starts_withFunction · 0.70
find_substringFunction · 0.70
tolower_asciiFunction · 0.70
eval_stringMethod · 0.45
c_strMethod · 0.45
attributeMethod · 0.45
nodeMethod · 0.45
parentMethod · 0.45

Tested by

no test coverage detected