Mercurial > projects > dil
view trunk/src/docgen/graphutils/modulepathwriter.d @ 444:0bda71dc9c4f
More document template and source listing code.
author | Jari-Matti M?kel? <jmjm@iki.fi> |
---|---|
date | Wed, 17 Oct 2007 03:12:46 +0300 |
parents | ac9cd48151b6 |
children | 49f3afd6a0e8 |
line wrap: on
line source
/** * Author: Aziz Köksal & Jari-Matti Mäkelä * License: GPL3 */ module docgen.graphutils.modulepathwriter; import docgen.graphutils.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 ModulePathWriter : 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 Print!(char)(new Layout!(char), outputs[0]); void doPaths(Vertex[] v, uint level, char[] indent = "") { if (!level) return; foreach (vertex; v) { output(indent)(vertex.location).newline; if (vertex.outgoing.length) doPaths(vertex.outgoing, level-1, indent ~ " "); } } doPaths(vertices, factory.options.depth); } }