## Class container

zeep::xml::container

## Synopsis

    // In header: </home/maarten/projects/libzeep/zeep/xml/node.hpp>

    class container : public zeep::xml::node {
    public:
      // types
      typedef basic_iterator< element >       iterator;
      typedef basic_iterator< node >          node_iterator;
      typedef basic_iterator< const element > const_iterator;
      typedef basic_iterator< const node >    const_node_iterator;
      typedef iterator::value_type            value_type;
      typedef iterator::reference             reference;
      typedef iterator::pointer               pointer;
      typedef iterator::difference_type       difference_type;
      typedef unsigned long                   size_type;

      // member classes/structs/unions
      template<typename NodeType>
      class basic_iterator {
      public:
        // types
        typedef std::iterator< std::bidirectional_iterator_tag, NodeType * > base_type;
        typedef base_type::reference                                         reference;
        typedef base_type::pointer                                           pointer;

        // construct/copy/destruct
        basic_iterator();
        basic_iterator(NodeType *);
        basic_iterator(const basic_iterator &);
        basic_iterator& operator=(const basic_iterator &);
        basic_iterator& operator=(const NodeType *);

        // public member functions
        reference operator*();
        pointer operator->() const;
        basic_iterator & operator++();
        basic_iterator operator++(int);
        basic_iterator & operator--();
        basic_iterator operator--(int);
        bool operator==(const basic_iterator &) const;
        bool operator!=(const basic_iterator &) const;
        template<typename RNodeType> bool operator==(const RNodeType) const;
        template<typename RNodeType> bool operator!=(const RNodeType) const;
        operator const pointer() const;
        operator pointer();
        template<> container::basic_iterator< element > & operator++();
        template<> container::basic_iterator< element > & operator--();
        template<> container::basic_iterator< const element > & operator++();
        template<> container::basic_iterator< const element > & operator--();
        template<> container::basic_iterator< node > & operator++();
        template<> container::basic_iterator< node > & operator--();
        template<> container::basic_iterator< const node > & operator++();
        template<> container::basic_iterator< const node > & operator--();
      };

      // construct/copy/destruct
      container();
      ~container();

      // public member functions
      node * child();
      const node * child() const;
      template<typename NodeType> std::list< NodeType * > children() const;
      iterator begin();
      iterator end();
      node_iterator node_begin();
      node_iterator node_end();
      boost::iterator_range< node_iterator > nodes();
      const_iterator begin() const;
      const_iterator end() const;
      const_node_iterator node_begin() const;
      const_node_iterator node_end() const;
      boost::iterator_range< const_node_iterator > nodes() const;
      size_type size() const;
      size_type max_size() const;
      bool empty() const;
      node * front() const;
      node * back() const;
      template<typename NodeType>
        basic_iterator< NodeType > insert(basic_iterator< NodeType >, NodeType *);
      node_iterator insert(node *, node *);
      template<typename Iterator> void insert(Iterator, Iterator, Iterator);
      template<typename Iterator> void erase(Iterator);
      template<typename Iterator> void erase(Iterator, Iterator);
      void swap(container &);
      void clear();
      void push_front(node *);
      void pop_front();
      void push_back(node *);
      void pop_back();
      void append(node *);
      void remove(node *);
      element_set find(const std::string &) const;
      element * find_first(const std::string &) const;
      element_set find(const char *) const;
      element * find_first(const char *) const;
      void find(const char *, node_set &) const;
      void find(const char *, element_set &) const;
      node * find_first_node(const char *) const;
      void validate();
    };

## Description

Container is an abstract base class for nodes that can have multiple children. It provides iterators to iterate over children. Most often, you're only interested in iteration zeep::xml::element children, that's why zeep::xml::container::iterator iterates over only zeep::xml::element nodes, skipping all other nodes. If you want to iterate all nodes, use zeep::xml::container::node_iterator instead.

An attempt has been made to make container conform to the STL container interface.

### `container` public construct/copy/destruct

1.     container();

2.     ~container();

   container tries hard to be stl::container-like.

### `container` public member functions

1.     node * child();

2.     const node * child() const;

3.     template<typename NodeType> std::list< NodeType * > children() const;

   very often, we want to iterate over child elements of an element therefore we have a templated version of children.

4.     iterator begin();

5.     iterator end();

6.     node_iterator node_begin();

7.     node_iterator node_end();

8.     boost::iterator_range< node_iterator > nodes();

9.     const_iterator begin() const;

10.     const_iterator end() const;

11.     const_node_iterator node_begin() const;

12.     const_node_iterator node_end() const;

13.     boost::iterator_range< const_node_iterator > nodes() const;

14.     size_type size() const;

15.     size_type max_size() const;

16.     bool empty() const;

17.     node * front() const;

18.     node * back() const;

19.     template<typename NodeType>
          basic_iterator< NodeType >
          insert(basic_iterator< NodeType > position, NodeType * n);

20.     node_iterator insert(node * before, node * n);

21.     template<typename Iterator>
          void insert(Iterator position, Iterator first, Iterator last);

22.     template<typename Iterator> void erase(Iterator position);

23.     template<typename Iterator> void erase(Iterator first, Iterator last);

24.     void swap(container & cnt);

25.     void clear();

26.     void push_front(node * n);

27.     void pop_front();

28.     void push_back(node * n);

29.     void pop_back();

30.     void append(node * n);

31.     void remove(node * n);

32.     element_set find(const std::string & path) const;

33.     element * find_first(const std::string & path) const;

34.     element_set find(const char * path) const;

35.     element * find_first(const char * path) const;

36.     void find(const char * path, node_set & nodes) const;

37.     void find(const char * path, element_set & elements) const;

38.     node * find_first_node(const char * path) const;

39.     void validate();

    debug routine