[valadoc] libvaladoc: register child structs



commit 13aba44f713378272aa92ad033c7016609802661
Author: Florian Brosch <flo brosch gmail com>
Date:   Fri Aug 10 02:33:25 2012 +0200

    libvaladoc: register child structs

 src/libvaladoc/api/childsymbolregistrar.vala |    4 ++++
 src/libvaladoc/api/struct.vala               |   18 ++++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/libvaladoc/api/childsymbolregistrar.vala b/src/libvaladoc/api/childsymbolregistrar.vala
index c3288e0..e044327 100644
--- a/src/libvaladoc/api/childsymbolregistrar.vala
+++ b/src/libvaladoc/api/childsymbolregistrar.vala
@@ -82,6 +82,10 @@ public class Valadoc.Api.ChildSymbolRegistrar : Visitor {
 	 * { inheritDoc}
 	 */
 	public override void visit_struct (Struct item) {
+		if (item.base_type != null) {
+			((Struct) item.base_type.data_type).register_child_struct (item);
+		}
+
 		item.accept_all_children (this, false);
 	}
 
diff --git a/src/libvaladoc/api/struct.vala b/src/libvaladoc/api/struct.vala
index 52bcb6b..3024948 100644
--- a/src/libvaladoc/api/struct.vala
+++ b/src/libvaladoc/api/struct.vala
@@ -95,6 +95,24 @@ public class Valadoc.Api.Struct : TypeSymbol {
 	}
 
 
+	private Set<Struct> _known_child_structs = new TreeSet<Struct> ();
+
+	/**
+	 * Returns a list of all known structs based on this struct
+	 */
+	public Collection<Struct> get_known_child_structs () {
+		return _known_child_structs.read_only_view;
+	}
+
+	public void register_child_struct (Struct stru) {
+		if (this.base_type != null) {
+			((Struct) this.base_type.data_type).register_child_struct (stru);
+		}
+
+		_known_child_structs.add (stru);
+	}
+
+
 	/**
 	 * { inheritDoc}
 	 */



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