[gxml] Document.vala: document copy_node ()



commit c8b96a3990d4b581c50780d51f4be85996bba397
Author: Richard Schwarting <aquarichy gmail com>
Date:   Mon Nov 18 11:27:34 2013 -0500

    Document.vala: document copy_node ()

 gxml/Document.vala |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/gxml/Document.vala b/gxml/Document.vala
index e76569a..3f048bf 100644
--- a/gxml/Document.vala
+++ b/gxml/Document.vala
@@ -1007,10 +1007,20 @@ namespace GXml {
                        return (xmldoc->children != null);
                }
 
+               /**
+                * This is used to create a copy of a node.  The node
+                * can come from another document but the copy will
+                * belong to this one.  The copied node is owned by
+                * this document which will manage its memory.
+                *
+                * @param foreign_node A node from another document.
+                * @param deep Whether to clone its descendants
+                *
+                * @return An unowned reference to the copied node; this should not be freed
+                */
                internal unowned Node copy_node (Node foreign_node, bool deep = true) {
                        Xml.Node *our_copy_xml = ((BackedNode)foreign_node).node->doc_copy (this.xmldoc, deep 
? 1 : 0);
-                       // TODO: do we need to append this to this.new_nodes?  Do we need to append the 
result to this.nodes_to_free?  Test memory implications
-                       return this.lookup_node (our_copy_xml); // inducing a GXmlNode
+                       return this.lookup_node (our_copy_xml); // inducing a GXmlNode for the xmlNode*
                }
        }
 }


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