diff trunk/src/docgen/graphutils/modulenamewriter.d @ 395:ac9cd48151b6

Added couple of docgen modules.
author Jari-Matti M?kel? <jmjm@iki.fi>
date Wed, 19 Sep 2007 23:12:20 +0300
parents
children 0bda71dc9c4f
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trunk/src/docgen/graphutils/modulenamewriter.d	Wed Sep 19 23:12:20 2007 +0300
@@ -0,0 +1,38 @@
+/**
+ * Author: Aziz Köksal & Jari-Matti Mäkelä
+ * License: GPL3
+ */
+module docgen.graphutils.modulenamewriter;
+import docgen.graphutils.writer;
+
+import tango.io.protocol.Writer : Writer;
+import tango.io.FileConduit : FileConduit;
+import tango.io.Print: Print;
+import tango.text.convert.Layout : Layout;
+
+
+/**
+ * TODO: add support for html/xml/latex?
+ */
+class ModuleNameWriter : AbstractGraphWriter {
+  this(GraphWriterFactory factory, OutputStream[] outputs) {
+    super(factory, outputs);
+    assert(outputs.length == 1, "Wrong number of outputs");
+  }
+
+  void generateGraph(Vertex[] vertices, Edge[] edges) {
+    auto output = new Writer(outputs[0]);
+
+    void doList(Vertex[] v, uint level, char[] indent = "") {
+      if (!level) return;
+
+      foreach (vertex; v) {
+        output(indent)(vertex.name).newline;
+        if (vertex.outgoing.length)
+          doList(vertex.outgoing, level-1, indent ~ "  ");
+      }
+    }
+
+    doList(vertices, factory.options.depth);
+  }
+}
\ No newline at end of file