| 9935 | } |
| 9936 | |
| 9937 | template <class T> void step_fill(xpath_node_set_raw& ns, xml_node_struct* n, xpath_allocator* alloc, bool once, T) |
| 9938 | { |
| 9939 | const axis_t axis = T::axis; |
| 9940 | |
| 9941 | switch (axis) |
| 9942 | { |
| 9943 | case axis_attribute: |
| 9944 | { |
| 9945 | for (xml_attribute_struct* a = n->first_attribute; a; a = a->next_attribute) |
| 9946 | if (step_push(ns, a, n, alloc) & once) |
| 9947 | return; |
| 9948 | |
| 9949 | break; |
| 9950 | } |
| 9951 | |
| 9952 | case axis_child: |
| 9953 | { |
| 9954 | for (xml_node_struct* c = n->first_child; c; c = c->next_sibling) |
| 9955 | if (step_push(ns, c, alloc) & once) |
| 9956 | return; |
| 9957 | |
| 9958 | break; |
| 9959 | } |
| 9960 | |
| 9961 | case axis_descendant: |
| 9962 | case axis_descendant_or_self: |
| 9963 | { |
| 9964 | if (axis == axis_descendant_or_self) |
| 9965 | if (step_push(ns, n, alloc) & once) |
| 9966 | return; |
| 9967 | |
| 9968 | xml_node_struct* cur = n->first_child; |
| 9969 | |
| 9970 | while (cur) |
| 9971 | { |
| 9972 | if (step_push(ns, cur, alloc) & once) |
| 9973 | return; |
| 9974 | |
| 9975 | if (cur->first_child) |
| 9976 | cur = cur->first_child; |
| 9977 | else |
| 9978 | { |
| 9979 | while (!cur->next_sibling) |
| 9980 | { |
| 9981 | cur = cur->parent; |
| 9982 | |
| 9983 | if (cur == n) return; |
| 9984 | } |
| 9985 | |
| 9986 | cur = cur->next_sibling; |
| 9987 | } |
| 9988 | } |
| 9989 | |
| 9990 | break; |
| 9991 | } |
| 9992 | |
| 9993 | case axis_following_sibling: |
| 9994 | { |
nothing calls this directly
no test coverage detected