]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/TargetDef.java
3 * Copyright 2004 The Ant-Contrib project
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package net
.sf
.antcontrib
.cpptasks
;
19 import org
.apache
.tools
.ant
.types
.DataType
;
20 import org
.apache
.tools
.ant
.types
.Reference
;
23 * Information on the execution platforms for the generated code.
24 * (Non-functional prototype)
27 public final class TargetDef
32 private String ifCond
;
37 private String unlessCond
;
49 private ArchEnum arch
;
55 private OSFamilyEnum osFamily
;
65 * Bogus method required for documentation generation.
67 public void execute() {
68 throw new org
.apache
.tools
.ant
.BuildException(
69 "Not an actual task, but looks like one for documentation purposes");
73 * Returns true if the define's if and unless conditions (if any) are
75 * @return true if active
77 public boolean isActive() {
78 return CUtil
.isActive(getProject(), ifCond
, unlessCond
);
82 * Sets a description of the current data type.
83 * @param desc description
85 public void setDescription(final String desc
) {
86 super.setDescription(desc
);
90 * Sets an id that can be used to reference this element.
95 public void setId(final String id
) {
97 // this is actually accomplished by a different
98 // mechanism, but we can document it
103 * Sets the property name for the 'if' condition.
105 * The define will be ignored unless the property is defined.
107 * The value of the property is insignificant, but values that would imply
108 * misinterpretation ("false", "no") will throw an exception when
114 public void setIf(final String propName
) {
119 * Specifies that this element should behave as if the content of the
120 * element with the matching id attribute was inserted at this location. If
121 * specified, no other attributes should be specified.
122 * @param r id of referenced target
124 public void setRefid(final Reference r
) {
129 * Set the property name for the 'unless' condition.
131 * If named property is set, the define will be ignored.
133 * The value of the property is insignificant, but values that would imply
134 * misinterpretation ("false", "no") of the behavior will throw an
135 * exception when evaluated.
140 public void setUnless(final String propName
) {
141 unlessCond
= propName
;
146 * @return cpu, may be null.
149 public CPUEnum
getCpu() {
151 TargetDef refPlatform
= (TargetDef
)
152 getCheckedRef(TargetDef
.class,
154 return refPlatform
.getCpu();
161 * @return arch, may be null.
164 public ArchEnum
getArch() {
166 TargetDef refPlatform
= (TargetDef
)
167 getCheckedRef(TargetDef
.class,
169 return refPlatform
.getArch();
175 * Gets operating system family.
176 * @return os family, may be null.
179 public OSFamilyEnum
getOsfamily() {
181 TargetDef refPlatform
= (TargetDef
)
182 getCheckedRef(TargetDef
.class,
184 return refPlatform
.getOsfamily();
190 * Sets preferred cpu, but does not use cpu specific instructions.
191 * @param value new value
193 public void setCpu(final CPUEnum value
) {
195 throw tooManyAttributes();
201 * Sets cpu architecture, compiler may use cpu specific instructions.
202 * @param value new value
204 public void setArch(final ArchEnum value
) {
206 throw tooManyAttributes();
209 throw tooManyAttributes();
215 * Sets operating system family.
216 * @param value new value
218 public void setOsfamily(final OSFamilyEnum value
) {
220 throw tooManyAttributes();
223 throw tooManyAttributes();