view trunk/src/docgen/sourcelisting/writer.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: Jari-Matti Mäkelä
 * License: GPL3
 */
module docgen.sourcelisting.writer;

public import docgen.misc.misc;
import dil.Parser;
import tango.io.model.IConduit : OutputStream, InputStream;

struct ListingOptions {
  DocFormat docFormat;
  bool enableListings;
}

interface ListingWriter {
  void generateListing(Parser parser);
  void generateListing(InputStream input);
}

abstract class AbstractListingWriter : ListingWriter {
  protected ListingWriterFactory factory;
  protected OutputStream[] outputs;

  this(ListingWriterFactory factory, OutputStream[] outputs) {
    this.factory = factory;
    this.outputs = outputs;
  }
}

interface ListingWriterFactory {
  ListingOptions *options();
  ListingWriter createListingWriter(OutputStream[] outputs);
}

abstract class AbstractListingWriterFactory : ListingWriterFactory {
  protected ListingOptions m_options;

  public ListingOptions *options() {
    return &m_options;
  }
}