view trunk/src/docgen/graphutils/writers.d @ 466:db7e27b5c180

Fixed parts of HTML output, some reorganizing.
author Jari-Matti M?kel? <jmjm@iki.fi>
date Wed, 31 Oct 2007 15:17:20 +0200
parents 1b5f1ce09f38
children
line wrap: on
line source

/**
 * Author: Jari-Matti Mäkelä
 * License: GPL3
 */
module docgen.graphutils.writers;

public import docgen.graphutils.writer;
import docgen.graphutils.dotwriter;
import docgen.graphutils.modulepathwriter;
import docgen.graphutils.modulenamewriter;

class DefaultGraphWriterFactory : AbstractWriterFactory, GraphWriterFactory {
  public:

  this(DocGenerator generator) {
    super(generator);
  }

  GraphWriter createGraphWriter(PageWriter writer, GraphFormat outputFormat) {
    switch (outputFormat) {
      case GraphFormat.Dot:
        return new DotWriter(this, writer);
      case GraphFormat.ModuleNames:
        return new ModuleNameWriter(this, writer);
      case GraphFormat.ModulePaths:
        return new ModulePathWriter(this, writer);
      default:
        throw new Exception("Graph writer type does not exist!");
    }
  }
}

class DefaultCachingGraphWriterFactory : AbstractWriterFactory, CachingGraphWriterFactory {
  public:

  CachingDocGenerator generator;

  this(CachingDocGenerator generator) {
    super(generator);
    this.generator = generator;
  }

  GraphCache graphCache() {
    return generator.graphCache;
  }

  override GraphWriter createGraphWriter(PageWriter writer, GraphFormat outputFormat) {
    switch (outputFormat) {
      case GraphFormat.Dot:
        return new CachingDotWriter(this, writer);
      case GraphFormat.ModuleNames:
        return new ModuleNameWriter(this, writer);
      case GraphFormat.ModulePaths:
        return new ModulePathWriter(this, writer);
      default:
        throw new Exception("Graph writer type does not exist!");
    }
  }
}