+++ /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 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.AbstractFileSet;\r
-import org.apache.tools.ant.types.FileSet;\r
-/**\r
- * An Ant FileSet object augmented with if and unless conditions.\r
- * \r
- * @author Curt Arnold\r
- */\r
-public class ConditionalFileSet extends FileSet {\r
- private String ifCond;\r
- private String unlessCond;\r
- public ConditionalFileSet() {\r
- }\r
- public void execute() throws org.apache.tools.ant.BuildException {\r
- throw new org.apache.tools.ant.BuildException(\r
- "Not an actual task, but looks like one for documentation purposes");\r
- }\r
- /**\r
- * overrides FileSet's implementation which would throw an exception since\r
- * the referenced object isn't this type.\r
- */\r
- protected AbstractFileSet getRef(Project p) {\r
- return (AbstractFileSet) getRefid().getReferencedObject(p);\r
- }\r
- /**\r
- * Returns true if the Path's if and unless conditions (if any) are\r
- * satisfied.\r
- */\r
- public boolean isActive() throws BuildException {\r
- Project p = getProject();\r
- if (p == null) {\r
- throw new java.lang.IllegalStateException(\r
- "setProject() should have been called");\r
- }\r
- return CUtil.isActive(p, ifCond, unlessCond);\r
- }\r
- /**\r
- * Sets the property name for the 'if' condition.\r
- * \r
- * The fileset 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
- 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 fileset 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