]>
Commit | Line | Data |
---|---|---|
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 | |
17 | package net.sf.antcontrib.cpptasks;\r | |
18 | /*******************************************************************************\r | |
19 | * Place class description here.\r | |
20 | * \r | |
21 | * @author inger\r | |
22 | * @author <additional author>\r | |
23 | * \r | |
24 | * @since \r | |
25 | ******************************************************************************/\r | |
26 | public class ProcessorParam {\r | |
27 | private String ifCond;\r | |
28 | private String name;\r | |
29 | private String unlessCond;\r | |
30 | private String value;\r | |
31 | public ProcessorParam() {\r | |
32 | }\r | |
33 | public String getName() {\r | |
34 | return name;\r | |
35 | }\r | |
36 | public String getValue() {\r | |
37 | return value;\r | |
38 | }\r | |
39 | /**\r | |
40 | * Returns true if the define's if and unless conditions (if any) are\r | |
41 | * satisfied.\r | |
42 | */\r | |
43 | public boolean isActive(org.apache.tools.ant.Project p) {\r | |
44 | if (value == null) {\r | |
45 | return false;\r | |
46 | }\r | |
47 | if (ifCond != null && p.getProperty(ifCond) == null) {\r | |
48 | return false;\r | |
49 | } else if (unlessCond != null && p.getProperty(unlessCond) != null) {\r | |
50 | return false;\r | |
51 | }\r | |
52 | return true;\r | |
53 | }\r | |
54 | /**\r | |
55 | * Sets the property name for the 'if' condition.\r | |
56 | * \r | |
57 | * The argument will be ignored unless the property is defined.\r | |
58 | * \r | |
59 | * The value of the property is insignificant, but values that would imply\r | |
60 | * misinterpretation ("false", "no") will throw an exception when\r | |
61 | * evaluated.\r | |
62 | */\r | |
63 | public void setIf(String propName) {\r | |
64 | ifCond = propName;\r | |
65 | }\r | |
66 | /**\r | |
67 | * Specifies relative location of argument on command line. "start" will\r | |
68 | * place argument at start of command line, "mid" will place argument after\r | |
69 | * all "start" arguments but before filenames, "end" will place argument\r | |
70 | * after filenames.\r | |
71 | * \r | |
72 | */\r | |
73 | public void setName(String name) {\r | |
74 | this.name = name;\r | |
75 | }\r | |
76 | /**\r | |
77 | * Set the property name for the 'unless' condition.\r | |
78 | * \r | |
79 | * If named property is set, the argument will be ignored.\r | |
80 | * \r | |
81 | * The value of the property is insignificant, but values that would imply\r | |
82 | * misinterpretation ("false", "no") of the behavior will throw an\r | |
83 | * exception when evaluated.\r | |
84 | * \r | |
85 | * @param propName\r | |
86 | * name of property\r | |
87 | */\r | |
88 | public void setUnless(String propName) {\r | |
89 | unlessCond = propName;\r | |
90 | }\r | |
91 | /**\r | |
92 | * Specifies the string that should appear on the command line. The\r | |
93 | * argument will be quoted if it contains embedded blanks. Use multiple\r | |
94 | * arguments to avoid quoting.\r | |
95 | * \r | |
96 | */\r | |
97 | public void setValue(String value) {\r | |
98 | this.value = value;\r | |
99 | }\r | |
100 | }\r |