Class MetaObjectCompiler
- java.lang.Object
-
- net.sf.antcontrib.cpptasks.compiler.AbstractProcessor
-
- net.sf.antcontrib.cpptasks.compiler.AbstractCompiler
-
- net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler
-
- net.sf.antcontrib.cpptasks.trolltech.MetaObjectCompiler
-
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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addImpliedArgs(java.util.Vector args, boolean debug, boolean multithreaded, boolean exceptions, LinkType linkType, java.lang.Boolean rtti, OptimizationEnum optimization)
Add arguments for debug, etc.protected void
addWarningSwitch(java.util.Vector args, int level)
Add arguments for specified warning level.int
bid(java.lang.String inputFile)
Returns the bid of the processor for the file.Processor
changeEnvironment(boolean newEnvironment, org.apache.tools.ant.types.Environment env)
Change enviroment (deprecated).protected Parser
createParser(java.io.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(java.lang.StringBuffer buffer, java.lang.String define, java.lang.String value)
Gets switch to define preprocessor macro.protected java.io.File[]
getEnvironmentIncludePath()
Gets standard include paths.protected java.lang.String
getIncludeDirSwitch(java.lang.String includeDir)
Gets include directory switch.protected java.lang.String
getInputFileArgument(java.io.File outputDir, java.lang.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.java.lang.String[]
getOutputFileNames(java.lang.String inputFile, VersionInfo versionInfo)
Gets output file names.protected int
getTotalArgumentLengthForInputFile(java.io.File outputDir, java.lang.String inputFile)
Get total command line length due to the input file.protected void
getUndefineSwitch(java.lang.StringBuffer buffer, java.lang.String define)
Gets switch to undefine preprocessor macro.-
Methods inherited from class net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler
addIncludes, buildDefineArguments, compile, createConfiguration, getCommand, getIdentifier, getLibtool, getLibtoolCompiler, runCommand, setCommand
-
Methods inherited from class net.sf.antcontrib.cpptasks.compiler.AbstractCompiler
canParse, createConfiguration, getBaseOutputName, parseIncludes, resolveInclude
-
Methods inherited from class net.sf.antcontrib.cpptasks.compiler.AbstractProcessor
clone, getHeaderExtensions, getIdentifier, getOSArch, getOSName, getSourceExtensions, isDarwin, toString
-
-
-
-
Method Detail
-
getInstance
public static MetaObjectCompiler getInstance()
Gets singleton instance of compiler.- Returns:
- MetaObjectCompiler singleton instance
-
addImpliedArgs
protected void addImpliedArgs(java.util.Vector args, boolean debug, boolean multithreaded, boolean exceptions, LinkType linkType, java.lang.Boolean rtti, OptimizationEnum optimization)
Add arguments for debug, etc.- Specified by:
addImpliedArgs
in classCommandLineCompiler
- Parameters:
args
- Vector command argument listdebug
- boolean build for debug if truemultithreaded
- boolean build for multithreading if trueexceptions
- boolean enable exceptions if truelinkType
- LinkType output and runtime typertti
- Boolean enable run-time type identification if trueoptimization
- OptimizationEnum optimization
-
addWarningSwitch
protected void addWarningSwitch(java.util.Vector args, int level)
Add arguments for specified warning level.- Specified by:
addWarningSwitch
in classCommandLineCompiler
- Parameters:
args
- Vector command line argumentslevel
- int warning level value
-
changeEnvironment
public Processor changeEnvironment(boolean newEnvironment, org.apache.tools.ant.types.Environment env)
Change enviroment (deprecated).- Specified by:
changeEnvironment
in interfaceProcessor
- Overrides:
changeEnvironment
in classAbstractProcessor
- Parameters:
newEnvironment
- boolean use new environment.env
- Environment environment- Returns:
- Processor modified processor
-
createParser
protected Parser createParser(java.io.File source)
Gets a parser to scan source file for dependencies.- Specified by:
createParser
in classAbstractCompiler
- Parameters:
source
- source file- Returns:
- parser
-
getArgumentCountPerInputFile
protected int getArgumentCountPerInputFile()
Gets number of command line arguments per input file.- Overrides:
getArgumentCountPerInputFile
in classCommandLineCompiler
- Returns:
- int number of command line arguments per input file.
-
bid
public int bid(java.lang.String inputFile)
Returns the bid of the processor for the file.- Specified by:
bid
in interfaceProcessor
- Overrides:
bid
in classAbstractProcessor
- 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
-
getOutputFileNames
public java.lang.String[] getOutputFileNames(java.lang.String inputFile, VersionInfo versionInfo)
Gets output file names.- Specified by:
getOutputFileNames
in interfaceProcessor
- Overrides:
getOutputFileNames
in classAbstractCompiler
- Parameters:
inputFile
- String input file nameversionInfo
- version info, not used by this compiler.- Returns:
- String[] output file names
-
getInputFileArgument
protected java.lang.String getInputFileArgument(java.io.File outputDir, java.lang.String filename, int index)
Gets input file arguments.- Overrides:
getInputFileArgument
in classCommandLineCompiler
- Parameters:
outputDir
- File output directoryfilename
- String input file name.index
- int argument index, 0 to getNumberOfArgumentsPerInputFile() -1- Returns:
- String input file argument
-
getMaximumCommandLength
public int getMaximumCommandLength()
Gets maximum length of command line.- Specified by:
getMaximumCommandLength
in classCommandLineCompiler
- Returns:
- int maximum length of command line
-
getMaximumInputFilesPerCommand
protected int getMaximumInputFilesPerCommand()
Gets maximum number of input files processed per command.- Overrides:
getMaximumInputFilesPerCommand
in classCommandLineCompiler
- Returns:
- int maximum number of input files processed per command.
-
getIncludeDirSwitch
protected java.lang.String getIncludeDirSwitch(java.lang.String includeDir)
Gets include directory switch.- Specified by:
getIncludeDirSwitch
in classCommandLineCompiler
- Parameters:
includeDir
- String include directory- Returns:
- String command switch to add specified directory to search path
-
getDefineSwitch
protected void getDefineSwitch(java.lang.StringBuffer buffer, java.lang.String define, java.lang.String value)
Gets switch to define preprocessor macro.- Specified by:
getDefineSwitch
in classCommandLineCompiler
- Parameters:
buffer
- StringBuffer command line argumentdefine
- String macro namevalue
- String macro value, may be null.
-
getUndefineSwitch
protected void getUndefineSwitch(java.lang.StringBuffer buffer, java.lang.String define)
Gets switch to undefine preprocessor macro.- Specified by:
getUndefineSwitch
in classCommandLineCompiler
- Parameters:
buffer
- StringBuffer command line argumentdefine
- String macro name
-
getEnvironmentIncludePath
protected java.io.File[] getEnvironmentIncludePath()
Gets standard include paths.- Specified by:
getEnvironmentIncludePath
in classCommandLineCompiler
- Returns:
- File[] standard include paths
-
getLinker
public Linker getLinker(LinkType type)
Gets linker associated with this type.- Parameters:
type
- LinkType linker, returns ld.- Returns:
- Linker
-
getTotalArgumentLengthForInputFile
protected int getTotalArgumentLengthForInputFile(java.io.File outputDir, java.lang.String inputFile)
Get total command line length due to the input file.- Overrides:
getTotalArgumentLengthForInputFile
in classCommandLineCompiler
- Parameters:
outputDir
- File output directoryinputFile
- String input file- Returns:
- int characters added to command line for the input file.
-
-