[gxml] Node, Document and Element interfaces have implementations



commit 2a7c0c5a19bfbe961e2569e334c4935d1f0cc5e6
Author: Daniel Espinosa <esodan gmail com>
Date:   Wed Apr 15 18:05:50 2015 -0500

    Node, Document and Element interfaces have implementations
    
    * xNode implements GXml.Node interface
    * xDocument implements GXml.Document interface
    * xElement implements GXml.Element interface

 gxml/Document.vala        |    2 +-
 gxml/Node.vala            |    1 -
 gxml/libxml-Document.vala |    4 ++--
 gxml/libxml-Element.vala  |    2 +-
 gxml/libxml-Node.vala     |    5 ++---
 5 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/gxml/Document.vala b/gxml/Document.vala
index 9d841c5..22ce14c 100644
--- a/gxml/Document.vala
+++ b/gxml/Document.vala
@@ -24,6 +24,6 @@ using Gee;
 
 public interface GXml.Document : Object, GXml.Node
 {
-  public abstract GXml.Node root { get; set; }
+  public abstract GXml.Node root { get; }
   public abstract GLib.File file { get; set; }
 }
diff --git a/gxml/Node.vala b/gxml/Node.vala
index c045988..45b4442 100644
--- a/gxml/Node.vala
+++ b/gxml/Node.vala
@@ -31,7 +31,6 @@ public interface GXml.Node : Object
   public abstract string @value { get; set; }
   public abstract GXml.NodeType type_node { get; }
   public abstract GXml.Document document { get; }
-  public abstract GXml.Node copy (ref GXml.Node node, bool deep);
   public abstract string to_string ();
   public virtual string ns_prefix () { return namespaces.first ().prefix; }
   public virtual string ns_urf () { return namespaces.first ().uri; }
diff --git a/gxml/libxml-Document.vala b/gxml/libxml-Document.vala
index bc4afbc..44dec78 100644
--- a/gxml/libxml-Document.vala
+++ b/gxml/libxml-Document.vala
@@ -56,7 +56,7 @@ namespace GXml {
         * Version: DOM Level 1 Core<<BR>>
         * URL: [[http://www.w3.org/TR/DOM-Level-1/level-one-core.html#i-xDocument]]
         */
-       public class xDocument : xNode {
+       public class xDocument : xNode, GXml.Document {
                /* *** Private properties *** */
 
                /**
@@ -1011,8 +1011,8 @@ namespace GXml {
                }
                // GXml.Document interface
                public GLib.File file { get; set; }
+               public virtual GXml.Node root { get { return document_element; } }
                /*
-               public abstract GXml.Node root { get; set; }
                */
        }
 }
diff --git a/gxml/libxml-Element.vala b/gxml/libxml-Element.vala
index b84c3d9..7e47362 100644
--- a/gxml/libxml-Element.vala
+++ b/gxml/libxml-Element.vala
@@ -41,7 +41,7 @@ namespace GXml {
         * Version: DOM Level 1 Core<<BR>>
         * URL: [[http://www.w3.org/TR/DOM-Level-1/level-one-core.html#ID-745549614]]
         */
-       public class xElement : BackedNode {
+       public class xElement : BackedNode, GXml.Element {
                /* Public properties */
 
                // TODO: find out how to do double-spaces in Valadoc, so we can indent <img...
diff --git a/gxml/libxml-Node.vala b/gxml/libxml-Node.vala
index a4b4c89..026179d 100644
--- a/gxml/libxml-Node.vala
+++ b/gxml/libxml-Node.vala
@@ -37,7 +37,7 @@ namespace GXml {
         * Version: DOM Level 1 Core<<BR>>
         * URL: [[http://www.w3.org/TR/DOM-Level-1/level-one-core.html#ID-1950641247]]
         */
-       public abstract class xNode : GLib.Object {
+       public abstract class xNode : GLib.Object, GXml.Node {
                protected NodeList _child_nodes;
                protected Gee.Map<string,xNode> _attributes = new Gee.HashMap<string,xNode> ();
                internal NamespaceAttrNodeList _namespace_definitions = null;
@@ -509,6 +509,7 @@ namespace GXml {
                public virtual string @value { get { return node_value; } set { node_value = value; } }
                public GXml.NodeType type_node { get { return node_type; } }
                public virtual string to_string () { return stringify (); }
+               public GXml.Document document { get { return this.owner_document; } }
                /**
                 * Creates a copy of node's definition to @node.
                 *
@@ -518,7 +519,5 @@ namespace GXml {
                public virtual bool copy (ref xNode node, bool deep = false) { // TODO: Change to GXml.Node
                        return false;
                }
-               /*
-               public GXml.Document document { get; construct set; }*/
        }
 }


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