diff options
| author | Bob Jamison <ishmalius@gmail.com> | 2006-04-23 21:47:31 +0000 |
|---|---|---|
| committer | ishmal <ishmal@users.sourceforge.net> | 2006-04-23 21:47:31 +0000 |
| commit | 18cd4d5b25c3083e4ed18ce3b35f5dd0c9394c17 (patch) | |
| tree | bc300215dd7aef85df8ac7ff960197581b6cabec /src/dom/xpathtoken.cpp | |
| parent | svd hacks (diff) | |
| download | inkscape-18cd4d5b25c3083e4ed18ce3b35f5dd0c9394c17.tar.gz inkscape-18cd4d5b25c3083e4ed18ce3b35f5dd0c9394c17.zip | |
Move contextual info to Stack
(bzr r578)
Diffstat (limited to 'src/dom/xpathtoken.cpp')
| -rw-r--r-- | src/dom/xpathtoken.cpp | 52 |
1 files changed, 49 insertions, 3 deletions
diff --git a/src/dom/xpathtoken.cpp b/src/dom/xpathtoken.cpp index 9d2b86215..0254266d0 100644 --- a/src/dom/xpathtoken.cpp +++ b/src/dom/xpathtoken.cpp @@ -10,7 +10,7 @@ * Authors:
* Bob Jamison
*
- * Copyright (C) 2005 Bob Jamison
+ * Copyright (C) 2006 Bob Jamison
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -94,6 +94,25 @@ Stack::Stack() */
Stack::Stack(const Stack &other)
{
+ assign(other);
+}
+
+
+/**
+ *
+ */
+Stack::~Stack()
+{
+}
+
+
+/**
+ *
+ */
+void Stack::assign(const Stack &other)
+{
+ root = other.root;
+ nodeList = other.nodeList;
size = other.size;
for (int i=0 ; i<size ; i++)
items[i] = other.items[i];
@@ -103,10 +122,17 @@ Stack::Stack(const Stack &other) /**
*
*/
-Stack::~Stack()
+void Stack::reset()
{
+ root = NULL;
+ NodeList n; /*no "clear" in api*/
+ nodeList = n;
+ size = 0;
}
+
+
+
/**
*
*/
@@ -132,6 +158,22 @@ StackItem Stack::pop() return items[--size];
}
+/**
+ * Set the root node
+ */
+void Stack::setRootNode(const Node *node)
+{
+ root = (Node *)node;
+}
+
+
+/**
+ * Get the current node list;
+ */
+NodeList &Stack::getNodeList()
+{
+ return nodeList;
+}
//########################################################################
@@ -187,14 +229,18 @@ NodeList TokenList::execute(const Node *root) return list;
Stack stack;
+ stack.setRootNode(root);
+
//### Execute the token list
std::vector<Token *>::iterator iter;
for (iter = tokens.begin() ; iter != tokens.end() ; iter++)
{
Token *tok = *iter;
- tok->execute(stack, list);
+ tok->execute(stack);
}
+ list = stack.getNodeList();
+
return list;
}
|
