[gxml] GomCollection: added abstract search() method
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] GomCollection: added abstract search() method
- Date: Sun, 6 Nov 2016 17:23:12 +0000 (UTC)
commit a018ac753bf23e515d3291336ea6c4300e317d4b
Author: Daniel Espinosa <esodan gmail com>
Date: Sat Nov 5 23:34:18 2016 -0600
GomCollection: added abstract search() method
Implementations should be able to search and add
referecences to indexs for GomObject nodes
that can our should be part of a collection
gxml/GomCollections.vala | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/gxml/GomCollections.vala b/gxml/GomCollections.vala
index 19677f9..38ff5ce 100644
--- a/gxml/GomCollections.vala
+++ b/gxml/GomCollections.vala
@@ -42,6 +42,11 @@ public interface GXml.GomCollection : Object
*/
public abstract string element_name { get; construct set; }
/**
+ * Search and add references to all {@link GomObject} nodes as child of
+ * {@link element} with same, case insensitive, name of {@link element_name}
+ */
+ public abstract void search () throws GLib.Error;
+ /**
* Gets a child {@link DomElement} of {@link element} referenced in
* {@link nodes_index}.
*/
@@ -94,4 +99,14 @@ public class GXml.GomArrayList : Object, GomCollection {
(_("Invalid atempt to add a node with a different parent document"));
_nodes_index.append (_element.child_nodes.size - 1);
}
+ public void search () throws GLib.Error {
+ for (int i = 0; i < _element.child_nodes.size; i++) {
+ var n = _element.child_nodes.get (i);
+ if (n is GomObject) {
+ if ((n as DomElement).local_name.down () == element_name.down ()) {
+ _nodes_index.append (i);
+ }
+ }
+ }
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]