diff options
| author | Ted Gould <ted@gould.cx> | 2006-05-02 05:49:17 +0000 |
|---|---|---|
| committer | gouldtj <gouldtj@users.sourceforge.net> | 2006-05-02 05:49:17 +0000 |
| commit | c0f13f760674b431f30b5ff17469030c5fa5a8d4 (patch) | |
| tree | 6286959e37edefe5122a963efe6f8f66fdd67bcc /src/dom/xpathtoken.cpp | |
| parent | r11623@tres: ted | 2006-05-01 22:17:40 -0700 (diff) | |
| download | inkscape-c0f13f760674b431f30b5ff17469030c5fa5a8d4.tar.gz inkscape-c0f13f760674b431f30b5ff17469030c5fa5a8d4.zip | |
r11667@tres: ted | 2006-05-01 22:48:49 -0700
Backing out version 11530. SVK is so liberating and so frustrating all
at the same time.
(bzr r697)
Diffstat (limited to 'src/dom/xpathtoken.cpp')
| -rw-r--r-- | src/dom/xpathtoken.cpp | 120 |
1 files changed, 67 insertions, 53 deletions
diff --git a/src/dom/xpathtoken.cpp b/src/dom/xpathtoken.cpp index 2d5dfc1d7..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,6 +148,8 @@ DOMString Token::getTypeString() return ret;
}
+
+
//########################################################################
//# X P A T H A X I S
//########################################################################
@@ -166,7 +168,8 @@ Axis::Axis() */
Axis::Axis(int tokPos)
{
- assign(other);
+ init();
+ tokenPosition = tokPos;
}
@@ -183,7 +186,15 @@ Axis::Axis(const Axis &other) /**
*
*/
-StackItem &StackItem::operator=(const StackItem &other)
+Axis::~Axis()
+{
+}
+
+
+/**
+ *
+ */
+Axis &Axis::operator=(const Axis &other)
{
assign(other);
return *this;
@@ -192,105 +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 I T E M
-//########################################################################
-
/**
*
*/
-StackItem::StackItem()
+void Axis::assign(const Axis &other)
{
- ival = 0L;
- dval = 0.0;
+ tokenPosition = other.tokenPosition;
}
-
/**
*
*/
-StackItem::StackItem(const StackItem &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;
+}
/**
*
*/
-StackItem &StackItem::operator=(const StackItem &other)
+StackItem::StackItem(const StackItem &other)
{
assign(other);
- return *this;
}
+
/**
*
*/
-void StackItem::assign(const StackItem &other)
+StackItem::~StackItem()
{
- sval = other.sval;
- ival = other.ival;
- dval = other.dval;
}
+
/**
- * 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;
}
@@ -370,22 +375,31 @@ unsigned int TokenList::size() const }
- 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();
}
|
