From dc81b746cf1305802b07f367a44e518d9036a2d6 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 2 May 2006 05:29:03 +0000 Subject: (bzr r690) --- src/dom/xpathtoken.cpp | 120 ++++++++++++++++++++++--------------------------- 1 file changed, 53 insertions(+), 67 deletions(-) (limited to 'src/dom/xpathtoken.cpp') diff --git a/src/dom/xpathtoken.cpp b/src/dom/xpathtoken.cpp index c9d4898d7..2d5dfc1d7 100644 --- a/src/dom/xpathtoken.cpp +++ b/src/dom/xpathtoken.cpp @@ -131,12 +131,12 @@ static TokenStringPair tokenStrings[] = /** - * Return the string TokenType of this token + * Return the enumerated TokenType of this token * (in the .cpp file) */ DOMString Token::getTypeString() { - DOMString ret = "unknown"; + DOMString ret; for (TokenStringPair *pair = tokenStrings ; pair->sval ; pair++) { if (pair->ival == type) @@ -148,8 +148,6 @@ DOMString Token::getTypeString() return ret; } - - //######################################################################## //# X P A T H A X I S //######################################################################## @@ -168,8 +166,7 @@ Axis::Axis() */ Axis::Axis(int tokPos) { - init(); - tokenPosition = tokPos; + assign(other); } @@ -186,15 +183,7 @@ Axis::Axis(const Axis &other) /** * */ -Axis::~Axis() -{ -} - - -/** - * - */ -Axis &Axis::operator=(const Axis &other) +StackItem &StackItem::operator=(const StackItem &other) { assign(other); return *this; @@ -203,82 +192,72 @@ Axis &Axis::operator=(const Axis &other) /** * */ -void Axis::init() +void StackItem::assign(const StackItem &other) { - tokenPosition = 0; + sval = other.sval; + ival = other.ival; + dval = other.dval; } -/** - * - */ -void Axis::assign(const Axis &other) -{ - tokenPosition = other.tokenPosition; -} -/** - * - */ -void Axis::setPosition(unsigned int val) -{ - tokenPosition = val; -} +//######################################################################## +//# X P A T H S T A C K I T E M +//######################################################################## /** * */ -unsigned int Axis::getPosition() +StackItem::StackItem() { - return tokenPosition; + ival = 0L; + dval = 0.0; } -/** - * - */ -void Axis::setNode(const Node *val) -{ - node = (Node *)val; -} /** * */ -Node *Axis::getNode() +StackItem::StackItem(const StackItem &other) { - return node; + assign(other); } -//######################################################################## -//# X P A T H S T A C K I T E M -//######################################################################## /** * */ -StackItem::StackItem() +Stack::~Stack() { - ival = 0L; - dval = 0.0; } /** * */ -StackItem::StackItem(const StackItem &other) +void Stack::assign(const Stack &other) { - assign(other); + root = other.root; + nodeList = other.nodeList; + size = other.size; + for (int i=0 ; i::iterator iter; printf("############# TOKENS\n"); for (iter = tokens.begin() ; iter != tokens.end() ; iter++) { Token *tok = *iter; - tok->dump(); + tok->execute(stack); } } + list = stack.getNodeList(); -//######################################################################## -//# X P A T H E X E C U T O R -//######################################################################## - -/** - * - */ -TokenExecutor::TokenExecutor() -{ - reset(); + return list; } -- cgit v1.2.3