--- /dev/null
+/*\r
+ * \r
+ * Copyright 2001-2004 The Ant-Contrib project\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package net.sf.antcontrib.cpptasks.types;\r
+import java.io.File;\r
+\r
+import net.sf.antcontrib.cpptasks.CUtil;\r
+\r
+import org.apache.tools.ant.BuildException;\r
+import org.apache.tools.ant.Project;\r
+import org.apache.tools.ant.types.Path;\r
+/**\r
+ * An Ant Path object augmented with if and unless conditionals\r
+ * \r
+ * @author Curt Arnold\r
+ */\r
+public class ConditionalPath extends Path {\r
+ private String ifCond;\r
+ private String unlessCond;\r
+ private File file;\r
+ public ConditionalPath(Project project) {\r
+ super(project);\r
+ }\r
+ public ConditionalPath(Project p, String path) {\r
+ super(p, path);\r
+ }\r
+ public File getFile() {\r
+ return file;\r
+ }\r
+ /**\r
+ * Returns true if the Path's if and unless conditions (if any) are\r
+ * satisfied.\r
+ */\r
+ public boolean isActive(org.apache.tools.ant.Project p)\r
+ throws BuildException {\r
+ return CUtil.isActive(p, ifCond, unlessCond);\r
+ }\r
+ /**\r
+ * Sets the property name for the 'if' condition.\r
+ * \r
+ * The path will be ignored unless the property is defined.\r
+ * \r
+ * The value of the property is insignificant, but values that would imply\r
+ * misinterpretation ("false", "no") will throw an exception when\r
+ * evaluated.\r
+ * \r
+ * @param propName\r
+ * property name\r
+ */\r
+ public void setIf(String propName) {\r
+ ifCond = propName;\r
+ }\r
+ /**\r
+ * Set the property name for the 'unless' condition.\r
+ * \r
+ * If named property is set, the path will be ignored.\r
+ * \r
+ * The value of the property is insignificant, but values that would imply\r
+ * misinterpretation ("false", "no") of the behavior will throw an\r
+ * exception when evaluated.\r
+ * \r
+ * @param propName\r
+ * name of property\r
+ */\r
+ public void setUnless(String propName) {\r
+ unlessCond = propName;\r
+ }\r
+ /**\r
+ * Specifies the file which lists many include paths that should appear on \r
+ * the command line. Each line is an include path. The includepath will be \r
+ * quated if it contains embedded blanks. \r
+ * \r
+ * @param file\r
+ * name of the file\r
+ */\r
+ public void setFile(File file) {\r
+ this.file = file;\r
+ }\r
+}\r