[gxml] Renamed Attr to xAttr



commit 92cf888e2d90b545ec5ff0841c6d0a6e9d3c6a24
Author: Daniel Espinosa <esodan gmail com>
Date:   Tue May 12 12:08:08 2015 -0500

    Renamed Attr to xAttr

 gxml/libxml-Attr.vala         |    4 +-
 gxml/libxml-Document.vala     |   10 ++++----
 gxml/libxml-Element.vala      |   10 ++++----
 gxml/libxml-NamedAttrMap.vala |   18 ++++++++--------
 test/AttrTest.vala            |   42 ++++++++++++++++++++--------------------
 test/DocumentTest.vala        |    4 +-
 test/ElementTest.vala         |    8 +++---
 test/GXmlTest.vala            |    4 +-
 test/NodeTest.vala            |    6 ++--
 9 files changed, 53 insertions(+), 53 deletions(-)
---
diff --git a/gxml/libxml-Attr.vala b/gxml/libxml-Attr.vala
index 19d1210..bdb4b1b 100644
--- a/gxml/libxml-Attr.vala
+++ b/gxml/libxml-Attr.vala
@@ -55,14 +55,14 @@ namespace GXml {
         *
         * @see GXml.Node
         */
-       public class Attr : BackedNode, GXml.Attribute {
+       public class xAttr : BackedNode, GXml.Attribute {
                /** Private properties */
                /* this displaces BackedNode's xmlNode node */
                internal new Xml.Attr *node;
                internal AttrChildNodeList _attr_list;
 
                /** Constructors */
-               internal Attr (Xml.Attr *node, xDocument doc) {
+               internal xAttr (Xml.Attr *node, xDocument doc) {
                        // TODO: wish valac would warn against using this. before calling base()
                        //base (NodeType.ATTRIBUTE, doc);
                        base ((Xml.Node*)node, doc);
diff --git a/gxml/libxml-Document.vala b/gxml/libxml-Document.vala
index 3fb705e..2aabb73 100644
--- a/gxml/libxml-Document.vala
+++ b/gxml/libxml-Document.vala
@@ -91,9 +91,9 @@ namespace GXml {
                internal NodeChildNodeList _node_list;
 
                /* *** Private methods *** */
-               internal unowned Attr? lookup_attr (Xml.Attr *xmlattr) {
+               internal unowned xAttr? lookup_attr (Xml.Attr *xmlattr) {
                        // Xml.Attr and Xml.Node are intentionally compatible
-                       return (Attr)this.lookup_node ((Xml.Node*)xmlattr);
+                       return (xAttr)this.lookup_node ((Xml.Node*)xmlattr);
                }
 
                internal unowned xNode? lookup_node (Xml.Node *xmlnode) {
@@ -125,7 +125,7 @@ namespace GXml {
                                        new DocumentFragment (xmlnode, this);
                                        break;
                                case NodeType.ATTRIBUTE:
-                                       new Attr ((Xml.Attr*)xmlnode, this);
+                                       new xAttr ((Xml.Attr*)xmlnode, this);
                                        break;
                                        /* TODO: These are not yet implemented (but we won't support 
xDocument */
                                case NodeType.ENTITY_REFERENCE:
@@ -771,7 +771,7 @@ namespace GXml {
                 *
                 * @return A new { link GXml.Attr} with the given `name`; this should not be freed
                 */
-               public Attr create_attribute (string name) {
+               public xAttr create_attribute (string name) {
                        /* TODO: figure out memory for this; its a
                         * Node, not a BackedNode and thus not in
                         * nodedict.  It's like Processing Instruction
@@ -784,7 +784,7 @@ namespace GXml {
                         */
                        check_invalid_characters (name, "attribute");
 
-                       return new Attr (this.xmldoc->new_prop (name, ""), this);
+                       return new xAttr (this.xmldoc->new_prop (name, ""), this);
 
                        /* TODO: should we pass something other than
                           "" for the unspecified value?  probably
diff --git a/gxml/libxml-Element.vala b/gxml/libxml-Element.vala
index 65c7c9a..1b51388 100644
--- a/gxml/libxml-Element.vala
+++ b/gxml/libxml-Element.vala
@@ -128,7 +128,7 @@ namespace GXml {
                 * no such attribute is set.
                 */
                public string get_attribute (string name) {
-                       Attr attr = this.get_attribute_node (name);
+                       xAttr attr = this.get_attribute_node (name);
 
                        if (attr != null)
                                return attr.value;
@@ -146,7 +146,7 @@ namespace GXml {
                 * @param value The value to set
                 */
                public void set_attribute (string name, string value) {
-                       Attr attr;
+                       xAttr attr;
 
                        attr = this.owner_document.create_attribute (name);
                        attr.value = value;
@@ -175,7 +175,7 @@ namespace GXml {
                 *
                 * @return The Attr node named by name for this element, or %NULL if none is set
                 */
-               public Attr? get_attribute_node (string name) {
+               public xAttr? get_attribute_node (string name) {
                        return this.attributes.get_named_item (name);
                }
                /**
@@ -190,7 +190,7 @@ namespace GXml {
                 * is replaced and the old Attr is returned.
                 * Elsewise, %NULL is returned.
                 */
-               public Attr set_attribute_node (Attr new_attr) {
+               public xAttr set_attribute_node (xAttr new_attr) {
                        // TODO: INUSE_ATTRIBUTE_ERR if new_attr already belongs to another element
                        // NO_MODIFICATION_ALLOWED_ERR and WRONG_DOCUMENT_ERR checked within
                        return this.attributes.set_named_item (new_attr);
@@ -208,7 +208,7 @@ namespace GXml {
                 * @return The old_attr we wanted to remove, even if
                 * it wasn't found.
                 */
-               public Attr remove_attribute_node (Attr old_attr) {
+               public xAttr remove_attribute_node (xAttr old_attr) {
                        this.check_read_only ();
                        return this.attributes.remove_named_item (old_attr.name);
                }
diff --git a/gxml/libxml-NamedAttrMap.vala b/gxml/libxml-NamedAttrMap.vala
index 0789d63..577b2f4 100644
--- a/gxml/libxml-NamedAttrMap.vala
+++ b/gxml/libxml-NamedAttrMap.vala
@@ -76,7 +76,7 @@ namespace GXml {
                        {
                                string k = "";
                                if (cur != null) k = cur->name;
-                               return new Entry (k, (GXml.Attribute) new Attr (cur, (xDocument) 
nm.elem.document));
+                               return new Entry (k, (GXml.Attribute) new xAttr (cur, (xDocument) 
nm.elem.document));
                        }
                        public bool has_next ()
                        {
@@ -121,7 +121,7 @@ namespace GXml {
         * A collection of { link NamedNodeMap} of type { link Attr} objects in a { link xElement}.
         */
        public class NamedAttrMap : AbstractNamedAttrMap, Map<string,GXml.Attribute>,
-               NamedNodeMap<Attr?>
+               NamedNodeMap<xAttr?>
        {
                internal NamedAttrMap (xElement e)
                {
@@ -141,7 +141,7 @@ namespace GXml {
                public new Attribute @get (string key)
                {
                        var at = elem.node->has_prop (key);
-                       return (Attribute) new Attr(at, (xDocument) elem.document);
+                       return (Attribute) new xAttr(at, (xDocument) elem.document);
                }
                public bool has (string key, Attribute value)
                {
@@ -236,16 +236,16 @@ namespace GXml {
                        public bool mutable { get { return true; } }
                }
                // NamedNodeMap interface
-               public Attr? get_named_item (string name) {
+               public xAttr? get_named_item (string name) {
                        Xml.Attr *prop = this.elem.node->has_prop (name);
                        return this.elem.owner_document.lookup_attr (prop);
                }
 
-               public Attr? set_named_item (Attr? gxml_attr_new) {
+               public xAttr? set_named_item (xAttr? gxml_attr_new) {
                        Xml.Node *xml_elem;
                        Xml.Attr *xml_prop_old;
                        Xml.Attr *xml_prop_new;
-                       Attr gxml_attr_old;
+                       xAttr gxml_attr_old;
 
                        /* TODO: INUSE_ATTRIBUTE_ERR if new_attr already belongs to
                           another element */
@@ -273,8 +273,8 @@ namespace GXml {
                        return gxml_attr_old;
                }
 
-               public Attr? remove_named_item (string name) {
-                       Attr gxml_attr_old;
+               public xAttr? remove_named_item (string name) {
+                       xAttr gxml_attr_old;
                        Xml.Attr *xml_prop_old;
                        Xml.Node *xml_elem;
 
@@ -308,7 +308,7 @@ namespace GXml {
                        }
                }
 
-               public Attr? item (ulong index) {
+               public xAttr? item (ulong index) {
                        Xml.Attr *attr;
 
                        attr = this.elem.node->properties;
diff --git a/test/AttrTest.vala b/test/AttrTest.vala
index c8cdd6d..4f2de18 100644
--- a/test/AttrTest.vala
+++ b/test/AttrTest.vala
@@ -32,9 +32,9 @@ class AttrTest : GXmlTest {
                                GXml.xNode root = doc.document_element;
                                xElement node = (xElement)root.child_nodes.item (0);
 
-                               Attr core = node.get_attribute_node ("core");
-                               Attr shell = node.get_attribute_node ("shell");
-                               Attr price = node.get_attribute_node ("price");
+                               xAttr core = node.get_attribute_node ("core");
+                               xAttr shell = node.get_attribute_node ("shell");
+                               xAttr price = node.get_attribute_node ("price");
 
                                assert (core.namespace_uri == "http://mom.co.uk/wands";);
                                assert (shell.namespace_uri == "http://mom.co.uk/wands";);
@@ -45,9 +45,9 @@ class AttrTest : GXmlTest {
                                GXml.xNode root = doc.document_element;
                                xElement node = (xElement)root.child_nodes.item (0);
 
-                               Attr core = node.get_attribute_node ("core");
-                               Attr shell = node.get_attribute_node ("shell");
-                               Attr price = node.get_attribute_node ("price");
+                               xAttr core = node.get_attribute_node ("core");
+                               xAttr shell = node.get_attribute_node ("shell");
+                               xAttr price = node.get_attribute_node ("price");
 
                                assert (core.namespace_prefix == "wands");
                                assert (shell.namespace_prefix == "wands");
@@ -58,9 +58,9 @@ class AttrTest : GXmlTest {
                                GXml.xNode root = doc.document_element;
                                xElement node = (xElement)root.child_nodes.item (0);
 
-                               Attr core = node.get_attribute_node ("core");
-                               Attr shell = node.get_attribute_node ("shell");
-                               Attr price = node.get_attribute_node ("price");
+                               xAttr core = node.get_attribute_node ("core");
+                               xAttr shell = node.get_attribute_node ("shell");
+                               xAttr price = node.get_attribute_node ("price");
 
                                assert (core.local_name == "core");
                                assert (shell.local_name == "shell");
@@ -69,13 +69,13 @@ class AttrTest : GXmlTest {
 
                Test.add_func ("/gxml/attribute/node_name", () => {
                                xDocument doc = get_doc ();
-                               Attr attr = get_attr ("broomSeries", "Nimbus", doc);
+                               xAttr attr = get_attr ("broomSeries", "Nimbus", doc);
 
                                assert (attr.node_name == "broomSeries");
                        });
                Test.add_func ("/gxml/attribute/node_value", () => {
                                xDocument doc = get_doc ();
-                               Attr attr = doc.create_attribute ("bank");
+                               xAttr attr = doc.create_attribute ("bank");
 
                                assert (attr.node_value == "");
                                attr.node_value = "Gringots";
@@ -88,13 +88,13 @@ class AttrTest : GXmlTest {
                        });
                Test.add_func ("/gxml/attribute/name", () => {
                                xDocument doc = get_doc ();
-                               Attr attr = get_attr ("broomSeries", "Nimbus", doc);
+                               xAttr attr = get_attr ("broomSeries", "Nimbus", doc);
 
                                assert (attr.name == "broomSeries");
                        });
                Test.add_func ("/gxml/attribute/node_value", () => {
                                xDocument doc = get_doc ();
-                               Attr attr = doc.create_attribute ("bank");
+                               xAttr attr = doc.create_attribute ("bank");
 
                                assert (attr.value == "");
                                attr.value = "Gringots";
@@ -111,7 +111,7 @@ class AttrTest : GXmlTest {
                Test.add_func ("/gxml/attribute/parent_node", () => {
                                xDocument doc = get_doc ();
                                xElement elem = get_elem ("creature", doc);
-                               Attr attr = get_attr ("breed", "Dragons", doc);
+                               xAttr attr = get_attr ("breed", "Dragons", doc);
 
                                assert (attr.parent_node == null);
                                elem.set_attribute_node (attr);
@@ -120,8 +120,8 @@ class AttrTest : GXmlTest {
                Test.add_func ("/gxml/attribute/previous_sibling", () => {
                                xDocument doc = get_doc ();
                                xElement elem = get_elem ("creature", doc);
-                               Attr attr1 = get_attr ("breed", "Dragons", doc);
-                               Attr attr2 = get_attr ("size", "large", doc);
+                               xAttr attr1 = get_attr ("breed", "Dragons", doc);
+                               xAttr attr2 = get_attr ("size", "large", doc);
 
                                elem.set_attribute_node (attr1);
                                elem.set_attribute_node (attr2);
@@ -132,8 +132,8 @@ class AttrTest : GXmlTest {
                Test.add_func ("/gxml/attribute/next_sibling", () => {
                                xDocument doc = get_doc ();
                                xElement elem = get_elem ("creature", doc);
-                               Attr attr1 = get_attr ("breed", "Dragons", doc);
-                               Attr attr2 = get_attr ("size", "large", doc);
+                               xAttr attr1 = get_attr ("breed", "Dragons", doc);
+                               xAttr attr2 = get_attr ("size", "large", doc);
 
                                elem.set_attribute_node (attr1);
                                elem.set_attribute_node (attr2);
@@ -143,7 +143,7 @@ class AttrTest : GXmlTest {
                        });
                Test.add_func ("/gxml/attribute/insert_before", () => {
                                xDocument doc = get_doc ();
-                               Attr attr = get_attr ("pie", "Dumbleberry", doc);
+                               xAttr attr = get_attr ("pie", "Dumbleberry", doc);
                                xText txt = doc.create_text_node ("Whipped ");
 
                                assert (attr.value == "Dumbleberry");
@@ -154,7 +154,7 @@ class AttrTest : GXmlTest {
                        });
                Test.add_func ("/gxml/attribute/replace_child", () => {
                                xDocument doc = get_doc ();
-                               Attr attr = get_attr ("WinningHouse", "Slytherin", doc);
+                               xAttr attr = get_attr ("WinningHouse", "Slytherin", doc);
                                xText txt = doc.create_text_node ("Gryffindor");
 
                                assert (attr.value == "Slytherin");
@@ -163,7 +163,7 @@ class AttrTest : GXmlTest {
                        });
                Test.add_func ("/gxml/attribute/remove_child", () => {
                                xDocument doc = get_doc ();
-                               Attr attr = get_attr ("parchment", "MauraudersMap", doc);
+                               xAttr attr = get_attr ("parchment", "MauraudersMap", doc);
 
                                assert (attr.value == "MauraudersMap");
                                // mischief managed
diff --git a/test/DocumentTest.vala b/test/DocumentTest.vala
index 7ebf736..de41e27 100644
--- a/test/DocumentTest.vala
+++ b/test/DocumentTest.vala
@@ -346,7 +346,7 @@ class DocumentTest : GXmlTest {
                        });
                Test.add_func ("/gxml/document/create_attribute", () => {
                                xDocument doc = get_doc ();
-                               Attr attr = doc.create_attribute ("attrname");
+                               xAttr attr = doc.create_attribute ("attrname");
 
                                assert (attr.name == "attrname");
                                assert (attr.node_name == "attrname");
@@ -424,7 +424,7 @@ class DocumentTest : GXmlTest {
                        GLib.stdout.printf ("<%s", node.node_name);
                NamedAttrMap attrs = node.attributes;
                for (int i = 0; i < attrs.length; i++) {
-                       Attr attr = attrs.item (i);
+                       xAttr attr = attrs.item (i);
                        GLib.stdout.printf (" %s=\"%s\"", attr.name, attr.value);
                }
 
diff --git a/test/ElementTest.vala b/test/ElementTest.vala
index 882fa57..c00d463 100644
--- a/test/ElementTest.vala
+++ b/test/ElementTest.vala
@@ -145,7 +145,7 @@ class ElementTest : GXmlTest  {
                                assert (attributes.get_named_item ("alley").value == "Diagon");
                                assert (attributes.get_named_item ("train").value == "Hogwarts Express");
 
-                               Attr attr;
+                               xAttr attr;
                                attr = doc.create_attribute ("owl");
                                attr.value = "Hedwig";
 
@@ -209,8 +209,8 @@ class ElementTest : GXmlTest  {
                Test.add_func ("/gxml/element/set_attribute_node", () => {
                                xDocument doc;
                                xElement elem = get_elem_new_doc ("tagname", out doc);
-                               Attr attr1 = elem.owner_document.create_attribute ("name");
-                               Attr attr2 = elem.owner_document.create_attribute ("name");
+                               xAttr attr1 = elem.owner_document.create_attribute ("name");
+                               xAttr attr2 = elem.owner_document.create_attribute ("name");
 
                                attr1.value = "Snape";
                                attr2.value = "Moody";
@@ -228,7 +228,7 @@ class ElementTest : GXmlTest  {
                Test.add_func ("/gxml/element/remove_attribute_node", () => {
                                xDocument doc;
                                xElement elem = get_elem_new_doc ("tagname", out doc);
-                               Attr attr;
+                               xAttr attr;
 
                                attr = elem.owner_document.create_attribute ("name");
                                attr.value = "Luna";
diff --git a/test/GXmlTest.vala b/test/GXmlTest.vala
index e733641..4994931 100644
--- a/test/GXmlTest.vala
+++ b/test/GXmlTest.vala
@@ -107,8 +107,8 @@ class GXmlTest {
        //      return get_attr (name, value, get_doc ());
        // }
 
-       internal static Attr get_attr (string name, string value, xDocument doc) {
-               Attr attr = doc.create_attribute (name);
+       internal static xAttr get_attr (string name, string value, xDocument doc) {
+               xAttr attr = doc.create_attribute (name);
                attr.value = value;
                return attr;
        }
diff --git a/test/NodeTest.vala b/test/NodeTest.vala
index f6a9e51..5096cbd 100644
--- a/test/NodeTest.vala
+++ b/test/NodeTest.vala
@@ -128,7 +128,7 @@ class NodeTest : GXmlTest {
                                assert (node.node_value == null);
 
                                node = doc.create_attribute ("name");
-                               ((Attr)node).value = "Harry Potter";
+                               ((xAttr)node).value = "Harry Potter";
                                assert (node.node_value == "Harry Potter");
 
                                node = doc.create_text_node ("text content");
@@ -153,10 +153,10 @@ class NodeTest : GXmlTest {
                                /* TODO: xDocument Type, xDocument Fragment, Notation */
                                // assert (attr.node_value == "harry");
                                /* TODO: figure out a solution.
-                                  Attr's node_value doesn't get used when elem is thought of
+                                  xAttr's node_value doesn't get used when elem is thought of
                                   as a Node.
                                   GXml.xNode wants to get it from Node's Xml.Node* node,
-                                  while Attr wants to get it from Attr's Xml.Attr* node. :( */
+                                  while xAttr wants to get it from xAttr's Xml.Attr* node. :( */
                        });
                Test.add_func ("/gxml/domnode/parent_node", () => {
                                xDocument doc = get_doc ();


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