summaryrefslogtreecommitdiff
path: root/src/main/java/net/sf/antcontrib/cpptasks/trolltech
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/sf/antcontrib/cpptasks/trolltech')
-rw-r--r--src/main/java/net/sf/antcontrib/cpptasks/trolltech/MetaObjectCompiler.java280
-rw-r--r--src/main/java/net/sf/antcontrib/cpptasks/trolltech/MetaObjectParser.java148
-rw-r--r--src/main/java/net/sf/antcontrib/cpptasks/trolltech/UserInterfaceCompiler.java347
-rw-r--r--src/main/java/net/sf/antcontrib/cpptasks/trolltech/UserInterfaceParser.java67
-rw-r--r--src/main/java/net/sf/antcontrib/cpptasks/trolltech/package.html27
5 files changed, 869 insertions, 0 deletions
diff --git a/src/main/java/net/sf/antcontrib/cpptasks/trolltech/MetaObjectCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/trolltech/MetaObjectCompiler.java
new file mode 100644
index 0000000..25651da
--- /dev/null
+++ b/src/main/java/net/sf/antcontrib/cpptasks/trolltech/MetaObjectCompiler.java
@@ -0,0 +1,280 @@
+/*
+ *
+ * Copyright 2004 The Ant-Contrib project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.cpptasks.trolltech;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.FileReader;
+import java.io.Reader;
+import java.util.Vector;
+
+import net.sf.antcontrib.cpptasks.OptimizationEnum;
+import net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler;
+import net.sf.antcontrib.cpptasks.compiler.LinkType;
+import net.sf.antcontrib.cpptasks.compiler.Linker;
+import net.sf.antcontrib.cpptasks.compiler.Processor;
+import net.sf.antcontrib.cpptasks.parser.CParser;
+import net.sf.antcontrib.cpptasks.parser.Parser;
+import net.sf.antcontrib.cpptasks.gcc.LdLinker;
+import net.sf.antcontrib.cpptasks.VersionInfo;
+
+import org.apache.tools.ant.types.Environment;
+
+/**
+ * Adapter for the Trolltech Qt MOC Compiler.
+ *
+ * @author Curt Arnold
+ */
+public final class MetaObjectCompiler
+ extends CommandLineCompiler {
+ /**
+ * Singleton instance.
+ */
+ private static final MetaObjectCompiler INSTANCE = new MetaObjectCompiler(
+ false, null);
+
+ /**
+ * Gets singleton instance of compiler.
+ * @return MetaObjectCompiler singleton instance
+ */
+ public static MetaObjectCompiler getInstance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Constructor.
+ * @param newEnvironment boolean establish an new environment.
+ * @param env Environment environment.
+ */
+ private MetaObjectCompiler(final boolean newEnvironment,
+ final Environment env) {
+ super("moc", "-version", new String[] {".h", ".cpp"}
+ , new String[0], ".moc", false, null, newEnvironment, env);
+ }
+
+ /**
+ * Add arguments for debug, etc.
+ * @param args Vector command argument list
+ * @param debug boolean build for debug if true
+ * @param multithreaded boolean build for multithreading if true
+ * @param exceptions boolean enable exceptions if true
+ * @param linkType LinkType output and runtime type
+ * @param rtti Boolean enable run-time type identification if true
+ * @param optimization OptimizationEnum optimization
+ */
+ protected void addImpliedArgs(final Vector args,
+ final boolean debug,
+ final boolean multithreaded,
+ final boolean exceptions,
+ final LinkType linkType,
+ final Boolean rtti,
+ final OptimizationEnum optimization) {
+ }
+
+ /**
+ * Add arguments for specified warning level.
+ * @param args Vector command line arguments
+ * @param level int warning level value
+ */
+ protected void addWarningSwitch(final Vector args, final int level) {
+ }
+
+ /**
+ * Change enviroment (deprecated).
+ * @param newEnvironment boolean use new environment.
+ * @param env Environment environment
+ * @return Processor modified processor
+ */
+ public Processor changeEnvironment(final boolean newEnvironment,
+ final Environment env) {
+ return this;
+ }
+
+ /**
+ * Gets a parser to scan source file for dependencies.
+ * @param source source file
+ * @return parser
+ */
+ protected Parser createParser(final File source) {
+ return new CParser();
+ }
+
+ /**
+ * Gets number of command line arguments per input file.
+ * @return int number of command line arguments per input file.
+ */
+ protected int getArgumentCountPerInputFile() {
+ return 3;
+ }
+
+ /**
+ * Returns the bid of the processor for the file.
+ *
+ * @param inputFile
+ * filename of input file
+ * @return 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
+ */
+ public int bid(final String inputFile) {
+ //
+ // get base bid
+ int baseBid = super.bid(inputFile);
+ //
+ // if the base bid was non-zero (.h or .cpp extension)
+ //
+ if (baseBid > 0) {
+ //
+ // scan the file for Q_OBJECT
+ // skip file if not present
+ //
+ try {
+ Reader reader = new BufferedReader(new FileReader(inputFile));
+ boolean hasQObject = MetaObjectParser.hasQObject(reader);
+ reader.close();
+ if (hasQObject) {
+ return baseBid;
+ }
+ } catch (IOException ex) {
+ return 0;
+ }
+ }
+ return 0;
+ }
+
+ /**
+ * Gets output file names.
+ * @param inputFile String input file name
+ * @param versionInfo version info, not used by this compiler.
+ * @return String[] output file names
+ */
+ public String[] getOutputFileNames(final String inputFile,
+ final VersionInfo versionInfo) {
+ if (inputFile.endsWith(".cpp")) {
+ return super.getOutputFileNames(inputFile, versionInfo);
+ }
+ //
+ // if a recognized input file
+ //
+ String baseName = getBaseOutputName(inputFile);
+ return new String[] {
+ "moc_" + baseName + ".cpp"};
+ }
+
+ /**
+ * Gets input file arguments.
+ * @param outputDir File output directory
+ * @param filename String input file name.
+ * @param index int argument index,
+ * 0 to getNumberOfArgumentsPerInputFile() -1
+ * @return String input file argument
+ */
+ protected String getInputFileArgument(final File outputDir,
+ final String filename,
+ final int index) {
+ switch (index) {
+ case 0:
+ return "-o";
+ case 1:
+ String outputFileName = getOutputFileNames(filename, null)[0];
+ return new File(outputDir, outputFileName)
+ .toString();
+
+ case 2:
+ return filename;
+
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Gets maximum length of command line.
+ * @return int maximum length of command line
+ */
+ public int getMaximumCommandLength() {
+ return 1024;
+ }
+
+ /**
+ * Gets maximum number of input files processed per command.
+ * @return int maximum number of input files processed per command.
+ */
+ protected int getMaximumInputFilesPerCommand() {
+ return 1;
+ }
+
+ /**
+ * Gets include directory switch.
+ * @param includeDir String include directory
+ * @return String command switch to add specified directory to search path
+ */
+ protected String getIncludeDirSwitch(final String includeDir) {
+ return "";
+ }
+
+ /**
+ * Gets switch to define preprocessor macro.
+ * @param buffer StringBuffer command line argument
+ * @param define String macro name
+ * @param value String macro value, may be null.
+ */
+ protected void getDefineSwitch(final StringBuffer buffer,
+ final String define,
+ final String value) {
+ }
+
+ /**
+ * Gets switch to undefine preprocessor macro.
+ * @param buffer StringBuffer command line argument
+ * @param define String macro name
+ */
+ protected void getUndefineSwitch(final StringBuffer buffer,
+ final String define) {
+ }
+
+ /**
+ * Gets standard include paths.
+ * @return File[] standard include paths
+ */
+ protected File[] getEnvironmentIncludePath() {
+ return new File[0];
+ }
+
+ /**
+ * Gets linker associated with this type.
+ * @param type LinkType linker, returns ld.
+ * @return Linker
+ */
+ public Linker getLinker(final LinkType type) {
+ return LdLinker.getInstance();
+ }
+
+ /**
+ * Get total command line length due to the input file.
+ * @param outputDir File output directory
+ * @param inputFile String input file
+ * @return int characters added to command line for the input file.
+ */
+ protected int getTotalArgumentLengthForInputFile(final File outputDir,
+ final String inputFile) {
+ String arg1 = getInputFileArgument(outputDir, inputFile, 0);
+ String arg2 = getInputFileArgument(outputDir, inputFile, 1);
+ return arg1.length() + arg2.length() + 3;
+ }
+}
diff --git a/src/main/java/net/sf/antcontrib/cpptasks/trolltech/MetaObjectParser.java b/src/main/java/net/sf/antcontrib/cpptasks/trolltech/MetaObjectParser.java
new file mode 100644
index 0000000..e75a116
--- /dev/null
+++ b/src/main/java/net/sf/antcontrib/cpptasks/trolltech/MetaObjectParser.java
@@ -0,0 +1,148 @@
+/*
+ *
+ * Copyright 2004 The Ant-Contrib project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.cpptasks.trolltech;
+
+import java.io.IOException;
+import java.io.Reader;
+
+import net.sf.antcontrib.cpptasks.parser.AbstractParser;
+import net.sf.antcontrib.cpptasks.parser.AbstractParserState;
+import net.sf.antcontrib.cpptasks.parser.LetterState;
+import net.sf.antcontrib.cpptasks.parser.WhitespaceOrLetterState;
+
+/**
+ * Scans a source file for Q_OBJECT.
+ *
+ * @author Curt Arnold
+ */
+public final class MetaObjectParser
+ extends AbstractParser {
+ /**
+ * Parser state that matches file T character.
+ */
+ private static final class FinalTState
+ extends AbstractParserState {
+ /**
+ * Parser.
+ */
+ private final MetaObjectParser mocParser;
+
+ /**
+ * Constructor.
+ * @param parser MetaObjectParser parser
+ */
+ public FinalTState(final MetaObjectParser parser) {
+ super(parser);
+ this.mocParser = parser;
+ }
+
+ /**
+ * Consumes a character and returns the next state for the parser.
+ *
+ * @param ch
+ * next character
+ * @return the configured nextState if ch is the expected character or the
+ * configure noMatchState otherwise.
+ */
+ public AbstractParserState consume(final char ch) {
+ if (ch == 'T') {
+ mocParser.setQObject(true);
+ return null;
+ }
+ if (ch == '\n') {
+ getParser().getNewLineState();
+ }
+ return null;
+ }
+ }
+
+ /**
+ * Determines if source file contains Q_OBJECT.
+ * @param reader Reader source reader
+ * @throws IOException if unable to read source file
+ * @return boolean true if source contains Q_OBJECT
+ */
+ public static boolean hasQObject(final Reader reader) throws IOException {
+ MetaObjectParser parser = new MetaObjectParser();
+ parser.parse(reader);
+ return parser.hasQObject;
+
+ }
+
+ /**
+ * Has Q_OBJECT been encountered.
+ */
+ private boolean hasQObject = false;
+
+ /**
+ * Parser state for start of new line.
+ */
+ private AbstractParserState newLineState;
+
+ /**
+ * Constructor.
+ *
+ */
+ private MetaObjectParser() {
+ //
+ // search for Q_OBJECT
+ //
+ AbstractParserState t = new FinalTState(this);
+ AbstractParserState c = new LetterState(this, 'C', t, null);
+ AbstractParserState e = new LetterState(this, 'E', c, null);
+ AbstractParserState j = new LetterState(this, 'J', e, null);
+ AbstractParserState b = new LetterState(this, 'B', j, null);
+ AbstractParserState o = new LetterState(this, 'O', b, null);
+ AbstractParserState underline = new LetterState(this, '_', o, null);
+ newLineState = new WhitespaceOrLetterState(this, 'Q', underline);
+ }
+
+ /**
+ * Adds a filename to the list of included files.
+ *
+ * @param filename filename to be added
+ */
+ protected void addFilename(final String filename) {
+
+ }
+
+ /**
+ * Gets new line state.
+ * @return AbstractParserState new line state.
+ */
+ public AbstractParserState getNewLineState() {
+ return newLineState;
+ }
+
+ /**
+ * Parse input file.
+ * @param reader Reader source file
+ * @throws IOException if error reading source file
+ */
+ public void parse(final Reader reader) throws IOException {
+ hasQObject = false;
+ super.parse(reader);
+ }
+
+ /**
+ * Called FinalTState to set that Q_OBJECT was found.
+ * @param value boolean new value for hasQObject
+ */
+ public void setQObject(final boolean value) {
+ this.hasQObject = value;
+ }
+}
diff --git a/src/main/java/net/sf/antcontrib/cpptasks/trolltech/UserInterfaceCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/trolltech/UserInterfaceCompiler.java
new file mode 100644
index 0000000..cc4cf3b
--- /dev/null
+++ b/src/main/java/net/sf/antcontrib/cpptasks/trolltech/UserInterfaceCompiler.java
@@ -0,0 +1,347 @@
+/*
+ *
+ * Copyright 2004 The Ant-Contrib project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.cpptasks.trolltech;
+
+import java.io.File;
+import java.util.Vector;
+
+import net.sf.antcontrib.cpptasks.CCTask;
+import net.sf.antcontrib.cpptasks.OptimizationEnum;
+import net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler;
+import net.sf.antcontrib.cpptasks.compiler.CommandLineCompilerConfiguration;
+import net.sf.antcontrib.cpptasks.compiler.LinkType;
+import net.sf.antcontrib.cpptasks.compiler.Linker;
+import net.sf.antcontrib.cpptasks.compiler.Processor;
+import net.sf.antcontrib.cpptasks.compiler.ProgressMonitor;
+import net.sf.antcontrib.cpptasks.gcc.LdLinker;
+import net.sf.antcontrib.cpptasks.parser.Parser;
+import net.sf.antcontrib.cpptasks.VersionInfo;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.Environment;
+
+/**
+ * Adapter for the Trolltech Qt UIC Compiler.
+ *
+ * @author Curt Arnold
+ */
+public final class UserInterfaceCompiler
+ extends CommandLineCompiler {
+ /**
+ * Singleton instance.
+ */
+ private static final UserInterfaceCompiler INSTANCE = new
+ UserInterfaceCompiler(
+ false, null);
+
+ /**
+ * Gets singleton instance of compiler.
+ * @return MetaObjectCompiler singleton instance
+ */
+ public static UserInterfaceCompiler getInstance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Constructor.
+ * @param newEnvironment boolean establish an new environment.
+ * @param env Environment environment.
+ */
+ private UserInterfaceCompiler(final boolean newEnvironment,
+ final Environment env) {
+ super("uic", "-version", new String[] {".ui"}
+ , new String[0], ".h", false, null, newEnvironment, env);
+ }
+
+ /**
+ * Add arguments for debug, etc.
+ * @param args Vector command argument list
+ * @param debug boolean build for debug if true
+ * @param multithreaded boolean build for multithreading if true
+ * @param exceptions boolean enable exceptions if true
+ * @param linkType LinkType output and runtime type
+ * @param rtti Boolean enable run-time type identification if true
+ * @param optimization OptimizationEnum optimization
+ */
+ protected void addImpliedArgs(final Vector args,
+ final boolean debug,
+ final boolean multithreaded,
+ final boolean exceptions,
+ final LinkType linkType,
+ final Boolean rtti,
+ final OptimizationEnum optimization) {
+ }
+
+ /**
+ * Add arguments for specified warning level.
+ * @param args Vector command line arguments
+ * @param level int warning level value
+ */
+ protected void addWarningSwitch(final Vector args, final int level) {
+ }
+
+ /**
+ * Change enviroment (deprecated).
+ * @param newEnvironment boolean use new environment.
+ * @param env Environment environment
+ * @return Processor modified processor
+ */
+ public Processor changeEnvironment(final boolean newEnvironment,
+ final Environment env) {
+ return this;
+ }
+
+ /**
+ * The include parser for C will work just fine, but we didn't want to
+ * inherit from CommandLineCCompiler.
+ * @param source source file to be parsed
+ * @return parser
+ */
+ protected Parser createParser(final File source) {
+ return new UserInterfaceParser();
+ }
+
+ /**
+ * Gets number of command line arguments per input file.
+ * @return int number of command line arguments per input file.
+ */
+ protected int getArgumentCountPerInputFile() {
+ return 3;
+ }
+
+ /**
+ * Gets output file names.
+ * @param inputFile String input file name
+ * @param versionInfo version info, not used by this compiler.
+ * @return String[] output file names
+ */
+ public String[] getOutputFileNames(final String inputFile,
+ final VersionInfo versionInfo) {
+ //
+ // if a recognized input file
+ //
+ String baseName = getBaseOutputName(inputFile);
+ return new String[] {
+ baseName + ".h",
+ baseName + ".cpp",
+ "moc_" + baseName + ".cpp"};
+ }
+
+ /**
+ * Gets input file arguments.
+ * @param outputDir File output directory
+ * @param filename String input file name.
+ * @param index int argument index,
+ * 0 to getNumberOfArgumentsPerInputFile() -1
+ * @return String input file argument
+ */
+ protected String getInputFileArgument(final File outputDir,
+ final String filename,
+ final int index) {
+ switch (index) {
+ case 0:
+ return "-o";
+
+ case 1:
+ String outputFileName = getOutputFileNames(filename, null)[0];
+ return new File(outputDir, outputFileName)
+ .toString();
+
+ case 2:
+ return filename;
+
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Gets maximum length of command line.
+ * @return int maximum length of command line
+ */
+ public int getMaximumCommandLength() {
+ return 1024;
+ }
+
+ /**
+ * Gets maximum number of input files processed per command.
+ * @return int maximum number of input files processed per command.
+ */
+ protected int getMaximumInputFilesPerCommand() {
+ return 1;
+ }
+
+ /**
+ * Gets include directory switch.
+ * @param includeDir String include directory
+ * @return String command switch to add specified directory to search path
+ */
+ protected String getIncludeDirSwitch(final String includeDir) {
+ return "";
+ }
+
+ /**
+ * Gets switch to define preprocessor macro.
+ * @param buffer StringBuffer command line argument
+ * @param define String macro name
+ * @param value String macro value, may be null.
+ */
+ protected void getDefineSwitch(final StringBuffer buffer,
+ final String define,
+ final String value) {
+ }
+
+ /**
+ * Gets switch to undefine preprocessor macro.
+ * @param buffer StringBuffer command line argument
+ * @param define String macro name
+ */
+ protected void getUndefineSwitch(final StringBuffer buffer,
+ final String define) {
+ }
+
+ /**
+ * Gets standard include paths.
+ * @return File[] standard include paths
+ */
+ protected File[] getEnvironmentIncludePath() {
+ return new File[0];
+ }
+
+ /**
+ * Gets linker associated with this type.
+ * @param type LinkType linker, returns ld.
+ * @return Linker
+ */
+ public Linker getLinker(final LinkType type) {
+ return LdLinker.getInstance();
+ }
+
+ /**
+ * Compiles an .ui file into the corresponding .h, .cpp and moc_*.cpp files.
+ * @param task current cc task
+ * @param outputDir output directory
+ * @param sourceFiles source files
+ * @param args command line arguments that appear before input files
+ * @param endArgs command line arguments that appear after input files
+ * @param relentless if true, do not stop at first compilation error
+ * @param config compiler configuration
+ * @param monitor progress monitor
+ */
+ public void compile(final CCTask task,
+ final File outputDir,
+ final String[] sourceFiles,
+ final String[] args,
+ final String[] endArgs,
+ final boolean relentless,
+ final CommandLineCompilerConfiguration config,
+ final ProgressMonitor monitor) {
+
+ BuildException exc = null;
+ String[] thisSource = new String[1];
+ String[] uicCommand = new String[args.length + endArgs.length + 4];
+ uicCommand[0] = "uic";
+ String[] uicImplCommand = new String[args.length + endArgs.length + 6];
+ uicImplCommand[0] = "uic";
+ String[] mocCommand = new String[args.length + endArgs.length + 4];
+ mocCommand[0] = "moc";
+ for (int i = 0; i < args.length; i++) {
+ uicCommand[i + 1] = args[i];
+ uicImplCommand[i + 1] = args[i];
+ mocCommand[i + i] = args[i];
+ }
+ uicCommand[args.length + 1] = "-o";
+ uicImplCommand[args.length + 1] = "-o";
+ mocCommand[args.length + 1] = "-o";
+
+ int uicIndex = args.length + 4;
+ int uicImplIndex = args.length + 6;
+ int mocIndex = args.length + 4;
+ for (int i = 0; i < endArgs.length; i++) {
+ uicCommand[uicIndex++] = endArgs[i];
+ uicImplCommand[uicImplIndex++] = endArgs[i];
+ mocCommand[mocIndex++] = endArgs[i];
+ }
+ for (int j = 0; j < sourceFiles.length; j++) {
+ uicIndex = args.length + 2;
+ uicImplIndex = args.length + 2;
+ mocIndex = args.length + 2;
+ String[] outputFileNames = getOutputFileNames(sourceFiles[j], null);
+
+ uicCommand[uicIndex++] = outputFileNames[0];
+ uicCommand[uicIndex++] = sourceFiles[j];
+
+ uicImplCommand[uicImplIndex++] = outputFileNames[1];
+ uicImplCommand[uicImplIndex++] = "-impl";
+ uicImplCommand[uicImplIndex++] = outputFileNames[0];
+ uicImplCommand[uicImplIndex++] = sourceFiles[j];
+
+ mocCommand[mocIndex++] = outputFileNames[2];
+ mocCommand[mocIndex++] = outputFileNames[0];
+
+ int retval = runCommand(task, outputDir, uicCommand);
+ if (retval == 0) {
+ retval = runCommand(task, outputDir, uicImplCommand);
+ if (retval == 0) {
+ retval = runCommand(task, outputDir, mocCommand);
+ }
+ }
+ if (monitor != null) {
+ thisSource[0] = sourceFiles[j];
+ monitor.progress(thisSource);
+ }
+ //
+ // if the process returned a failure code and
+ // we aren't holding an exception from an earlier
+ // interation
+ if (retval != 0 && exc == null) {
+ //
+ // construct the exception
+ //
+ exc = new BuildException(this.getCommand()
+ + " failed with return code " + retval, task
+ .getLocation());
+ //
+ // and throw it now unless we are relentless
+ //
+ if (!relentless) {
+ throw exc;
+ }
+ }
+ }
+ //
+ // if the compiler returned a failure value earlier
+ // then throw an exception
+ if (exc != null) {
+ throw exc;
+ }
+ }
+
+ /**
+ * Get total command line length due to the input file.
+ * @param outputDir File output directory
+ * @param inputFile String input file
+ * @return int characters added to command line for the input file.
+ */
+ protected int getTotalArgumentLengthForInputFile(
+ final File outputDir,
+ final String inputFile) {
+ String arg1 = getInputFileArgument(outputDir, inputFile, 1);
+ String arg2 = getInputFileArgument(outputDir, inputFile, 2);
+ return arg1.length() + arg2.length() + 4;
+ }
+}
diff --git a/src/main/java/net/sf/antcontrib/cpptasks/trolltech/UserInterfaceParser.java b/src/main/java/net/sf/antcontrib/cpptasks/trolltech/UserInterfaceParser.java
new file mode 100644
index 0000000..e3e309c
--- /dev/null
+++ b/src/main/java/net/sf/antcontrib/cpptasks/trolltech/UserInterfaceParser.java
@@ -0,0 +1,67 @@
+/*
+ *
+ * Copyright 2004 The Ant-Contrib project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.cpptasks.trolltech;
+
+import java.io.IOException;
+import java.io.Reader;
+
+import net.sf.antcontrib.cpptasks.parser.Parser;
+
+/**
+ * Dependency scanner for Trolltech Qt User Interface definition files.
+ *
+ * .ui files are XML documents that may contain an include elements,
+ * however the includes are just copied to the generated files and
+ * and changes to the includes do not need to trigger rerunning uic.
+ *
+ * @author Curt Arnold
+ */
+public final class UserInterfaceParser
+ implements Parser {
+
+ /**
+ * Constructor.
+ *
+ */
+ public UserInterfaceParser() {
+ }
+
+ /**
+ * Adds filename to the list of included files.
+ *
+ * @param include String included file name
+ */
+ public void addFilename(final String include) {
+ }
+
+ /**
+ * Gets included files.
+ * @return String[] included files
+ */
+ public String[] getIncludes() {
+ return new String[0];
+ }
+
+ /**
+ * Parses source file for dependencies.
+ *
+ * @param reader Reader reader
+ * @throws IOException if error reading source file
+ */
+ public void parse(final Reader reader) throws IOException {
+ }
+}
diff --git a/src/main/java/net/sf/antcontrib/cpptasks/trolltech/package.html b/src/main/java/net/sf/antcontrib/cpptasks/trolltech/package.html
new file mode 100644
index 0000000..c12d506
--- /dev/null
+++ b/src/main/java/net/sf/antcontrib/cpptasks/trolltech/package.html
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+
+Copyright 2004 The Ant-Contrib project
+
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ use this file except in compliance with the License. You may obtain a copy of
+ the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ License for the specific language governing permissions and limitations under
+ the License.
+
+-->
+</head>
+<body bgcolor="white">
+
+Adapters for Trolltech Qt moc and uic compilers.
+</body>
+</html>
+