Code

interim cleanup commit
authorishmal <ishmal@users.sourceforge.net>
Thu, 27 Apr 2006 09:53:08 +0000 (09:53 +0000)
committerishmal <ishmal@users.sourceforge.net>
Thu, 27 Apr 2006 09:53:08 +0000 (09:53 +0000)
src/dom/dom.h
src/dom/domimpl.cpp
src/dom/domimpl.h
src/dom/xpathparser.cpp
src/dom/xpathparser.h
src/dom/xpathtoken.cpp
src/dom/xpathtoken.h

index 4117f91b70a977eefcc450b767595c14231edd45..ab82c429819a95d7f555d3c1ce50e940df9b4426 100644 (file)
@@ -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;
+        }
+
 
     /**
      *
index e9da6291fb3dadec082bb97ef7b639c2b90f47e1..644c6567c37a7330437c8306c9dda0d94428a0d0 100644 (file)
@@ -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;
+}
 
 
 /**
index 677f5eb8cd63ec705bd30ff7b1d28bb0788d3eb8..bbd1693ef8dd574266465f1c268f9b29a710370a 100644 (file)
@@ -440,6 +440,16 @@ public:
      */
     NodeImpl();
 
+    /**
+     *
+     */
+    NodeImpl(const NodeImpl &other);
+
+    /**
+     *
+     */
+    NodeImpl &operator=(const NodeImpl &other);
+
     /**
      *
      */
index f3c57f6f51bbfbc50eb72bd09c18d18789de27f9..18d62d40a36bcd345d9b184ebbdfc20a021cefbf 100644 (file)
@@ -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\r
 //#########################################################################\r
 \r
+\r
+void XPathParser::tokAdd(Token *tok)\r
+{\r
+    tokens.add(tok);\r
+}\r
+\r
 /**\r
  * [1]  LocationPath ::=\r
  *        RelativeLocationPath\r
@@ -873,7 +879,7 @@ int XPathParser::getNodeTest(int p0, int depth)
     if (t.getType() == NAME_TEST)\r
         {\r
         p++;\r
-        printf("xxx\n");\r
+        tokAdd(new TokNameTest(t.getStringValue()));\r
         return p;\r
         }\r
     if (t.getType() == NODE_TYPE)\r
index 32127f89b0411dae90588a1958556fd8d97aa856..4b4e79fcc78ced0acf3a54e81b9814bca6becbfc 100644 (file)
@@ -512,6 +512,11 @@ private:
     //# GRAMMAR  PARSING\r
     //#################################\r
 \r
+    /**\r
+     * Add a newly derived token to the token list;\r
+     */\r
+    void tokAdd(Token *token);\r
+\r
     /**\r
      * The grammar definitions marked [1]-[39] are directly\r
      * from the W3C XPath grammar spacification.\r
index 0254266d0a4c1271c1fb21f961a4adf915e0dc3e..bed02294333e2d6144caa3fa13e05e5325e483e0 100644 (file)
@@ -62,9 +62,7 @@ StackItem::StackItem()
  */\r
 StackItem::StackItem(const StackItem &other)\r
 {\r
-    sval = other.sval;\r
-    ival = other.ival;\r
-    dval = other.dval;\r
+    assign(other);\r
 }\r
 \r
 \r
@@ -76,6 +74,26 @@ StackItem::~StackItem()
 }\r
 \r
 \r
+/**\r
+ *\r
+ */\r
+StackItem &StackItem::operator=(const StackItem &other)\r
+{\r
+    assign(other);\r
+    return *this;\r
+}\r
+\r
+/**\r
+ *\r
+ */\r
+void StackItem::assign(const StackItem &other)\r
+{\r
+    sval = other.sval;\r
+    ival = other.ival;\r
+    dval = other.dval;\r
+}\r
+\r
+\r
 //########################################################################\r
 //# X P A T H    S T A C K\r
 //########################################################################\r
@@ -188,6 +206,31 @@ TokenList::TokenList()
 }\r
 \r
 \r
+/**\r
+ *\r
+ */\r
+TokenList::TokenList(const TokenList &other)\r
+{\r
+    assign(other);\r
+}\r
+\r
+/**\r
+ *\r
+ */\r
+TokenList &TokenList::operator=(const TokenList &other)\r
+{\r
+    assign(other);\r
+    return *this;\r
+}\r
+\r
+/**\r
+ *\r
+ */\r
+void TokenList::assign(const TokenList &other)\r
+{\r
+    tokens = other.tokens;\r
+}\r
+\r
 /**\r
  *\r
  */\r
index 9b9259e06c5a2f5eae075d49d43c363010c2235e..f551bee3c193ff81d864c52841a4be6e169512f5 100644 (file)
@@ -70,6 +70,17 @@ public:
      */\r
     virtual ~StackItem();\r
 \r
+    /**\r
+     *\r
+     */\r
+    StackItem &operator=(const StackItem &other);\r
+\r
+    /**\r
+     *\r
+     */\r
+    void assign(const StackItem &other);\r
+\r
+\r
     //treat the stack item like an union of string, integer, and double\r
 \r
     /**\r
@@ -200,6 +211,7 @@ public:
         TOK_ABSOLUTE,\r
         TOK_RELATIVE,\r
         TOK_STEP,\r
+        TOK_NAME_TEST,\r
         TOK_EXPR,\r
         TOK_UNION,\r
         //function types\r
@@ -653,6 +665,21 @@ public:
         }\r
 };\r
 \r
+class TokNameTest : public Token\r
+{\r
+public:\r
+    TokNameTest(const DOMString &name)\r
+        {\r
+        type  = TOK_NAME_TEST;\r
+        stype = "step";\r
+        sval  = name;\r
+        }\r
+    virtual bool execute(Stack &stack)\r
+        {\r
+        return true;\r
+        }\r
+};\r
+\r
 class TokExpr : public Token\r
 {\r
 public:\r
@@ -719,6 +746,21 @@ public:
      */\r
     TokenList();\r
 \r
+    /**\r
+     *\r
+     */\r
+    TokenList(const TokenList &other);\r
+\r
+    /**\r
+     *\r
+     */\r
+    TokenList &operator=(const TokenList &other);\r
+\r
+    /**\r
+     *\r
+     */\r
+    void assign(const TokenList &other);\r
+\r
     /**\r
      *\r
      */\r