2 * Boost.Foreach support for pugixml classes.
\r
3 * This file is provided to the public domain.
\r
7 #ifndef HEADER_PUGIXML_FOREACH_HPP
\r
8 #define HEADER_PUGIXML_FOREACH_HPP
\r
10 #include "pugixml.hpp"
\r
13 * These types add support for BOOST_FOREACH macro to xml_node and xml_document classes (child iteration only).
\r
15 * BOOST_FOREACH(xml_node n, doc) {}
\r
20 template <typename> struct range_mutable_iterator;
\r
21 template <typename> struct range_const_iterator;
\r
23 template<> struct range_mutable_iterator<pugi::xml_node>
\r
25 typedef pugi::xml_node::iterator type;
\r
28 template<> struct range_const_iterator<pugi::xml_node>
\r
30 typedef pugi::xml_node::iterator type;
\r
33 template<> struct range_mutable_iterator<pugi::xml_document>
\r
35 typedef pugi::xml_document::iterator type;
\r
38 template<> struct range_const_iterator<pugi::xml_document>
\r
40 typedef pugi::xml_document::iterator type;
\r
45 * These types add support for BOOST_FOREACH macro to xml_node and xml_document classes (child/attribute iteration).
\r
47 * BOOST_FOREACH(xml_node n, children(doc)) {}
\r
48 * BOOST_FOREACH(xml_node n, attributes(doc)) {}
\r
53 inline xml_object_range<xml_node_iterator> children(const pugi::xml_node& node)
\r
55 return node.children();
\r
58 inline xml_object_range<xml_attribute_iterator> attributes(const pugi::xml_node& node)
\r
60 return node.attributes();
\r