summaryrefslogtreecommitdiffstats
path: root/src/dom
diff options
context:
space:
mode:
authorBob Jamison <ishmalius@gmail.com>2006-04-30 00:34:33 +0000
committerishmal <ishmal@users.sourceforge.net>2006-04-30 00:34:33 +0000
commit3f0a67f1da57a32a820ea6aca2db330985acdc59 (patch)
tree611f5ac3c2690f6a8aed988fe329df6853766f57 /src/dom
parentupdated cc licenses to 2.5 (diff)
downloadinkscape-3f0a67f1da57a32a820ea6aca2db330985acdc59.tar.gz
inkscape-3f0a67f1da57a32a820ea6aca2db330985acdc59.zip
Rework Stack class to TokenExecutor, to support an Axis stack
(bzr r638)
Diffstat (limited to 'src/dom')
-rw-r--r--src/dom/dom.h8
-rw-r--r--src/dom/xpathparser.cpp5
-rw-r--r--src/dom/xpathtoken.cpp246
-rw-r--r--src/dom/xpathtoken.h358
4 files changed, 410 insertions, 207 deletions
diff --git a/src/dom/dom.h b/src/dom/dom.h
index ab82c4298..6741d375d 100644
--- a/src/dom/dom.h
+++ b/src/dom/dom.h
@@ -882,6 +882,14 @@ public:
*/
virtual ~NodeList() {}
+ /**
+ *
+ */
+ virtual void clear()
+ {
+ nodes.clear();
+ }
+
protected:
friend class NodeImpl;
diff --git a/src/dom/xpathparser.cpp b/src/dom/xpathparser.cpp
index 47a9a146a..cc6488eed 100644
--- a/src/dom/xpathparser.cpp
+++ b/src/dom/xpathparser.cpp
@@ -730,6 +730,8 @@ int XPathParser::getRelativeLocationPath(int p0, int depth)
if (t.getType() == OPERATOR && t.getIntValue()==DOUBLE_SLASH)
{
p++;
+ // a '//' is an abbreviation for /descendant-or-self:node()/
+ tokAdd(new TokAxisDescendantOrSelf());
p2 = getRelativeLocationPath(p, depth+1);
if (p2 < 0)
{
@@ -2024,7 +2026,8 @@ NodeList XPathParser::evaluate(const Node *root,
tokens.dump();
//### Execute the token list
- list = tokens.execute(root);
+ TokenExecutor executor;
+ list = executor.execute(tokens, root);
return list;
}
diff --git a/src/dom/xpathtoken.cpp b/src/dom/xpathtoken.cpp
index 5de011959..c9d4898d7 100644
--- a/src/dom/xpathtoken.cpp
+++ b/src/dom/xpathtoken.cpp
@@ -131,12 +131,12 @@ static TokenStringPair tokenStrings[] =
/**
- * Return the enumerated TokenType of this token
+ * Return the string TokenType of this token
* (in the .cpp file)
*/
DOMString Token::getTypeString()
{
- DOMString ret;
+ DOMString ret = "unknown";
for (TokenStringPair *pair = tokenStrings ; pair->sval ; pair++)
{
if (pair->ival == type)
@@ -148,25 +148,37 @@ DOMString Token::getTypeString()
return ret;
}
+
+
//########################################################################
-//# X P A T H S T A C K I T E M
+//# X P A T H A X I S
//########################################################################
/**
*
*/
-StackItem::StackItem()
+Axis::Axis()
{
- ival = 0L;
- dval = 0.0;
+ init();
}
/**
*
*/
-StackItem::StackItem(const StackItem &other)
+Axis::Axis(int tokPos)
+{
+ init();
+ tokenPosition = tokPos;
+}
+
+
+/**
+ *
+ */
+Axis::Axis(const Axis &other)
{
+ init();
assign(other);
}
@@ -174,7 +186,7 @@ StackItem::StackItem(const StackItem &other)
/**
*
*/
-StackItem::~StackItem()
+Axis::~Axis()
{
}
@@ -182,7 +194,7 @@ StackItem::~StackItem()
/**
*
*/
-StackItem &StackItem::operator=(const StackItem &other)
+Axis &Axis::operator=(const Axis &other)
{
assign(other);
return *this;
@@ -191,111 +203,99 @@ StackItem &StackItem::operator=(const StackItem &other)
/**
*
*/
-void StackItem::assign(const StackItem &other)
+void Axis::init()
{
- sval = other.sval;
- ival = other.ival;
- dval = other.dval;
+ tokenPosition = 0;
}
-
-//########################################################################
-//# X P A T H S T A C K
-//########################################################################
-
/**
*
*/
-Stack::Stack()
+void Axis::assign(const Axis &other)
{
- size = 0;
+ tokenPosition = other.tokenPosition;
}
-
/**
*
*/
-Stack::Stack(const Stack &other)
+void Axis::setPosition(unsigned int val)
{
- assign(other);
+ tokenPosition = val;
}
-
/**
*
*/
-Stack::~Stack()
+unsigned int Axis::getPosition()
{
+ return tokenPosition;
}
-
/**
*
*/
-void Stack::assign(const Stack &other)
+void Axis::setNode(const Node *val)
{
- root = other.root;
- nodeList = other.nodeList;
- size = other.size;
- for (int i=0 ; i<size ; i++)
- items[i] = other.items[i];
+ node = (Node *)val;
}
-
/**
*
*/
-void Stack::reset()
+Node *Axis::getNode()
{
- root = NULL;
- NodeList n; /*no "clear" in api*/
- nodeList = n;
- size = 0;
+ return node;
}
+//########################################################################
+//# X P A T H S T A C K I T E M
+//########################################################################
+/**
+ *
+ */
+StackItem::StackItem()
+{
+ ival = 0L;
+ dval = 0.0;
+}
/**
*
*/
-void Stack::push(StackItem &item)
+StackItem::StackItem(const StackItem &other)
{
- if (size>=STACK_SIZE)
- {
- return;
- }
- items[size++] = item;
+ assign(other);
}
+
/**
*
*/
-StackItem Stack::pop()
+StackItem::~StackItem()
{
- if (size<1)
- {
- StackItem item;
- return item;
- }
- return items[--size];
}
+
/**
- * Set the root node
+ *
*/
-void Stack::setRootNode(const Node *node)
+StackItem &StackItem::operator=(const StackItem &other)
{
- root = (Node *)node;
+ assign(other);
+ return *this;
}
-
/**
- * Get the current node list;
+ *
*/
-NodeList &Stack::getNodeList()
+void StackItem::assign(const StackItem &other)
{
- return nodeList;
+ sval = other.sval;
+ ival = other.ival;
+ dval = other.dval;
}
@@ -365,48 +365,140 @@ void TokenList::add(Token *tok)
tokens.push_back(tok);
}
+
/**
- * This method "executes" a list of Tokens in the context of a DOM root
- * Node, returning a list of Nodes that match the xpath expression.
+ *
*/
-NodeList TokenList::execute(const Node *root)
+unsigned int TokenList::size() const
{
- NodeList list;
-
- if (!root)
- return list;
+ return (unsigned int)tokens.size();
+}
- Stack stack;
- stack.setRootNode(root);
- //### Execute the token list
+/**
+ *
+ */
+void TokenList::dump()
+{
std::vector<Token *>::iterator iter;
+ printf("############# TOKENS\n");
for (iter = tokens.begin() ; iter != tokens.end() ; iter++)
{
Token *tok = *iter;
- tok->execute(stack);
+ tok->dump();
}
+}
- list = stack.getNodeList();
- return list;
+//########################################################################
+//# X P A T H E X E C U T O R
+//########################################################################
+
+/**
+ *
+ */
+TokenExecutor::TokenExecutor()
+{
+ reset();
}
/**
*
*/
-void TokenList::dump()
+TokenExecutor::TokenExecutor(const TokenExecutor &other)
{
- std::vector<Token *>::iterator iter;
- printf("############# TOKENS\n");
- for (iter = tokens.begin() ; iter != tokens.end() ; iter++)
+ reset();
+ assign(other);
+}
+
+
+/**
+ *
+ */
+TokenExecutor::~TokenExecutor()
+{
+}
+
+
+/**
+ *
+ */
+void TokenExecutor::assign(const TokenExecutor &other)
+{
+ axis = other.axis;
+ axisStack = other.axisStack;
+ stackSize = other.stackSize;
+ for (int i=0 ; i<stackSize ; i++)
+ stack[i] = other.stack[i];
+}
+
+
+/**
+ *
+ */
+void TokenExecutor::reset()
+{
+ axis.setPosition(0);
+ axis.setNode(NULL);
+ stackSize = 0;
+}
+
+
+
+
+/**
+ * Set the root node
+ */
+NodeList TokenExecutor::execute(const TokenList &tokens, const Node *node)
+{
+
+ axis.setPosition(0);
+ axis.setNode(node);
+
+ nodeList.clear();
+
+ while (axis.getPosition() < tokens.size())
{
- Token *tok = *iter;
- tok->dump();
}
+
+ return nodeList;
+}
+
+
+
+
+
+/**
+ *
+ */
+void TokenExecutor::push(StackItem &item)
+{
+ if (stackSize>=STACK_SIZE)
+ {
+ return;
+ }
+ stack[stackSize++] = item;
}
+/**
+ *
+ */
+StackItem TokenExecutor::pop()
+{
+ if (stackSize<1)
+ {
+ StackItem item;
+ return item;
+ }
+ return stack[--stackSize];
+}
+
+
+
+
+
+
diff --git a/src/dom/xpathtoken.h b/src/dom/xpathtoken.h
index 8961f80aa..d595ad43c 100644
--- a/src/dom/xpathtoken.h
+++ b/src/dom/xpathtoken.h
@@ -48,6 +48,72 @@ namespace xpath
typedef org::w3c::dom::DOMString DOMString;
+class Axis
+{
+public:
+ /**
+ * Constructor
+ */
+ Axis();
+
+ /**
+ * Constructor
+ */
+ Axis(int tokPos);
+
+ /**
+ * Copy constructor
+ */
+ Axis(const Axis &other);
+
+ /**
+ * Destructor
+ */
+ virtual ~Axis();
+
+ /**
+ *
+ */
+ Axis &operator=(const Axis &other);
+
+ /**
+ *
+ */
+ void init();
+
+ /**
+ *
+ */
+ void assign(const Axis &other);
+
+ /**
+ *
+ */
+ void setPosition(unsigned int val);
+
+ /**
+ *
+ */
+ unsigned int getPosition();
+
+ /**
+ *
+ */
+ void setNode(const Node *node);
+
+ /**
+ *
+ */
+ Node *getNode();
+
+private:
+
+ int tokenPosition;
+
+ Node *node;
+};
+
+
/**
* This represents a single value on the evaluation stack
*/
@@ -100,34 +166,40 @@ public:
};
+class TokenList;
+
+//########################################################################
+//# T O K E N E X E C U T O R
+//########################################################################
+
#define STACK_SIZE 1024
/**
- * An evaluation stack
+ * A token evaluator, with stack and axis context
*/
-class Stack
+class TokenExecutor
{
public:
/**
* Constructor
*/
- Stack();
+ TokenExecutor();
/**
* Copy constructor
*/
- Stack(const Stack &other);
+ TokenExecutor(const TokenExecutor &other);
/**
* Destructor
*/
- virtual ~Stack();
+ virtual ~TokenExecutor();
/**
* Assign our values to those of the other
*/
- virtual void assign(const Stack &other);
+ virtual void assign(const TokenExecutor &other);
/**
* Reset the stack to its original settings
@@ -145,27 +217,47 @@ public:
virtual StackItem pop();
/**
- * Set the root node
+ * Execute a token list on the stack
*/
- virtual void setRootNode(const Node *node);
+ NodeList execute(const TokenList &list, const Node *node);
/**
- * Get the current node list;
+ *
*/
- virtual NodeList &getNodeList();
+ Axis axis;
+ /**
+ *
+ */
+ std::vector<Axis> axisStack;
private:
- Node *root;
+ /**
+ * Contains the StackItem stack;
+ */
+ StackItem stack[STACK_SIZE];
+
+ /**
+ * Marks the head of the stack, for push() and pop()
+ */
+ int stackSize;
+
+ /**
+ * Current list of nodes found by the expression
+ */
NodeList nodeList;
- StackItem items[STACK_SIZE];
- int size;
+
};
+//########################################################################
+//# X P A T H T O K E N
+//########################################################################
+
+
/**
* This is a pseudocode-type class that executes itself on a stack,
@@ -295,8 +387,7 @@ public:
virtual int getType()
{ return type; }
/**
- * Return the enumerated TokenType of this token
- * (in the .cpp file)
+ * Return the string TokenType of this token
*/
virtual DOMString getTypeString();
@@ -304,7 +395,7 @@ public:
* Let this token execute itself on the given stack,
* possibly adding Nodes to the node list.
*/
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &stack)
{ return true; }
/**
@@ -348,7 +439,7 @@ private:
//########################################################################
-//# X P A T H T O K E N
+//# X P A T H T O K E N T Y P E S
//########################################################################
@@ -365,11 +456,11 @@ public:
type = TOK_STR;
sval = val;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
StackItem item;
item.sval = sval;
- stack.push(item);
+ exec.push(item);
return true;
}
};
@@ -382,11 +473,11 @@ public:
type = TOK_FLOAT;
dval = val;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
StackItem item;
item.dval = dval;
- stack.push(item);
+ exec.push(item);
return true;
}
};
@@ -399,11 +490,11 @@ public:
type = TOK_INT;
ival = val;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
StackItem item;
item.ival = ival;
- stack.push(item);
+ exec.push(item);
return true;
}
};
@@ -415,12 +506,12 @@ public:
{
type = TOK_AND;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
- StackItem item1 = stack.pop();
- StackItem item2 = stack.pop();
+ StackItem item1 = exec.pop();
+ StackItem item2 = exec.pop();
item1.ival = item1.ival && item2.ival;
- stack.push(item1);
+ exec.push(item1);
return true;
}
};
@@ -432,12 +523,12 @@ public:
{
type = TOK_OR;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
- StackItem item1 = stack.pop();
- StackItem item2 = stack.pop();
+ StackItem item1 = exec.pop();
+ StackItem item2 = exec.pop();
item1.ival = item1.ival || item2.ival;
- stack.push(item1);
+ exec.push(item1);
return true;
}
};
@@ -449,12 +540,12 @@ public:
{
type = TOK_MOD;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
- StackItem item1 = stack.pop();
- StackItem item2 = stack.pop();
+ StackItem item1 = exec.pop();
+ StackItem item2 = exec.pop();
item1.dval = fmod(item1.dval, item2.dval);
- stack.push(item1);
+ exec.push(item1);
return true;
}
};
@@ -466,12 +557,12 @@ public:
{
type = TOK_DIV;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
- StackItem item1 = stack.pop();
- StackItem item2 = stack.pop();
+ StackItem item1 = exec.pop();
+ StackItem item2 = exec.pop();
item1.dval /= item2.dval;
- stack.push(item1);
+ exec.push(item1);
return true;
}
};
@@ -483,12 +574,12 @@ public:
{
type = TOK_MULTIPLY;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
- StackItem item1 = stack.pop();
- StackItem item2 = stack.pop();
+ StackItem item1 = exec.pop();
+ StackItem item2 = exec.pop();
item1.dval *= item2.dval;
- stack.push(item1);
+ exec.push(item1);
return true;
}
};
@@ -500,12 +591,12 @@ public:
{
type = TOK_PLUS;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
- StackItem item1 = stack.pop();
- StackItem item2 = stack.pop();
+ StackItem item1 = exec.pop();
+ StackItem item2 = exec.pop();
item1.dval += item2.dval;
- stack.push(item1);
+ exec.push(item1);
return true;
}
};
@@ -517,12 +608,12 @@ public:
{
type = TOK_MINUS;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
- StackItem item1 = stack.pop();
- StackItem item2 = stack.pop();
+ StackItem item1 = exec.pop();
+ StackItem item2 = exec.pop();
item1.dval -= item2.dval;
- stack.push(item1);
+ exec.push(item1);
return true;
}
};
@@ -534,12 +625,12 @@ public:
{
type = TOK_NEG;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
- StackItem item;
- item.dval = -dval;
- item.ival = -ival;
- stack.push(item);
+ StackItem item = exec.pop();
+ item.dval = -item.dval;
+ item.ival = -item.ival;
+ exec.push(item);
return true;
}
};
@@ -551,12 +642,12 @@ public:
{
type = TOK_EQUALS;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
- StackItem item1 = stack.pop();
- StackItem item2 = stack.pop();
+ StackItem item1 = exec.pop();
+ StackItem item2 = exec.pop();
item1.ival = (item1.dval == item2.dval);
- stack.push(item1);
+ exec.push(item1);
return true;
}
};
@@ -568,12 +659,12 @@ public:
{
type = TOK_NOT_EQUALS;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
- StackItem item1 = stack.pop();
- StackItem item2 = stack.pop();
+ StackItem item1 = exec.pop();
+ StackItem item2 = exec.pop();
item1.ival = (item1.dval != item2.dval);
- stack.push(item1);
+ exec.push(item1);
return true;
}
};
@@ -585,12 +676,12 @@ public:
{
type = TOK_LESS_THAN_EQUALS;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
- StackItem item1 = stack.pop();
- StackItem item2 = stack.pop();
+ StackItem item1 = exec.pop();
+ StackItem item2 = exec.pop();
item1.ival = (item1.dval <= item2.dval);
- stack.push(item1);
+ exec.push(item1);
return true;
}
};
@@ -602,12 +693,12 @@ public:
{
type = TOK_LESS_THAN;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
- StackItem item1 = stack.pop();
- StackItem item2 = stack.pop();
+ StackItem item1 = exec.pop();
+ StackItem item2 = exec.pop();
item1.ival = (item1.dval < item2.dval);
- stack.push(item1);
+ exec.push(item1);
return true;
}
};
@@ -619,12 +710,12 @@ public:
{
type = TOK_GREATER_THAN_EQUALS;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
- StackItem item1 = stack.pop();
- StackItem item2 = stack.pop();
+ StackItem item1 = exec.pop();
+ StackItem item2 = exec.pop();
item1.ival = (item1.dval >= item2.dval);
- stack.push(item1);
+ exec.push(item1);
return true;
}
};
@@ -636,12 +727,12 @@ public:
{
type = TOK_GREATER_THAN;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
- StackItem item1 = stack.pop();
- StackItem item2 = stack.pop();
+ StackItem item1 = exec.pop();
+ StackItem item2 = exec.pop();
item1.ival = (item1.dval > item2.dval);
- stack.push(item1);
+ exec.push(item1);
return true;
}
};
@@ -658,8 +749,12 @@ public:
{
type = TOK_ABSOLUTE;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
+ Node *n = exec.axis.getNode();
+ while (n->getParentNode())
+ n = n->getParentNode();
+ exec.axis.setNode(n);
return true;
}
};
@@ -671,8 +766,9 @@ public:
{
type = TOK_RELATIVE;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
+ ///exec.axis.currentNode = stack.rootNode;
return true;
}
};
@@ -684,7 +780,7 @@ public:
{
type = TOK_STEP;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -698,7 +794,7 @@ public:
type = TOK_NAME_TEST;
sval = name;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -711,7 +807,7 @@ public:
{
type = TOK_EXPR;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -724,7 +820,7 @@ public:
{
type = TOK_UNION;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -745,7 +841,7 @@ public:
{
type = TOK_AXIS_ANCESTOR_OR_SELF;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -758,7 +854,7 @@ public:
{
type = TOK_AXIS_ANCESTOR;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -771,7 +867,7 @@ public:
{
type = TOK_AXIS_ATTRIBUTE;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -784,7 +880,7 @@ public:
{
type = TOK_AXIS_CHILD;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -797,7 +893,7 @@ public:
{
type = TOK_AXIS_DESCENDANT_OR_SELF;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -810,7 +906,7 @@ public:
{
type = TOK_AXIS_DESCENDANT;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -823,7 +919,7 @@ public:
{
type = TOK_AXIS_FOLLOWING_SIBLING;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -836,7 +932,7 @@ public:
{
type = TOK_AXIS_FOLLOWING;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -849,7 +945,7 @@ public:
{
type = TOK_AXIS_NAMESPACE;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -862,7 +958,7 @@ public:
{
type = TOK_AXIS_PARENT;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -875,7 +971,7 @@ public:
{
type = TOK_AXIS_PRECEDING_SIBLING;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -888,7 +984,7 @@ public:
{
type = TOK_AXIS_PRECEDING;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -901,7 +997,7 @@ public:
{
type = TOK_AXIS_SELF;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -920,7 +1016,7 @@ public:
{
type = TOK_FUNC_LAST;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -933,7 +1029,7 @@ public:
{
type = TOK_FUNC_POSITION;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -946,7 +1042,7 @@ public:
{
type = TOK_FUNC_COUNT;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -959,7 +1055,7 @@ public:
{
type = TOK_FUNC_ID;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -972,7 +1068,7 @@ public:
{
type = TOK_FUNC_LOCAL_NAME;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -985,7 +1081,7 @@ public:
{
type = TOK_FUNC_NAMESPACE_URI;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -998,7 +1094,7 @@ public:
{
type = TOK_FUNC_NAME;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -1011,7 +1107,7 @@ public:
{
type = TOK_FUNC_STRING;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -1024,7 +1120,7 @@ public:
{
type = TOK_FUNC_CONCAT;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -1037,7 +1133,7 @@ public:
{
type = TOK_FUNC_STARTS_WITH;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -1050,7 +1146,7 @@ public:
{
type = TOK_FUNC_CONTAINS;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -1063,7 +1159,7 @@ public:
{
type = TOK_FUNC_SUBSTRING_BEFORE;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -1076,7 +1172,7 @@ public:
{
type = TOK_FUNC_SUBSTRING_AFTER;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -1089,7 +1185,7 @@ public:
{
type = TOK_FUNC_SUBSTRING;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -1102,7 +1198,7 @@ public:
{
type = TOK_FUNC_STRING_LENGTH;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -1115,7 +1211,7 @@ public:
{
type = TOK_FUNC_NORMALIZE_SPACE;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -1128,7 +1224,7 @@ public:
{
type = TOK_FUNC_TRANSLATE;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -1141,7 +1237,7 @@ public:
{
type = TOK_FUNC_BOOLEAN;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -1154,7 +1250,7 @@ public:
{
type = TOK_FUNC_NOT;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -1167,7 +1263,7 @@ public:
{
type = TOK_FUNC_TRUE;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -1180,7 +1276,7 @@ public:
{
type = TOK_FUNC_FALSE;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -1193,7 +1289,7 @@ public:
{
type = TOK_FUNC_LANG;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -1206,7 +1302,7 @@ public:
{
type = TOK_FUNC_NUMBER;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -1219,7 +1315,7 @@ public:
{
type = TOK_FUNC_SUM;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -1232,7 +1328,7 @@ public:
{
type = TOK_FUNC_FLOOR;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -1245,7 +1341,7 @@ public:
{
type = TOK_FUNC_CEILING;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -1258,7 +1354,7 @@ public:
{
type = TOK_FUNC_ROUND;
}
- virtual bool execute(Stack &stack)
+ virtual bool execute(TokenExecutor &exec)
{
return true;
}
@@ -1316,10 +1412,9 @@ public:
virtual void add(Token *tok);
/**
- * This method "executes" a list of Tokens in the context of a DOM root
- * Node, returning a list of Nodes that match the xpath expression.
+ *
*/
- NodeList execute(const Node *root);
+ virtual unsigned int size() const;
/**
*
@@ -1331,10 +1426,15 @@ private:
std::vector<Token *> tokens;
+
};
+
+
+
+
} // namespace xpath
} // namespace dom
} // namespace w3c