| 8126 | struct document_order_comparator |
| 8127 | { |
| 8128 | bool operator()(const xpath_node& lhs, const xpath_node& rhs) const |
| 8129 | { |
| 8130 | // optimized document order based check |
| 8131 | const void* lo = document_buffer_order(lhs); |
| 8132 | const void* ro = document_buffer_order(rhs); |
| 8133 | |
| 8134 | if (lo && ro) return lo < ro; |
| 8135 | |
| 8136 | // slow comparison |
| 8137 | xml_node ln = lhs.node(), rn = rhs.node(); |
| 8138 | |
| 8139 | // compare attributes |
| 8140 | if (lhs.attribute() && rhs.attribute()) |
| 8141 | { |
| 8142 | // shared parent |
| 8143 | if (lhs.parent() == rhs.parent()) |
| 8144 | { |
| 8145 | // determine sibling order |
| 8146 | for (xml_attribute a = lhs.attribute(); a; a = a.next_attribute()) |
| 8147 | if (a == rhs.attribute()) |
| 8148 | return true; |
| 8149 | |
| 8150 | return false; |
| 8151 | } |
| 8152 | |
| 8153 | // compare attribute parents |
| 8154 | ln = lhs.parent(); |
| 8155 | rn = rhs.parent(); |
| 8156 | } |
| 8157 | else if (lhs.attribute()) |
| 8158 | { |
| 8159 | // attributes go after the parent element |
| 8160 | if (lhs.parent() == rhs.node()) return false; |
| 8161 | |
| 8162 | ln = lhs.parent(); |
| 8163 | } |
| 8164 | else if (rhs.attribute()) |
| 8165 | { |
| 8166 | // attributes go after the parent element |
| 8167 | if (rhs.parent() == lhs.node()) return true; |
| 8168 | |
| 8169 | rn = rhs.parent(); |
| 8170 | } |
| 8171 | |
| 8172 | if (ln == rn) return false; |
| 8173 | |
| 8174 | if (!ln || !rn) return ln < rn; |
| 8175 | |
| 8176 | return node_is_before(ln.internal_object(), rn.internal_object()); |
| 8177 | } |
| 8178 | }; |
| 8179 | |
| 8180 | PUGI__FN double gen_nan() |
nothing calls this directly
no test coverage detected