xmlwrapp Lightweight C++ XML parsing library

Classes | Public Types | Public Member Functions | List of all members
xml::nodes_view Class Reference

This class implements a view of XML nodes. More...

`#include <nodes_view.h>`

## Classes
class | const_iterator
| The const_iterator provides a way to access nodes in the view similar to a standard C++ container. More...
class | iterator
| The iterator provides a way to access nodes in the view similar to a standard C++ container. More...

## Public Types
typedef std::size_t | size_type
| Size type. More...

## Public Member Functions
iterator | begin ()
| Get an iterator that points to the beginning of this view's nodes. More...
const_iterator | begin () const
| Get an iterator that points to the beginning of this view's nodes. More...
iterator | end ()
| Get an iterator that points one past the last child for this view. More...
const_iterator | end () const
| Get an iterator that points one past the last child for this view. More...
size_type | size () const
| Returns the number of nodes in this view. More...
bool | empty () const
| Is the view empty? More...
iterator | erase (const iterator &to_erase)
| Erase the node that is pointed to by the given iterator. More...
iterator | erase (iterator first, const iterator &last)
| Erase all nodes in the given range, from first to last. More...

## Detailed Description

This class implements a view of XML nodes.

A view is a container-like class that only allows access to a subset of xml::node's child nodes. The exact content depends on how the view was obtained; typical uses are e.g. a view of all element children or all elements with a given name.

The nodes_view class implements the same container interface that xml::node does: it has begin() and end() methods.

Since
  0.6.0

See also
  xml::node::elements(), xml::node::elements(const char *)

## Member Typedef Documentation

## ◆ size_type

typedef std::size_t xml::nodes_view::size_type

Size type.

## Member Function Documentation

## ◆ begin() [1/2]

iterator xml::nodes_view::begin | ( |  | ) |
| inline

Get an iterator that points to the beginning of this view's nodes.

## ◆ begin() [2/2]

const_iterator xml::nodes_view::begin | ( |  | ) | const
| inline

Get an iterator that points to the beginning of this view's nodes.

## ◆ empty()

bool xml::nodes_view::empty | ( |  | ) | const
| inline

Is the view empty?

## ◆ end() [1/2]

iterator xml::nodes_view::end | ( |  | ) |
| inline

Get an iterator that points one past the last child for this view.

## ◆ end() [2/2]

const_iterator xml::nodes_view::end | ( |  | ) | const
| inline

Get an iterator that points one past the last child for this view.

## ◆ erase() [1/2]

iterator xml::nodes_view::erase | ( | const iterator & | to_erase | ) |

Erase the node that is pointed to by the given iterator.

The node and all its children will be removed from its parent node. This will invalidate any iterators that point to the node to be erased, or any pointers or references to that node (but not any other iterators).

Parameters

  to_erase | An iterator that points to the node to be erased.

Returns
  An iterator that points to the next node in this view after the one being erased or end() if there are none.

Since
  0.8.0

## ◆ erase() [2/2]

iterator xml::nodes_view::erase | ( | iterator | first,
|  | const iterator & | last
| ) |  |

Erase all nodes in the given range, from first to last.

This will invalidate any iterators that point to the nodes to be erased, or any pointers or references to those nodes.

Parameters

  first | The first node in the range to be removed.
  last | An iterator that points one past the last node to erase. Think xml::node::end().

Returns
  An iterator that points to the next node in this view after the ones being erased or end() if there are none.

Since
  0.8.0

## ◆ size()

size_type xml::nodes_view::size | ( |  | ) | const

Returns the number of nodes in this view.

The documentation for this class was generated from the following file:

- xmlwrapp/nodes_view.h