summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1f27c92)
raw | patch | inline | side by side (parent: 1f27c92)
author | ishmal <ishmal@users.sourceforge.net> | |
Sun, 23 Apr 2006 21:47:31 +0000 (21:47 +0000) | ||
committer | ishmal <ishmal@users.sourceforge.net> | |
Sun, 23 Apr 2006 21:47:31 +0000 (21:47 +0000) |
src/dom/dom.h | patch | blob | history | |
src/dom/xpathparser.cpp | patch | blob | history | |
src/dom/xpathtoken.cpp | patch | blob | history | |
src/dom/xpathtoken.h | patch | blob | history |
diff --git a/src/dom/dom.h b/src/dom/dom.h
index 046e63dd8ada39b789173315a12bb1ff3cc5a144..4117f91b70a977eefcc450b767595c14231edd45 100644 (file)
--- a/src/dom/dom.h
+++ b/src/dom/dom.h
* 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
nodes = other.nodes;
}
+ /**
+ *
+ */
+ NodeList &operator=(const NodeList &other)
+ {
+ nodes = other.nodes;
+ return *this;
+ }
+
/**
*
*/
index 6baaea9c5946eb3386be9f380f9c8b812fc8c1b6..f3c57f6f51bbfbc50eb72bd09c18d18789de27f9 100644 (file)
--- a/src/dom/xpathparser.cpp
+++ b/src/dom/xpathparser.cpp
* Authors:\r
* Bob Jamison\r
*\r
- * Copyright (C) 2005 Bob Jamison\r
+ * Copyright (C) 2006 Bob Jamison\r
*\r
* This library is free software; you can redistribute it and/or\r
* modify it under the terms of the GNU Lesser General Public\r
#include "charclass.h"\r
#include "xpathparser.h"\r
\r
+\r
namespace org\r
{\r
namespace w3c\r
//# M E S S A G E S\r
//#########################################################################\r
\r
+\r
+\r
void XPathParser::trace(const char *fmt, ...)\r
{\r
if (!debug)\r
va_end(args);\r
}\r
\r
+\r
+\r
void XPathParser::error(const char *fmt, ...)\r
{\r
FILE *f = stdout;\r
fprintf(f, "^\n");\r
}\r
\r
+\r
+\r
void XPathParser::traceStack(const char *name, int pos, int depth)\r
{\r
if (!debug)\r
//#########################################################################\r
//# L E X I C A L S C A N N I N G\r
//#########################################################################\r
+\r
void XPathParser::lexTokAdd(int type, int loc)\r
{\r
LexTok tok(type, loc);\r
return p;\r
}\r
\r
+\r
+\r
int XPathParser::getLiteral(int p0, DOMString &result)\r
{\r
int p = p0;\r
}\r
\r
\r
+\r
+/**\r
+ * NCName is a 'non-colonized' name\r
+ */\r
int XPathParser::getNCName(int p0, DOMString &result)\r
{\r
int p = p0;\r
return p;\r
}\r
\r
+\r
+\r
+/**\r
+ * Name parsing with post-parsing\r
+ */\r
int XPathParser::getNameTest(int p0, DOMString &result)\r
{\r
int p = p0;\r
diff --git a/src/dom/xpathtoken.cpp b/src/dom/xpathtoken.cpp
index 9d2b86215921014c9cb59db01c48d0e88927cd34..0254266d0a4c1271c1fb21f961a4adf915e0dc3e 100644 (file)
--- a/src/dom/xpathtoken.cpp
+++ b/src/dom/xpathtoken.cpp
* Authors:\r
* Bob Jamison\r
*\r
- * Copyright (C) 2005 Bob Jamison\r
+ * Copyright (C) 2006 Bob Jamison\r
*\r
* This library is free software; you can redistribute it and/or\r
* modify it under the terms of the GNU Lesser General Public\r
*/\r
Stack::Stack(const Stack &other)\r
{\r
+ assign(other);\r
+}\r
+\r
+\r
+/**\r
+ *\r
+ */\r
+Stack::~Stack()\r
+{\r
+}\r
+\r
+\r
+/**\r
+ *\r
+ */\r
+void Stack::assign(const Stack &other)\r
+{\r
+ root = other.root;\r
+ nodeList = other.nodeList;\r
size = other.size;\r
for (int i=0 ; i<size ; i++)\r
items[i] = other.items[i];\r
/**\r
*\r
*/\r
-Stack::~Stack()\r
+void Stack::reset()\r
{\r
+ root = NULL;\r
+ NodeList n; /*no "clear" in api*/\r
+ nodeList = n;\r
+ size = 0;\r
}\r
\r
+\r
+\r
+\r
/**\r
*\r
*/\r
return items[--size];\r
}\r
\r
+/**\r
+ * Set the root node\r
+ */\r
+void Stack::setRootNode(const Node *node)\r
+{\r
+ root = (Node *)node;\r
+}\r
+\r
+\r
+/**\r
+ * Get the current node list;\r
+ */\r
+NodeList &Stack::getNodeList()\r
+{\r
+ return nodeList;\r
+}\r
\r
\r
//########################################################################\r
return list;\r
\r
Stack stack;\r
+ stack.setRootNode(root);\r
+\r
//### Execute the token list\r
std::vector<Token *>::iterator iter;\r
for (iter = tokens.begin() ; iter != tokens.end() ; iter++)\r
{\r
Token *tok = *iter;\r
- tok->execute(stack, list);\r
+ tok->execute(stack);\r
}\r
\r
+ list = stack.getNodeList();\r
+\r
return list;\r
}\r
\r
diff --git a/src/dom/xpathtoken.h b/src/dom/xpathtoken.h
index 50bca1ef198b11a15e44e4f3dd70eb90c85cd4eb..9b9259e06c5a2f5eae075d49d43c363010c2235e 100644 (file)
--- a/src/dom/xpathtoken.h
+++ b/src/dom/xpathtoken.h
* Authors:\r
* Bob Jamison\r
*\r
- * Copyright (C) 2005 Bob Jamison\r
+ * Copyright (C) 2006 Bob Jamison\r
*\r
* This library is free software; you can redistribute it and/or\r
* modify it under the terms of the GNU Lesser General Public\r
*/\r
virtual ~Stack();\r
\r
+ /**\r
+ * Assign our values to those of the other\r
+ */\r
+ virtual void assign(const Stack &other);\r
+\r
+ /**\r
+ * Reset the stack to its original settings\r
+ */\r
+ virtual void reset();\r
+\r
/**\r
* Push a stack item onto the stack\r
*/\r
*/\r
virtual StackItem pop();\r
\r
+ /**\r
+ * Set the root node\r
+ */\r
+ virtual void setRootNode(const Node *node);\r
+\r
+ /**\r
+ * Get the current node list;\r
+ */\r
+ virtual NodeList &getNodeList();\r
+\r
\r
private:\r
\r
+ Node *root;\r
+ NodeList nodeList;\r
+\r
StackItem items[STACK_SIZE];\r
int size;\r
};\r
* Let this token execute itself on the given stack,\r
* possibly adding Nodes to the node list.\r
*/\r
- virtual bool execute(Stack &stack, NodeList &list)\r
+ virtual bool execute(Stack &stack)\r
{ return true; }\r
\r
/**\r
stype = "str";\r
sval = val;\r
}\r
- virtual bool execute(Stack &stack, NodeList &list)\r
+ virtual bool execute(Stack &stack)\r
{\r
StackItem item;\r
item.sval = sval;\r
stype = "float";\r
dval = val;\r
}\r
- virtual bool execute(Stack &stack, NodeList &list)\r
+ virtual bool execute(Stack &stack)\r
{\r
StackItem item;\r
item.dval = dval;\r
stype = "int";\r
ival = val;\r
}\r
- virtual bool execute(Stack &stack, NodeList &list)\r
+ virtual bool execute(Stack &stack)\r
{\r
StackItem item;\r
item.ival = ival;\r
type = TOK_AND;\r
stype = "and";\r
}\r
- virtual bool execute(Stack &stack, NodeList &list)\r
+ virtual bool execute(Stack &stack)\r
{\r
StackItem item1 = stack.pop();\r
StackItem item2 = stack.pop();\r
type = TOK_OR;\r
stype = "or";\r
}\r
- virtual bool execute(Stack &stack, NodeList &list)\r
+ virtual bool execute(Stack &stack)\r
{\r
StackItem item1 = stack.pop();\r
StackItem item2 = stack.pop();\r
type = TOK_MOD;\r
stype = "mod";\r
}\r
- virtual bool execute(Stack &stack, NodeList &list)\r
+ virtual bool execute(Stack &stack)\r
{\r
StackItem item1 = stack.pop();\r
StackItem item2 = stack.pop();\r
type = TOK_DIV;\r
stype = "div";\r
}\r
- virtual bool execute(Stack &stack, NodeList &list)\r
+ virtual bool execute(Stack &stack)\r
{\r
StackItem item1 = stack.pop();\r
StackItem item2 = stack.pop();\r
type = TOK_MULTIPLY;\r
stype = "mul";\r
}\r
- virtual bool execute(Stack &stack, NodeList &list)\r
+ virtual bool execute(Stack &stack)\r
{\r
StackItem item1 = stack.pop();\r
StackItem item2 = stack.pop();\r
type = TOK_PLUS;\r
stype = "plus";\r
}\r
- virtual bool execute(Stack &stack, NodeList &list)\r
+ virtual bool execute(Stack &stack)\r
{\r
StackItem item1 = stack.pop();\r
StackItem item2 = stack.pop();\r
type = TOK_MINUS;\r
stype = "minus";\r
}\r
- virtual bool execute(Stack &stack, NodeList &list)\r
+ virtual bool execute(Stack &stack)\r
{\r
StackItem item1 = stack.pop();\r
StackItem item2 = stack.pop();\r
type = TOK_NEG;\r
stype = "neg";\r
}\r
- virtual bool execute(Stack &stack, NodeList &list)\r
+ virtual bool execute(Stack &stack)\r
{\r
StackItem item;\r
item.dval = -dval;\r
type = TOK_EQUALS;\r
stype = "equals";\r
}\r
- virtual bool execute(Stack &stack, NodeList &list)\r
+ virtual bool execute(Stack &stack)\r
{\r
StackItem item1 = stack.pop();\r
StackItem item2 = stack.pop();\r
type = TOK_NOT_EQUALS;\r
stype = "neq";\r
}\r
- virtual bool execute(Stack &stack, NodeList &list)\r
+ virtual bool execute(Stack &stack)\r
{\r
StackItem item1 = stack.pop();\r
StackItem item2 = stack.pop();\r
type = TOK_LESS_THAN_EQUALS;\r
stype = "lt_eq";\r
}\r
- virtual bool execute(Stack &stack, NodeList &list)\r
+ virtual bool execute(Stack &stack)\r
{\r
StackItem item1 = stack.pop();\r
StackItem item2 = stack.pop();\r
type = TOK_LESS_THAN;\r
stype = "lt";\r
}\r
- virtual bool execute(Stack &stack, NodeList &list)\r
+ virtual bool execute(Stack &stack)\r
{\r
StackItem item1 = stack.pop();\r
StackItem item2 = stack.pop();\r
type = TOK_GREATER_THAN_EQUALS;\r
stype = "gt";\r
}\r
- virtual bool execute(Stack &stack, NodeList &list)\r
+ virtual bool execute(Stack &stack)\r
{\r
StackItem item1 = stack.pop();\r
StackItem item2 = stack.pop();\r
type = TOK_GREATER_THAN;\r
stype = "gt_eq";\r
}\r
- virtual bool execute(Stack &stack, NodeList &list)\r
+ virtual bool execute(Stack &stack)\r
{\r
StackItem item1 = stack.pop();\r
StackItem item2 = stack.pop();\r
type = TOK_ABSOLUTE;\r
stype = "absolute";\r
}\r
- virtual bool execute(Stack &stack, NodeList &list)\r
+ virtual bool execute(Stack &stack)\r
{\r
return true;\r
}\r
type = TOK_RELATIVE;\r
stype = "relative";\r
}\r
- virtual bool execute(Stack &stack, NodeList &list)\r
+ virtual bool execute(Stack &stack)\r
{\r
return true;\r
}\r
type = TOK_STEP;\r
stype = "step";\r
}\r
- virtual bool execute(Stack &stack, NodeList &list)\r
+ virtual bool execute(Stack &stack)\r
{\r
return true;\r
}\r
type = TOK_EXPR;\r
stype = "token";\r
}\r
- virtual bool execute(Stack &stack, NodeList &list)\r
+ virtual bool execute(Stack &stack)\r
{\r
return true;\r
}\r
type = TOK_UNION;\r
stype = "union";\r
}\r
- virtual bool execute(Stack &stack, NodeList &list)\r
+ virtual bool execute(Stack &stack)\r
{\r
return true;\r
}\r
type = TOK_POSITION;\r
stype = "position";\r
}\r
- virtual bool execute(Stack &stack, NodeList &list)\r
+ virtual bool execute(Stack &stack)\r
{\r
return true;\r
}\r