view trunk/src/docgen/graphutils/modulepathwriter.d @ 457:33a4cb255fcc

Cached images, small fixes, reorganizing.
author Jari-Matti M?kel? <jmjm@iki.fi>
date Tue, 30 Oct 2007 15:41:30 +0200
parents de2675bc9afa
children db7e27b5c180
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.Print: Print;
import tango.text.convert.Layout : Layout;

class ModulePathWriter : AbstractGraphWriter {
  this(GraphWriterFactory factory, PageWriter writer) {
    super(factory, writer);
  }

  void generateDepGraph(Vertex[] vertices, Edge[] edges, OutputStream imageFile) {
    char[][] contents;

    void doList(Vertex[] v, uint level) {
      if (!level) return;

      contents ~= "(";

      foreach (vertex; v) {
        contents ~= vertex.location;
        if (vertex.outgoing.length)
          doList(vertex.outgoing, level-1);
      }

      contents ~= ")";
    }

    doList(vertices, factory.options.graph.depth);

    writer.addList(contents, false);
  }
}