source: icGREP/icgrep-devel/icgrep/combine/pugixml/contrib/foreach.hpp @ 5516

Last change on this file since 5516 was 5516, checked in by faldebey, 21 months ago

added combinatorial testing tool

File size: 1.4 KB
Line 
1/*
2 * Boost.Foreach support for pugixml classes.
3 * This file is provided to the public domain.
4 * Written by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
5 */
6
7#ifndef HEADER_PUGIXML_FOREACH_HPP
8#define HEADER_PUGIXML_FOREACH_HPP
9
10#include <boost/range/iterator.hpp>
11
12#include "pugixml.hpp"
13
14/*
15 * These types add support for BOOST_FOREACH macro to xml_node and xml_document classes (child iteration only).
16 * Example usage:
17 * BOOST_FOREACH(xml_node n, doc) {}
18 */
19
20namespace boost
21{
22        template<> struct range_mutable_iterator<pugi::xml_node>
23        {
24                typedef pugi::xml_node::iterator type;
25        };
26
27        template<> struct range_const_iterator<pugi::xml_node>
28        {
29                typedef pugi::xml_node::iterator type;
30        };
31
32        template<> struct range_mutable_iterator<pugi::xml_document>
33        {
34                typedef pugi::xml_document::iterator type;
35        };
36
37        template<> struct range_const_iterator<pugi::xml_document>
38        {
39                typedef pugi::xml_document::iterator type;
40        };
41}
42
43/*
44 * These types add support for BOOST_FOREACH macro to xml_node and xml_document classes (child/attribute iteration).
45 * Example usage:
46 * BOOST_FOREACH(xml_node n, children(doc)) {}
47 * BOOST_FOREACH(xml_node n, attributes(doc)) {}
48 */
49
50namespace pugi
51{
52        inline xml_object_range<xml_node_iterator> children(const pugi::xml_node& node)
53        {
54                return node.children();
55        }
56
57        inline xml_object_range<xml_attribute_iterator> attributes(const pugi::xml_node& node)
58        {
59                return node.attributes();
60        }
61}
62
63#endif
Note: See TracBrowser for help on using the repository browser.