[gxml/wip/ricotz/issue548] Implement missing Collection interface methods while chaining up to GomCollection



commit e237d966e0587c351dded5b7fd6ba9152dd70c17
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sat Dec 1 17:11:02 2018 +0100

    Implement missing Collection interface methods while chaining up to GomCollection
    
    This requires vala 0.43 to work.
    
    https://gitlab.gnome.org/GNOME/vala/issues/548

 gxml/GomCollections.vala | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/gxml/GomCollections.vala b/gxml/GomCollections.vala
index ad885ff..5687e1a 100644
--- a/gxml/GomCollections.vala
+++ b/gxml/GomCollections.vala
@@ -198,7 +198,7 @@ public abstract class GXml.BaseCollection : Object, Traversable<DomElement>, Ite
   /**
    * {@inheritDoc}
    */
-  public void initialize (GLib.Type items_type) throws GLib.Error {
+  public void GomCollection.initialize (GLib.Type items_type) throws GLib.Error {
     if (!items_type.is_a (typeof (GomElement))) {
       throw new DomError.INVALID_NODE_TYPE_ERROR
                 (_("Invalid attempt to initialize a collection using an unsupported type. Only 
GXmlGomElement is supported"));
@@ -207,6 +207,10 @@ public abstract class GXml.BaseCollection : Object, Traversable<DomElement>, Ite
     _items_name = o.local_name;
     _items_type = items_type;
   }
+  public void Collection.initialize (GLib.Type items_type) throws GLib.Error {
+    ((GomCollection) this).initialize (items_type);
+  }
+
   /**
    * Initialize an {@link GomCollection} to use an element as children's parent.
    * Searchs for all nodes, calling {@link GomCollection.search}
@@ -227,7 +231,7 @@ public abstract class GXml.BaseCollection : Object, Traversable<DomElement>, Ite
    * Object is always added as a child of {@link element}
    * but just added to collection if {@link validate_append} returns true;
    */
-  public void append (DomElement node) throws GLib.Error {
+  public void GomCollection.append (DomElement node) throws GLib.Error {
     if (_element == null)
       throw new DomError.INVALID_NODE_TYPE_ERROR
                 (_("Parent Element is invalid"));
@@ -246,6 +250,9 @@ public abstract class GXml.BaseCollection : Object, Traversable<DomElement>, Ite
     if (!validate_append (index, node)) return;
     _nodes_index.push_tail (index);
   }
+  public void Collection.append (DomElement node) throws GLib.Error {
+    ((GomCollection) this).append (node);
+  }
   /**
    * Search for all child nodes in {@link element} of type {@link GomElement}
    * with a {@link GomElement.local_name} equal to {@link GomCollection.items_name},
@@ -253,7 +260,7 @@ public abstract class GXml.BaseCollection : Object, Traversable<DomElement>, Ite
    *
    * Implementations could add additional restrictions to add element to collection.
    */
-  public void search () throws GLib.Error {
+  public void GomCollection.search () throws GLib.Error {
     _nodes_index.clear ();
     clear ();
     if (_element == null)
@@ -269,14 +276,23 @@ public abstract class GXml.BaseCollection : Object, Traversable<DomElement>, Ite
       }
     }
   }
+  public void Collection.search () throws GLib.Error {
+    ((GomCollection) this).search ();
+  }
   /**
    * {@inheritDoc}
    */
-  public abstract bool validate_append (int index, DomElement element) throws GLib.Error;
+  public abstract bool GomCollection.validate_append (int index, DomElement element) throws GLib.Error;
+  public bool Collection.validate_append (int index, DomElement element) throws GLib.Error {
+    return ((GomCollection) this).validate_append (index, element);
+  }
   /**
    * {@inheritDoc}
    */
-  public virtual void clear () throws GLib.Error {}
+  public virtual void GomCollection.clear () throws GLib.Error {}
+  public void Collection.clear () throws GLib.Error {
+    ((GomCollection) this).clear ();
+  }
 
   // Traversable Interface
   public bool @foreach (ForallFunc<DomElement> f) {


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