net.sf.antcontrib.cpptasks.trolltech

Class MetaObjectCompiler

Implemented Interfaces:
Cloneable, Compiler, Processor

public final class MetaObjectCompiler
extends CommandLineCompiler

Adapter for the Trolltech Qt MOC Compiler.
Author:
Curt Arnold

Field Summary

Fields inherited from class net.sf.antcontrib.cpptasks.compiler.AbstractProcessor

DEFAULT_DISCARD_BID, DEFAULT_PROCESS_BID

Method Summary

protected void
addImpliedArgs(Vector args, boolean debug, boolean multithreaded, boolean exceptions, LinkType linkType, Boolean rtti, OptimizationEnum optimization)
Add arguments for debug, etc.
protected void
addWarningSwitch(Vector args, int level)
Add arguments for specified warning level.
int
bid(String inputFile)
Returns the bid of the processor for the file.
Processor
changeEnvironment(boolean newEnvironment, Environment env)
Change enviroment (deprecated).
protected Parser
createParser(File source)
Gets a parser to scan source file for dependencies.
protected int
getArgumentCountPerInputFile()
Gets number of command line arguments per input file.
protected void
getDefineSwitch(StringBuffer buffer, String define, String value)
Gets switch to define preprocessor macro.
protected File[]
getEnvironmentIncludePath()
Gets standard include paths.
protected String
getIncludeDirSwitch(String includeDir)
Gets include directory switch.
protected String
getInputFileArgument(File outputDir, String filename, int index)
Gets input file arguments.
static MetaObjectCompiler
getInstance()
Gets singleton instance of compiler.
Linker
getLinker(LinkType type)
Gets linker associated with this type.
int
getMaximumCommandLength()
Gets maximum length of command line.
protected int
getMaximumInputFilesPerCommand()
Gets maximum number of input files processed per command.
String[]
getOutputFileNames(String inputFile, VersionInfo versionInfo)
Gets output file names.
protected int
getTotalArgumentLengthForInputFile(File outputDir, String inputFile)
Get total command line length due to the input file.
protected void
getUndefineSwitch(StringBuffer buffer, String define)
Gets switch to undefine preprocessor macro.

Methods inherited from class net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler

addImpliedArgs, addIncludes, addWarningSwitch, buildDefineArguments, compile, createConfiguration, getArgumentCountPerInputFile, getCommand, getDefineSwitch, getEnvironmentIncludePath, getIdentifier, getIncludeDirSwitch, getInputFileArgument, getLibtool, getLibtoolCompiler, getMaximumCommandLength, getMaximumInputFilesPerCommand, getTotalArgumentLengthForInputFile, getUndefineSwitch, runCommand, setCommand

Methods inherited from class net.sf.antcontrib.cpptasks.compiler.AbstractCompiler

canParse, createConfiguration, createConfiguration, createParser, getBaseOutputName, getOutputFileNames, parseIncludes, resolveInclude

Methods inherited from class net.sf.antcontrib.cpptasks.compiler.AbstractProcessor

bid, changeEnvironment, clone, getHeaderExtensions, getIdentifier, getIdentifier, getOSArch, getOSName, getSourceExtensions, isDarwin, toString

Method Details

addImpliedArgs

protected void addImpliedArgs(Vector args,
                              boolean debug,
                              boolean multithreaded,
                              boolean exceptions,
                              LinkType linkType,
                              Boolean rtti,
                              OptimizationEnum optimization)
Add arguments for debug, etc.
Overrides:
addImpliedArgs in interface CommandLineCompiler
Parameters:
args - Vector command argument list
debug - boolean build for debug if true
multithreaded - boolean build for multithreading if true
exceptions - boolean enable exceptions if true
linkType - LinkType output and runtime type
rtti - Boolean enable run-time type identification if true
optimization - OptimizationEnum optimization

addWarningSwitch

protected void addWarningSwitch(Vector args,
                                int level)
Add arguments for specified warning level.
Overrides:
addWarningSwitch in interface CommandLineCompiler
Parameters:
args - Vector command line arguments
level - int warning level value

bid

