MCPcopy Create free account
hub / github.com/MyGUI/mygui / operator()

Method operator()

Tools/EditorFramework/pugixml.cpp:6838–6892  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6836struct document_order_comparator
6837{
6838 bool operator()(const xpath_node& lhs, const xpath_node& rhs) const
6839 {
6840 // optimized document order based check
6841 const void* lo = document_order(lhs);
6842 const void* ro = document_order(rhs);
6843
6844 if (lo && ro)
6845 return lo < ro;
6846
6847 // slow comparison
6848 xml_node ln = lhs.node(), rn = rhs.node();
6849
6850 // compare attributes
6851 if (lhs.attribute() && rhs.attribute())
6852 {
6853 // shared parent
6854 if (lhs.parent() == rhs.parent())
6855 {
6856 // determine sibling order
6857 for (xml_attribute a = lhs.attribute(); a; a = a.next_attribute())
6858 if (a == rhs.attribute())
6859 return true;
6860
6861 return false;
6862 }
6863
6864 // compare attribute parents
6865 ln = lhs.parent();
6866 rn = rhs.parent();
6867 }
6868 else if (lhs.attribute())
6869 {
6870 // attributes go after the parent element
6871 if (lhs.parent() == rhs.node())
6872 return false;
6873
6874 ln = lhs.parent();
6875 }
6876 else if (rhs.attribute())
6877 {
6878 // attributes go after the parent element
6879 if (rhs.parent() == lhs.node())
6880 return true;
6881
6882 rn = rhs.parent();
6883 }
6884
6885 if (ln == rn)
6886 return false;
6887
6888 unsigned int lh = node_height(ln);
6889 unsigned int rh = node_height(rn);
6890
6891 return node_is_before(ln, lh, rn, rh);
6892 }
6893};
6894
6895struct duplicate_comparator

Callers

nothing calls this directly

Calls 7

document_orderFunction · 0.70
node_heightFunction · 0.70
node_is_beforeFunction · 0.70
nodeMethod · 0.45
attributeMethod · 0.45
parentMethod · 0.45
next_attributeMethod · 0.45

Tested by

no test coverage detected