X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=xml-tree.hpp;h=4ada586c05b4b243bd3c82a9567937ada66fae01;hb=daf6549ca274aaa8d9c0b3964c5502f0f0f08d7d;hp=8d4af6ae0fba3f37f627daf858e8c31749585ea4;hpb=01c39298054f3d532fca0ab704c8ddbb4de02450;p=SXSI%2FXMLTree.git diff --git a/xml-tree.hpp b/xml-tree.hpp index 8d4af6a..4ada586 100644 --- a/xml-tree.hpp +++ b/xml-tree.hpp @@ -142,13 +142,48 @@ public: inline bool is_open(node_t) const; //Numbering functions + /** + * [depth(n)] returns the depths of node [n]. The root has depth 1. + * Runs in O(1) + */ uint32_t depth(node_t) const; + + /** + * [preorder(n)] returns the preorder of node [n]. Equivalent to calling + * rank on the underlying BP representation. + * Runs in O(1) + */ uint32_t preorder(node_t) const; + + /** + * [preorder(n)] returns the postorder of node [n]. + * Runs in O(1) + */ uint32_t postorder(node_t) const; //Tag functions + /** + * [tag(n)] returns the tag of node [n] which must be a valid node identifier + * (in particular not NIL) + * Runs in O(1) + */ inline tag_t tag(node_t) const; + + /** + * [get_tag_name_by_ref(t)] returns the string representation of tag [t] + * For elements, the string representation is the tag name itself + * Returns if [t] is not a proper tag identifier. + * Runs in O(1) + */ const char* get_tag_name_by_ref(tag_t) const; + + /** + * [register_tag(s)] returns the tag identifier for the tag represented + * by the string [s]. If no such tag exists in the document, return a + * fresh tag identifier [i]. Subsequent calls with the same [s] will return + * the same identifier. + * Runs in O(1) + */ tag_t register_tag(char *s); //Navigation functions