]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/ProcessorParam.java
Initial import.
[mirror_edk2.git] / Tools / Source / Cpptasks / net / sf / antcontrib / cpptasks / ProcessorParam.java
1 /*
2 *
3 * Copyright 2001-2004 The Ant-Contrib project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package net.sf.antcontrib.cpptasks;
18 /*******************************************************************************
19 * Place class description here.
20 *
21 * @author inger
22 * @author <additional author>
23 *
24 * @since
25 ******************************************************************************/
26 public class ProcessorParam {
27 private String ifCond;
28 private String name;
29 private String unlessCond;
30 private String value;
31 public ProcessorParam() {
32 }
33 public String getName() {
34 return name;
35 }
36 public String getValue() {
37 return value;
38 }
39 /**
40 * Returns true if the define's if and unless conditions (if any) are
41 * satisfied.
42 */
43 public boolean isActive(org.apache.tools.ant.Project p) {
44 if (value == null) {
45 return false;
46 }
47 if (ifCond != null && p.getProperty(ifCond) == null) {
48 return false;
49 } else if (unlessCond != null && p.getProperty(unlessCond) != null) {
50 return false;
51 }
52 return true;
53 }
54 /**
55 * Sets the property name for the 'if' condition.
56 *
57 * The argument will be ignored unless the property is defined.
58 *
59 * The value of the property is insignificant, but values that would imply
60 * misinterpretation ("false", "no") will throw an exception when
61 * evaluated.
62 */
63 public void setIf(String propName) {
64 ifCond = propName;
65 }
66 /**
67 * Specifies relative location of argument on command line. "start" will
68 * place argument at start of command line, "mid" will place argument after
69 * all "start" arguments but before filenames, "end" will place argument
70 * after filenames.
71 *
72 */
73 public void setName(String name) {
74 this.name = name;
75 }
76 /**
77 * Set the property name for the 'unless' condition.
78 *
79 * If named property is set, the argument will be ignored.
80 *
81 * The value of the property is insignificant, but values that would imply
82 * misinterpretation ("false", "no") of the behavior will throw an
83 * exception when evaluated.
84 *
85 * @param propName
86 * name of property
87 */
88 public void setUnless(String propName) {
89 unlessCond = propName;
90 }
91 /**
92 * Specifies the string that should appear on the command line. The
93 * argument will be quoted if it contains embedded blanks. Use multiple
94 * arguments to avoid quoting.
95 *
96 */
97 public void setValue(String value) {
98 this.value = value;
99 }
100 }