Diego: added method TaggedAncestor, renamed former method TaggedFoll to TaggedFollowi...
[SXSI/XMLTree.git] / XMLTree.h
index 7c08fcc..d446ab1 100644 (file)
--- a/XMLTree.h
+++ b/XMLTree.h
@@ -87,6 +87,8 @@ class XMLTree {
 \r
    /** The texts in the XML document */\r
    TextCollection *Text;\r
+   /** The texts in the XML document (cached for faster display) */\r
+   vector<string> CachedText;\r
    \r
    /** Flag indicating whether the whole data structure has been constructed or \r
     * not. If the value is true, you cannot add more texts, nodes, etc. */\r
@@ -202,6 +204,10 @@ public:
     * is none. */\r
    treeNode TaggedDesc(treeNode x, TagType tag);\r
 \r
+   /** TaggedNext(x,tag): returns the first node tagged tag with larger \r
+    * preorder than x. Returns NULT if there is none. */\r
+   treeNode TaggedNext(treeNode x, TagType tag);\r
+\r
    /** TaggedPrec(x,tag): returns the first node tagged tag with smaller \r
     * preorder than x and not an ancestor of x. Returns NULLT if there \r
     * is none. */\r
@@ -211,7 +217,14 @@ public:
     * preorder than x and not in the subtree of x. Returns NULLT if there \r
     * is none. */\r
    treeNode TaggedFoll(treeNode x, TagType tag);\r
-   \r
+  \r
+   /** TaggedFollowingSibling(x,tag) */\r
+   treeNode TaggedFollowingSibling(treeNode x, TagType tag);\r
+\r
+   /** TaggedAncestor(x, tag): returns the closest ancestor of x tagged \r
+     * tag. Return NULLT is there is none. */\r
+   treeNode TaggedAncestor(treeNode x, TagType tag);\r
\r
    /** PrevText(x): returns the document identifier of the text to the left of \r
     * node x, or NULLT if x is the root node. */\r
    DocID PrevText(treeNode x);\r
@@ -386,6 +399,10 @@ public:
    uchar* GetText(DocID d) {\r
       return Text->GetText(d);\r
    }\r
+\r
+   uchar* GetCachedText(DocID d) {\r
+     return (uchar*) (CachedText.at(d).c_str());\r
+   }\r
    \r
    TextCollection *getTextCollection() {\r
       return Text;\r