[gxml/newattr] BackedNode.vala: add internal function set_xmlnode, mostly so we can replace the xmlNode a GXmlNode



commit 23bf4845761df5887f9932f4b6cca03e7d8a87e0
Author: Richard Schwarting <aquarichy gmail com>
Date:   Wed Oct 23 02:56:35 2013 -0400

    BackedNode.vala: add internal function set_xmlnode, mostly so we can replace the xmlNode a GXmlNode 
points to in the case of GXmlAttrs when we're manipualting them through our GXmlNamedAttrMap (which is how 
Elements handle them, through that)

 gxml/BackedNode.vala |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gxml/BackedNode.vala b/gxml/BackedNode.vala
index 4d5cfd6..e7ce9d9 100644
--- a/gxml/BackedNode.vala
+++ b/gxml/BackedNode.vala
@@ -37,14 +37,17 @@ namespace GXml {
                /** Private properties */
                internal Xml.Node *node;
 
+               internal void set_xmlnode (Xml.Node *node, Document owner) {
+                       this.node = node;
+                       owner.node_dict.insert (node, this);
+               }
+
                /** Constructors */
                internal BackedNode (Xml.Node *node, Document owner) {
                        base ((NodeType)node->type, owner);
-                       // Considered using node->doc instead, but some subclasses don't have corresponding 
Xml.Nodes
-                       this.node = node;
 
                        // Save the correspondence between this Xml.Node* and its Node
-                       owner.node_dict.insert (node, this);
+                       this.set_xmlnode (node, owner);
                        // TODO: Consider checking whether the Xml.Node* is already recorded.  It shouldn't 
be.
                        // TODO: BackedNodes' memory are freed when their owner document is freed; let's make 
sure that when we move a node between documents, that we make sure they'll still be freed
                }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]