view src/docgen/misc/misc.d @ 806:bcb74c9b895c

Moved out files in the trunk folder to the root.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sun, 09 Mar 2008 00:12:19 +0100
parents trunk/src/docgen/misc/misc.d@ec8dd7b8bf0c
children
line wrap: on
line source

/**
 * Author: Jari-Matti Mäkelä
 * License: GPL3
 */
module docgen.misc.misc;
import docgen.misc.options;
import tango.io.model.IConduit : OutputStream;

char[] docgen_version = "Dil document generator 0.1";

interface DocGenerator {
  DocGeneratorOptions *options();
  void generate();
}

interface GraphCache {  
  char[] getCachedGraph(Object graph, GraphFormat format);
  void setCachedGraph(Object graph, GraphFormat format, char[] contents);
}

interface CachingDocGenerator : DocGenerator {
  GraphCache graphCache();
}

interface WriterFactory {
  DocGeneratorOptions *options();
}

abstract class AbstractWriterFactory : WriterFactory {
  protected DocGenerator generator;

  public:
  
  DocGeneratorOptions *options() {
    return generator.options;
  }

  this(DocGenerator generator) {
    this.generator = generator;
  }
}


template AbstractWriter(T, int n = 0) {
  abstract class AbstractWriter {
    protected T factory;
    protected OutputStream[] outputs;
  
    static if (n > 0) {
      this(T factory, OutputStream[] outputs) {
        this.factory = factory;
        this.outputs = outputs;
        assert(outputs.length == n, "Incorrect number of outputs");
      }
    }

    this(T factory) {
      this.factory = factory;
    }
  }
}