]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/CommandLineArgument.java
Changed spelling to manifest
[mirror_edk2.git] / Tools / Source / Cpptasks / net / sf / antcontrib / cpptasks / types / CommandLineArgument.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
18\r
19import org.apache.tools.ant.types.EnumeratedAttribute;\r
20import java.io.File;\r
21/**\r
22 * An compiler/linker command line flag.\r
23 */\r
24public class CommandLineArgument {\r
25 /**\r
26 * Enumerated attribute with the values "start", "mid" and "end",\r
27 */\r
28 public static class LocationEnum extends EnumeratedAttribute {\r
29 public String[] getValues() {\r
30 return new String[]{"start", "mid", "end"};\r
31 }\r
32 }\r
33 private String ifCond;\r
34 private int location;\r
35 private String unlessCond;\r
36 private String value;\r
37 private File file;\r
38 public CommandLineArgument() {\r
39 }\r
40 public int getLocation() {\r
41 return location;\r
42 }\r
43 public String getValue() {\r
44 return value;\r
45 }\r
46 public File getFile() {\r
47 return file;\r
48 }\r
49 /**\r
50 * Returns true if the define's if and unless conditions (if any) are\r
51 * satisfied.\r
52 */\r
53 public boolean isActive(org.apache.tools.ant.Project p) {\r
54 if (value == null) {\r
55 return false;\r
56 }\r
57 if (ifCond != null && p.getProperty(ifCond) == null) {\r
58 return false;\r
59 } else if (unlessCond != null && p.getProperty(unlessCond) != null) {\r
60 return false;\r
61 }\r
62 return true;\r
63 }\r
64 /**\r
65 * Sets the property name for the 'if' condition.\r
66 * \r
67 * The argument will be ignored unless the property is defined.\r
68 * \r
69 * The value of the property is insignificant, but values that would imply\r
70 * misinterpretation ("false", "no") will throw an exception when\r
71 * evaluated.\r
72 */\r
73 public void setIf(String propName) {\r
74 ifCond = propName;\r
75 }\r
76 /**\r
77 * Specifies relative location of argument on command line. "start" will\r
78 * place argument at start of command line, "mid" will place argument after\r
79 * all "start" arguments but before filenames, "end" will place argument\r
80 * after filenames.\r
81 * \r
82 */\r
83 public void setLocation(LocationEnum location) {\r
84 this.location = location.getIndex();\r
85 }\r
86 /**\r
87 * Set the property name for the 'unless' condition.\r
88 * \r
89 * If named property is set, the argument will be ignored.\r
90 * \r
91 * The value of the property is insignificant, but values that would imply\r
92 * misinterpretation ("false", "no") of the behavior will throw an\r
93 * exception when evaluated.\r
94 * \r
95 * @param propName\r
96 * name of property\r
97 */\r
98 public void setUnless(String propName) {\r
99 unlessCond = propName;\r
100 }\r
101 /**\r
102 * Specifies the string that should appear on the command line. The\r
103 * argument will be quoted if it contains embedded blanks. Use multiple\r
104 * arguments to avoid quoting.\r
105 * \r
106 */\r
107 public void setValue(String value) {\r
108 this.value = value;\r
109 }\r
110 /**\r
111 * Specifies the file which lists many strings that should appear on \r
112 * the command line. Each line is one argument. The argument will be \r
113 * quated if it contains embedded blanks. Use multiple arguments in \r
114 * file to avoid quating. \r
115 * \r
116 * @param file\r
117 * name of the file\r
118 */\r
119 public void setFile(File file) {\r
120 this.file = file;\r
121 }\r
122}\r