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



commit 2ea11338a60474900b6a7bd751ea7b3744c2d4d0
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 fcc6a6c..b97d1a3 100644
--- a/gxml/Document.vala
+++ b/gxml/Document.vala
@@ -638,11 +638,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);
@@ -695,7 +690,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 a3ada7c..0491f28 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]