diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2015-05-14 08:01:03 -0700 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2015-05-14 08:04:06 -0700 |
commit | f828eae3eaca02c9659d63cbcab65c9dd8e13869 (patch) | |
tree | 71347971f8e7c857f49f2f7a2d4ecaef390e939f /src/pugixml.hpp | |
parent | 01f627a4d75ae25850bc29df74112696da571326 (diff) |
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.
Diffstat (limited to 'src/pugixml.hpp')
-rw-r--r-- | src/pugixml.hpp | 3 |
1 files changed, 3 insertions, 0 deletions
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; |