polyglot.frontend
Class TargetFactory

java.lang.Object
  extended by polyglot.frontend.TargetFactory

public class TargetFactory
extends java.lang.Object

A TargetFactory is responsible for opening output files.


Constructor Summary
TargetFactory(java.io.File outDir, java.lang.String outExt, boolean so)
           
 
Method Summary
 java.io.File getOutputDirectory()
          Return the output directory
 java.lang.String headerNameForFileName(java.lang.String filename)
          Returns a filename to represent a .h file, given the name of a .cpp file that represents the "main class"
 java.io.File outputFile(java.lang.String packageName, Source source)
          Return a file object for the output of the source file in the given package.
 java.io.File outputFile(java.lang.String packageName, java.lang.String className, Source source)
          Return a file object for the output of the class in the given package.
 java.io.Writer outputWriter(java.io.File outputFile)
          Open a writer to the output file.
 java.io.Writer outputWriter(java.lang.String packageName, java.lang.String className, Source source)
          Open a writer to the output file for the class in the given package.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TargetFactory

public TargetFactory(java.io.File outDir,
                     java.lang.String outExt,
                     boolean so)
Method Detail

getOutputDirectory

public java.io.File getOutputDirectory()
Return the output directory


outputWriter

public java.io.Writer outputWriter(java.lang.String packageName,
                                   java.lang.String className,
                                   Source source)
                            throws java.io.IOException
Open a writer to the output file for the class in the given package.

Throws:
java.io.IOException

outputWriter

public java.io.Writer outputWriter(java.io.File outputFile)
                            throws java.io.IOException
Open a writer to the output file.

Throws:
java.io.IOException

outputFile

public java.io.File outputFile(java.lang.String packageName,
                               Source source)
Return a file object for the output of the source file in the given package.


outputFile

public java.io.File outputFile(java.lang.String packageName,
                               java.lang.String className,
                               Source source)
Return a file object for the output of the class in the given package.


headerNameForFileName

public java.lang.String headerNameForFileName(java.lang.String filename)
Returns a filename to represent a .h file, given the name of a .cpp file that represents the "main class"

Parameters:
filename - -- the input cpp file
Returns:
the output filename for the header file with the proper extension