From f828eae3eaca02c9659d63cbcab65c9dd8e13869 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Thu, 14 May 2015 08:01:03 -0700 Subject: Implement xml_node::attribute with a hint Extra argument 'hint' is used to start the attribute lookup; if the attribute is not found the lookup is restarted from the beginning of the attriubte list. This allows to optimize attribute lookups if you need to get many attributes from the node and can make assumptions about the likely ordering. The code is correct regardless of the order, but it is faster than using vanilla lookups if the order matches the calling order. Fixes #30. --- src/pugixml.hpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/pugixml.hpp') diff --git a/src/pugixml.hpp b/src/pugixml.hpp index 0f79fb7..cdd24b6 100644 --- a/src/pugixml.hpp +++ b/src/pugixml.hpp @@ -466,6 +466,9 @@ namespace pugi xml_node next_sibling(const char_t* name) const; xml_node previous_sibling(const char_t* name) const; + // Get attribute, starting the search from a hint (and updating hint so that searching for a sequence of attributes is fast) + xml_attribute attribute(const char_t* name, xml_attribute& hint) const; + // Get child value of current node; that is, value of the first child node of type PCDATA/CDATA const char_t* child_value() const; -- cgit v1.2.3