summaryrefslogtreecommitdiff
path: root/src/pugixml.cpp
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-07-22 07:54:34 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-07-22 07:54:34 +0000
commit93bb5dcb43a8f80044a12fab962ba546bcb5df6a (patch)
tree273bb3f276d3c682abac8da7a9ee72ccb870f2cb /src/pugixml.cpp
parent0363bccfc910389e777fd62f126fe60d21a47fbb (diff)
XPath: Restored document order sorting optimization (it's now automatic for nodes that were loaded and not significantly altered), minor traversal optimizations
git-svn-id: http://pugixml.googlecode.com/svn/trunk@613 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'src/pugixml.cpp')
-rw-r--r--src/pugixml.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index 3f37e65..3792c40 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -3216,8 +3216,13 @@ namespace pugi
return (_attr && _attr->value) ? _attr->value : PUGIXML_TEXT("");
}
- unsigned int xml_attribute::document_order() const
+ const void* xml_attribute::document_order() const
{
+ if (!_attr) return 0;
+
+ if ((_attr->header & xml_memory_page_name_allocated_mask) == 0) return _attr->name;
+ if ((_attr->header & xml_memory_page_value_allocated_mask) == 0) return _attr->value;
+
return 0;
}
@@ -4014,8 +4019,13 @@ namespace pugi
return walker.end(arg_end);
}
- unsigned int xml_node::document_order() const
+ const void* xml_node::document_order() const
{
+ if (!_root) return 0;
+
+ if (_root->name && (_root->header & xml_memory_page_name_allocated_mask) == 0) return _root->name;
+ if (_root->value && (_root->header & xml_memory_page_value_allocated_mask) == 0) return _root->value;
+
return 0;
}