Gets last child node, optionally matching node name. Behaviour is undefined if node has no children. Use first_node() to test if node has children. \param name Name of child to find, or 0 to return last child regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero \param name_size Size of name, in characters, or 0 to have size calculated automatically from s
| 956 | //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters |
| 957 | //! \return Pointer to found child, or 0 if not found. |
| 958 | xml_node<Ch> *last_node(const Ch *name = 0, std::size_t name_size = 0, bool case_sensitive = true) const |
| 959 | { |
| 960 | assert(m_first_node); // Cannot query for last child if node has no children |
| 961 | if (name) |
| 962 | { |
| 963 | if (name_size == 0) |
| 964 | name_size = internal::measure(name); |
| 965 | for (xml_node<Ch> *child = m_last_node; child; child = child->previous_sibling()) |
| 966 | if (internal::compare(child->name(), child->name_size(), name, name_size, case_sensitive)) |
| 967 | return child; |
| 968 | return 0; |
| 969 | } |
| 970 | else |
| 971 | return m_last_node; |
| 972 | } |
| 973 | |
| 974 | //! Gets previous sibling node, optionally matching node name. |
| 975 | //! Behaviour is undefined if node has no parent. |