[gxml] Added GXml.Comment interface



commit 187688a78dfe3bf883ad80becd6ab9f54238d13d
Author: Daniel Espinosa <esodan gmail com>
Date:   Mon May 4 11:59:00 2015 -0500

    Added GXml.Comment interface
    
    * Moved old libxml-Comment to xComment

 gxml/Makefile.am          |    3 ++-
 gxml/libxml-Comment.vala  |    6 ++++--
 gxml/libxml-Document.vala |    8 ++++----
 test/DocumentTest.vala    |    2 +-
 4 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/gxml/Makefile.am b/gxml/Makefile.am
index a543651..d98f0d0 100644
--- a/gxml/Makefile.am
+++ b/gxml/Makefile.am
@@ -14,8 +14,9 @@ lib_LTLIBRARIES = libgxml-0.6.la
 sources = \
        namespace-info.vala \
        Attribute.vala \
-       Element.vala \
+       Comment.vala\
        Document.vala \
+       Element.vala \
        Namespace.vala \
        Node.vala \
        Text.vala \
diff --git a/gxml/libxml-Comment.vala b/gxml/libxml-Comment.vala
index 6a9eb8e..bf620ba 100644
--- a/gxml/libxml-Comment.vala
+++ b/gxml/libxml-Comment.vala
@@ -41,9 +41,9 @@
  *
  * For more, see: [[http://www.w3.org/TR/DOM-Level-1/level-one-core.html#ID-1728279322]]
  */
-public class GXml.Comment : GXml.CharacterData {
+public class GXml.xComment : GXml.CharacterData, GXml.Comment {
        // TODO: Can I make this only accessible from within the GXml.Dom namespace (e.g. from 
GXml.Dom.xDocument?)
-       internal Comment (Xml.Node *comment_node, xDocument doc) {
+       internal xComment (Xml.Node *comment_node, xDocument doc) {
                base (comment_node, doc);
        }
        public override string node_name {
@@ -53,5 +53,7 @@ public class GXml.Comment : GXml.CharacterData {
                private set {
                }
        }
+       // GXml.Comment interface
+       public string str { get { return this.data; } }
 
 }
diff --git a/gxml/libxml-Document.vala b/gxml/libxml-Document.vala
index 77f171e..86cb353 100644
--- a/gxml/libxml-Document.vala
+++ b/gxml/libxml-Document.vala
@@ -119,7 +119,7 @@ namespace GXml {
                                        new CDATASection (xmlnode, this);
                                        break;
                                case NodeType.COMMENT:
-                                       new Comment (xmlnode, this);
+                                       new xComment (xmlnode, this);
                                        break;
                                case NodeType.DOCUMENT_FRAGMENT:
                                        new DocumentFragment (xmlnode, this);
@@ -676,10 +676,10 @@ namespace GXml {
                 * @return A new { link GXml.Comment} containing the
                 * supplied data; this should not be freed
                 */
-               public unowned Comment create_comment (string comment_data) {
+               public unowned xComment create_comment (string comment_data) {
                        // TODO: should we be passing around Xml.Node* like this?
-                       Comment comment = new Comment (this.xmldoc->new_comment (comment_data), this);
-                       unowned Comment ret = comment;
+                       xComment comment = new xComment (this.xmldoc->new_comment (comment_data), this);
+                       unowned xComment ret = comment;
                        this.nodes_to_free.append (comment);
                        return ret;
                }
diff --git a/test/DocumentTest.vala b/test/DocumentTest.vala
index e2bd0f7..487129b 100644
--- a/test/DocumentTest.vala
+++ b/test/DocumentTest.vala
@@ -323,7 +323,7 @@ class DocumentTest : GXmlTest {
                        });
                Test.add_func ("/gxml/document/create_comment", () => {
                                xDocument doc = get_doc ();
-                               Comment comment = doc.create_comment ("Ever since the day we promised.");
+                               xComment comment = doc.create_comment ("Ever since the day we promised.");
 
                                assert (comment.node_name == "#comment");
                                assert (comment.node_value == "Ever since the day we promised.");


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