[gxml] Document.vala, DomNode.vala: move check_read_only to DomNode, so all its descendents can call it



commit cf62243a96383af02de14eeaa8c598d8fffd98be
Author: Richard Schwarting <aquarichy gmail com>
Date:   Sat Jul 27 00:01:54 2013 -0400

    Document.vala, DomNode.vala: move check_read_only to DomNode, so all its descendents can call it

 gxml/Document.vala |    7 +------
 gxml/DomNode.vala  |    8 ++++++++
 2 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/gxml/Document.vala b/gxml/Document.vala
index e7446df..e8dbbfb 100644
--- a/gxml/Document.vala
+++ b/gxml/Document.vala
@@ -609,11 +609,6 @@ namespace GXml {
                        return this.document_element.get_elements_by_tag_name (tag_name);
                }
 
-               private bool check_read_only (DomNode node) {
-                       // TODO: introduce a concept of read-only-ness, perhaps
-                       return false;
-               }
-
                private void check_wrong_document (DomNode node) {
                        if (node.owner_document != this) {
                                GLib.warning ("WRONG_DOCUMENT_ERR: Node tried to interact with this document 
'%p' but belonged to document '%p'", this, node.owner_document);
@@ -666,7 +661,7 @@ namespace GXml {
                 */
                public override DomNode? append_child (DomNode new_child) {
                        check_wrong_document (new_child);
-                       check_read_only (this);
+                       this.check_read_only ();
 
                        if (new_child.node_type == NodeType.ELEMENT) {
                                if (xmldoc->get_root_element () == null) {
diff --git a/gxml/DomNode.vala b/gxml/DomNode.vala
index a2eb62b..53670a5 100644
--- a/gxml/DomNode.vala
+++ b/gxml/DomNode.vala
@@ -47,6 +47,14 @@ namespace GXml {
                }
 
                /* Utility methods */
+
+               internal bool check_read_only () {
+                       // TODO: introduce a concept of read-only-ness, perhaps
+                       // if read-only, raise NO_MODIFICATION_ALLOWED_ERR
+                       return false;
+               }
+
+
                public void dbg_inspect () {
                        message ("node: %s", this.node_name);
                        message ("  ns (prefix: %s, uri: %s)", this.prefix, this.namespace_uri);


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