public int bid(String inputFile)
Returns the bid of the processor for the file.
Specified by:
bid in interface Processor
Overrides:
bid in interface AbstractProcessor
Parameters:
inputFile - filename of input file
Returns:
bid for the file, 0 indicates no interest, 1 indicates that the processor recognizes the file but doesn't process it (header files, for example), 100 indicates strong interest

changeEnvironment

public Processor changeEnvironment(boolean newEnvironment,
                                   Environment env)
Change enviroment (deprecated).
Specified by:
changeEnvironment in interface Processor
Overrides:
changeEnvironment in interface AbstractProcessor
Parameters:
newEnvironment - boolean use new environment.
env - Environment environment
Returns:
Processor modified processor

createParser

protected Parser createParser(File source)
Gets a parser to scan source file for dependencies.
Overrides:
createParser in interface AbstractCompiler
Parameters:
source - source file
Returns:
parser

getArgumentCountPerInputFile

protected int getArgumentCountPerInputFile()
Gets number of command line arguments per input file.
Overrides:
getArgumentCountPerInputFile in interface CommandLineCompiler
Returns:
int number of command line arguments per input file.

getDefineSwitch

protected void getDefineSwitch(StringBuffer buffer,
                               String define,
                               String value)
Gets switch to define preprocessor macro.
Overrides:
getDefineSwitch in interface CommandLineCompiler
Parameters:
buffer - StringBuffer command line argument
define - String macro name
value - String macro value, may be null.

getEnvironmentIncludePath

protected File[] getEnvironmentIncludePath()
Gets standard include paths.
Overrides:
getEnvironmentIncludePath in interface CommandLineCompiler
Returns:
File[] standard include paths

getIncludeDirSwitch

protected String getIncludeDirSwitch(String includeDir)
Gets include directory switch.
Overrides:
getIncludeDirSwitch in interface CommandLineCompiler
Parameters:
includeDir - String include directory
Returns:
String command switch to add specified directory to search path

getInputFileArgument

protected String getInputFileArgument(File outputDir,
                                      String filename,
                                      int index)
Gets input file arguments.
Overrides:
getInputFileArgument in interface CommandLineCompiler
Parameters:
outputDir - File output directory
filename - String input file name.
index - int argument index, 0 to getNumberOfArgumentsPerInputFile() -1
Returns:
String input file argument

getInstance

public static MetaObjectCompiler getInstance()
Gets singleton instance of compiler.
Returns:
MetaObjectCompiler singleton instance

getLinker

public Linker getLinker(LinkType type)
Gets linker associated with this type.
Specified by:
getLinker in interface Processor
Parameters:
type - LinkType linker, returns ld.
Returns:
Linker

getMaximumCommandLength

public int getMaximumCommandLength()
Gets maximum length of command line.
Overrides:
getMaximumCommandLength in interface CommandLineCompiler
Returns:
int maximum length of command line

getMaximumInputFilesPerCommand

protected int getMaximumInputFilesPerCommand()
Gets maximum number of input files processed per command.
Overrides:
getMaximumInputFilesPerCommand in interface CommandLineCompiler
Returns:
int maximum number of input files processed per command.

getOutputFileNames

public String[] getOutputFileNames(String inputFile,
                                   VersionInfo versionInfo)
Gets output file names.
Specified by:
getOutputFileNames in interface Processor
Overrides:
getOutputFileNames in interface AbstractCompiler
Parameters:
inputFile - String input file name
versionInfo - version info, not used by this compiler.
Returns:
String[] output file names

getTotalArgumentLengthForInputFile

protected int getTotalArgumentLengthForInputFile(File outputDir,
                                                 String inputFile)
Get total command line length due to the input file.
Overrides:
getTotalArgumentLengthForInputFile in interface CommandLineCompiler
Parameters:
outputDir - File output directory
inputFile - String input file
Returns:
int characters added to command line for the input file.

getUndefineSwitch

protected void getUndefineSwitch(StringBuffer buffer,
                                 String define)
Gets switch to undefine preprocessor macro.
Overrides:
getUndefineSwitch in interface CommandLineCompiler
Parameters:
buffer - StringBuffer command line argument
define - String macro name

Copyright B) 2001-2006 Ant-Contrib project. All Rights Reserved.