diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2014-01-27 03:54:05 +0000 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2014-01-27 03:54:05 +0000 |
commit | 0938714fa010b23e2d2a43606ae0eb8280c481fe (patch) | |
tree | 1944b008403cac5b785941627328c3cdc7593ff5 /src/pugixml.hpp | |
parent | 4d8974f1fd3e5366e93464a7ab68a35777354886 (diff) |
Change xml_named_node_iterator to be bidirectional and to match xml_node_iterator in terms of internals
git-svn-id: http://pugixml.googlecode.com/svn/trunk@960 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'src/pugixml.hpp')
-rw-r--r-- | src/pugixml.hpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/pugixml.hpp b/src/pugixml.hpp index f14c710..db1507a 100644 --- a/src/pugixml.hpp +++ b/src/pugixml.hpp @@ -753,6 +753,8 @@ namespace pugi // Named node range helper class PUGIXML_CLASS xml_named_node_iterator { + friend class xml_node; + public: // Iterator traits typedef ptrdiff_t difference_type; @@ -761,7 +763,7 @@ namespace pugi typedef xml_node& reference; #ifndef PUGIXML_NO_STL - typedef std::forward_iterator_tag iterator_category; + typedef std::bidirectional_iterator_tag iterator_category; #endif // Default constructor @@ -780,9 +782,15 @@ namespace pugi const xml_named_node_iterator& operator++(); xml_named_node_iterator operator++(int); + const xml_named_node_iterator& operator--(); + xml_named_node_iterator operator--(int); + private: - mutable xml_node _node; + mutable xml_node _wrap; + xml_node _parent; const char_t* _name; + + xml_named_node_iterator(xml_node_struct* ref, xml_node_struct* parent, const char_t* name); }; // Abstract tree walker class (see xml_node::traverse) @@ -1234,7 +1242,7 @@ namespace std // Workarounds for (non-standard) iterator category detection for older versions (MSVC7/IC8 and earlier) std::bidirectional_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pugi::xml_node_iterator&); std::bidirectional_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pugi::xml_attribute_iterator&); - std::forward_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pugi::xml_named_node_iterator&); + std::bidirectional_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pugi::xml_named_node_iterator&); } #endif @@ -1244,7 +1252,7 @@ namespace std // Workarounds for (non-standard) iterator category detection std::bidirectional_iterator_tag PUGIXML_FUNCTION __iterator_category(const pugi::xml_node_iterator&); std::bidirectional_iterator_tag PUGIXML_FUNCTION __iterator_category(const pugi::xml_attribute_iterator&); - std::forward_iterator_tag PUGIXML_FUNCTION __iterator_category(const pugi::xml_named_node_iterator&); + std::bidirectional_iterator_tag PUGIXML_FUNCTION __iterator_category(const pugi::xml_named_node_iterator&); } #endif |