From: ishmal Date: Thu, 27 Apr 2006 09:53:08 +0000 (+0000) Subject: interim cleanup commit X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0ab29e0c5adac39aa544c2c07ade5526e404105e;p=inkscape.git interim cleanup commit --- diff --git a/src/dom/dom.h b/src/dom/dom.h index 4117f91b7..ab82c4298 100644 --- a/src/dom/dom.h +++ b/src/dom/dom.h @@ -259,6 +259,15 @@ public: strings = other.strings; } + /** + * + */ + DOMStringList &operator=(const DOMStringList &other) + { + strings = other.strings; + return *this; + } + /** * */ @@ -297,6 +306,12 @@ public: namespaceURI = other.namespaceURI; name = other.name; } + NamePair &operator=(const NamePair &other) + { + namespaceURI = other.namespaceURI; + name = other.name; + return *this; + } virtual ~NamePair() {} DOMString namespaceURI; @@ -382,6 +397,15 @@ public: namePairs = other.namePairs; } + /** + * + */ + NameList &operator=(const NameList &other) + { + namePairs = other.namePairs; + return *this; + } + /** * */ @@ -439,6 +463,15 @@ public: implementations = other.implementations; } + /** + * + */ + DOMImplementationList &operator=(const DOMImplementationList &other) + { + implementations = other.implementations; + return *this; + } + /** * */ @@ -888,13 +921,22 @@ public: } NamedNodeMapEntry(const NamedNodeMapEntry &other) { - namespaceURI = other.namespaceURI; - name = other.name; - node = other.node; + assign(other); + } + NamedNodeMapEntry &operator=(const NamedNodeMapEntry &other) + { + assign(other); + return *this; } virtual ~NamedNodeMapEntry() { } + void assign(const NamedNodeMapEntry &other) + { + namespaceURI = other.namespaceURI; + name = other.name; + node = other.node; + } DOMString namespaceURI; DOMString name; Node *node; @@ -1065,6 +1107,15 @@ public: entries = other.entries; } + /** + * + */ + NamedNodeMap &operator=(const NamedNodeMap &other) + { + entries = other.entries; + return *this; + } + /** * diff --git a/src/dom/domimpl.cpp b/src/dom/domimpl.cpp index e9da6291f..644c6567c 100644 --- a/src/dom/domimpl.cpp +++ b/src/dom/domimpl.cpp @@ -933,6 +933,24 @@ NodeImpl::NodeImpl() } +/** + * + */ +NodeImpl::NodeImpl(const NodeImpl &other) +{ + init(); + assign(other); +} + +/** + * + */ +NodeImpl &NodeImpl::operator=(const NodeImpl &other) +{ + init(); + assign(other); + return *this; +} /** diff --git a/src/dom/domimpl.h b/src/dom/domimpl.h index 677f5eb8c..bbd1693ef 100644 --- a/src/dom/domimpl.h +++ b/src/dom/domimpl.h @@ -440,6 +440,16 @@ public: */ NodeImpl(); + /** + * + */ + NodeImpl(const NodeImpl &other); + + /** + * + */ + NodeImpl &operator=(const NodeImpl &other); + /** * */ diff --git a/src/dom/xpathparser.cpp b/src/dom/xpathparser.cpp index f3c57f6f5..18d62d40a 100644 --- a/src/dom/xpathparser.cpp +++ b/src/dom/xpathparser.cpp @@ -618,6 +618,12 @@ int XPathParser::lexicalScan() //# X P A T H G R A M M A R P A R S I N G //######################################################################### + +void XPathParser::tokAdd(Token *tok) +{ + tokens.add(tok); +} + /** * [1] LocationPath ::= * RelativeLocationPath @@ -873,7 +879,7 @@ int XPathParser::getNodeTest(int p0, int depth) if (t.getType() == NAME_TEST) { p++; - printf("xxx\n"); + tokAdd(new TokNameTest(t.getStringValue())); return p; } if (t.getType() == NODE_TYPE) diff --git a/src/dom/xpathparser.h b/src/dom/xpathparser.h index 32127f89b..4b4e79fcc 100644 --- a/src/dom/xpathparser.h +++ b/src/dom/xpathparser.h @@ -512,6 +512,11 @@ private: //# GRAMMAR PARSING //################################# + /** + * Add a newly derived token to the token list; + */ + void tokAdd(Token *token); + /** * The grammar definitions marked [1]-[39] are directly * from the W3C XPath grammar spacification. diff --git a/src/dom/xpathtoken.cpp b/src/dom/xpathtoken.cpp index 0254266d0..bed022943 100644 --- a/src/dom/xpathtoken.cpp +++ b/src/dom/xpathtoken.cpp @@ -62,9 +62,7 @@ StackItem::StackItem() */ StackItem::StackItem(const StackItem &other) { - sval = other.sval; - ival = other.ival; - dval = other.dval; + assign(other); } @@ -76,6 +74,26 @@ StackItem::~StackItem() } +/** + * + */ +StackItem &StackItem::operator=(const StackItem &other) +{ + assign(other); + return *this; +} + +/** + * + */ +void StackItem::assign(const StackItem &other) +{ + sval = other.sval; + ival = other.ival; + dval = other.dval; +} + + //######################################################################## //# X P A T H S T A C K //######################################################################## @@ -188,6 +206,31 @@ TokenList::TokenList() } +/** + * + */ +TokenList::TokenList(const TokenList &other) +{ + assign(other); +} + +/** + * + */ +TokenList &TokenList::operator=(const TokenList &other) +{ + assign(other); + return *this; +} + +/** + * + */ +void TokenList::assign(const TokenList &other) +{ + tokens = other.tokens; +} + /** * */ diff --git a/src/dom/xpathtoken.h b/src/dom/xpathtoken.h index 9b9259e06..f551bee3c 100644 --- a/src/dom/xpathtoken.h +++ b/src/dom/xpathtoken.h @@ -70,6 +70,17 @@ public: */ virtual ~StackItem(); + /** + * + */ + StackItem &operator=(const StackItem &other); + + /** + * + */ + void assign(const StackItem &other); + + //treat the stack item like an union of string, integer, and double /** @@ -200,6 +211,7 @@ public: TOK_ABSOLUTE, TOK_RELATIVE, TOK_STEP, + TOK_NAME_TEST, TOK_EXPR, TOK_UNION, //function types @@ -653,6 +665,21 @@ public: } }; +class TokNameTest : public Token +{ +public: + TokNameTest(const DOMString &name) + { + type = TOK_NAME_TEST; + stype = "step"; + sval = name; + } + virtual bool execute(Stack &stack) + { + return true; + } +}; + class TokExpr : public Token { public: @@ -719,6 +746,21 @@ public: */ TokenList(); + /** + * + */ + TokenList(const TokenList &other); + + /** + * + */ + TokenList &operator=(const TokenList &other); + + /** + * + */ + void assign(const TokenList &other); + /** * */