Gets previous sibling node, optionally matching node name. Behaviour is undefined if node has no parent. Use parent() to test if node has a parent. \param name Name of sibling to find, or 0 to return previous sibling 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 automaticall
| 979 | //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters |
| 980 | //! \return Pointer to found sibling, or 0 if not found. |
| 981 | xml_node<Ch> *previous_sibling(const Ch *name = 0, std::size_t name_size = 0, bool case_sensitive = true) const |
| 982 | { |
| 983 | assert(this->m_parent); // Cannot query for siblings if node has no parent |
| 984 | if (name) |
| 985 | { |
| 986 | if (name_size == 0) |
| 987 | name_size = internal::measure(name); |
| 988 | for (xml_node<Ch> *sibling = m_prev_sibling; sibling; sibling = sibling->m_prev_sibling) |
| 989 | if (internal::compare(sibling->name(), sibling->name_size(), name, name_size, case_sensitive)) |
| 990 | return sibling; |
| 991 | return 0; |
| 992 | } |
| 993 | else |
| 994 | return m_prev_sibling; |
| 995 | } |
| 996 | |
| 997 | //! Gets next sibling node, optionally matching node name. |
| 998 | //! Behaviour is undefined if node has no parent. |