]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/ConditionalPath.java
Restructuring for better separation of Tool packages.
[mirror_edk2.git] / Tools / Java / Source / Cpptasks / net / sf / antcontrib / cpptasks / types / ConditionalPath.java
CommitLineData
878ddf1f 1/*\r
2 * \r
3 * Copyright 2001-2004 The Ant-Contrib project\r
4 *\r
5 * Licensed under the Apache License, Version 2.0 (the "License");\r
6 * you may not use this file except in compliance with the License.\r
7 * You may obtain a copy of the License at\r
8 *\r
9 * http://www.apache.org/licenses/LICENSE-2.0\r
10 *\r
11 * Unless required by applicable law or agreed to in writing, software\r
12 * distributed under the License is distributed on an "AS IS" BASIS,\r
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
14 * See the License for the specific language governing permissions and\r
15 * limitations under the License.\r
16 */\r
17package net.sf.antcontrib.cpptasks.types;\r
18import java.io.File;\r
19\r
20import net.sf.antcontrib.cpptasks.CUtil;\r
21\r
22import org.apache.tools.ant.BuildException;\r
23import org.apache.tools.ant.Project;\r
24import org.apache.tools.ant.types.Path;\r
25/**\r
26 * An Ant Path object augmented with if and unless conditionals\r
27 * \r
28 * @author Curt Arnold\r
29 */\r
30public class ConditionalPath extends Path {\r
31 private String ifCond;\r
32 private String unlessCond;\r
33 private File file;\r
34 public ConditionalPath(Project project) {\r
35 super(project);\r
36 }\r
37 public ConditionalPath(Project p, String path) {\r
38 super(p, path);\r
39 }\r
40 public File getFile() {\r
41 return file;\r
42 }\r
43 /**\r
44 * Returns true if the Path's if and unless conditions (if any) are\r
45 * satisfied.\r
46 */\r
47 public boolean isActive(org.apache.tools.ant.Project p)\r
48 throws BuildException {\r
49 return CUtil.isActive(p, ifCond, unlessCond);\r
50 }\r
51 /**\r
52 * Sets the property name for the 'if' condition.\r
53 * \r
54 * The path will be ignored unless the property is defined.\r
55 * \r
56 * The value of the property is insignificant, but values that would imply\r
57 * misinterpretation ("false", "no") will throw an exception when\r
58 * evaluated.\r
59 * \r
60 * @param propName\r
61 * property name\r
62 */\r
63 public void setIf(String propName) {\r
64 ifCond = propName;\r
65 }\r
66 /**\r
67 * Set the property name for the 'unless' condition.\r
68 * \r
69 * If named property is set, the path will be ignored.\r
70 * \r
71 * The value of the property is insignificant, but values that would imply\r
72 * misinterpretation ("false", "no") of the behavior will throw an\r
73 * exception when evaluated.\r
74 * \r
75 * @param propName\r
76 * name of property\r
77 */\r
78 public void setUnless(String propName) {\r
79 unlessCond = propName;\r
80 }\r
81 /**\r
82 * Specifies the file which lists many include paths that should appear on \r
83 * the command line. Each line is an include path. The includepath will be \r
84 * quated if it contains embedded blanks. \r
85 * \r
86 * @param file\r
87 * name of the file\r
88 */\r
89 public void setFile(File file) {\r
90 this.file = file;\r
91 }\r
92}\r