]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/VersionInfo.java
Restructuring for better separation of Tool packages.
[mirror_edk2.git] / Tools / Java / Source / Cpptasks / net / sf / antcontrib / cpptasks / VersionInfo.java
1 /*
2 *
3 * Copyright 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 import java.io.IOException;
20 import java.io.Writer;
21
22 import org.apache.tools.ant.BuildException;
23 import org.apache.tools.ant.Project;
24 import org.apache.tools.ant.types.DataType;
25 import org.apache.tools.ant.types.Reference;
26
27 /**
28 * Version Information. (Non-functional prototype)
29 *
30 */
31 public class VersionInfo extends DataType {
32 /**
33 * if property.
34 */
35 private String ifCond;
36 /**
37 * unless property.
38 */
39 private String unlessCond;
40
41 /**
42 * extends property.
43 */
44 private String extendsId;
45
46 /**
47 * file version.
48 *
49 */
50 private String fileVersion;
51 /**
52 * Product version.
53 *
54 */
55 private String productVersion;
56 /**
57 * file language.
58 *
59 */
60 private String language;
61
62 /**
63 * comments.
64 *
65 */
66 private String fileComments;
67 /**
68 * Company name.
69 *
70 */
71 private String companyName;
72 /**
73 * Description.
74 *
75 */
76 private String description;
77 /**
78 * internal name.
79 */
80 private String internalName;
81 /**
82 * legal copyright.
83 *
84 */
85 private String legalCopyright;
86 /**
87 * legal trademark.
88 *
89 */
90 private String legalTrademark;
91 /**
92 * original filename.
93 *
94 */
95 private String originalFilename;
96 /**
97 * private build.
98 *
99 */
100 private String privateBuild;
101 /**
102 * product name.
103 *
104 */
105 private String productName;
106 /**
107 * Special build
108 */
109 private String specialBuild;
110 /**
111 * compatibility version
112 *
113 */
114 private String compatibilityVersion;
115
116
117 /**
118 * Constructor.
119 *
120 */
121 public VersionInfo() {
122 }
123 public void execute() throws org.apache.tools.ant.BuildException {
124 throw new org.apache.tools.ant.BuildException(
125 "Not an actual task, but looks like one for documentation purposes");
126 }
127 /**
128 * Returns true if the define's if and unless conditions (if any) are
129 * satisfied.
130 *
131 * @exception BuildException
132 * throws build exception if name is not set
133 */
134 public final boolean isActive() throws BuildException {
135 return CUtil.isActive(getProject(), ifCond, unlessCond);
136 }
137 /**
138 * Sets an id that can be used to reference this element.
139 *
140 * @param id
141 * id
142 */
143 public void setId(String id) {
144 //
145 // this is actually accomplished by a different
146 // mechanism, but we can document it
147 //
148 }
149 /**
150 * Sets the name of a version info that this info extends.
151 *
152 * @param id
153 * id
154 */
155 public void setExtends(String id) {
156 extendsId = id;
157 }
158
159
160 /**
161 * Sets the property name for the 'if' condition.
162 *
163 * The define will be ignored unless the property is defined.
164 *
165 * The value of the property is insignificant, but values that would imply
166 * misinterpretation ("false", "no") will throw an exception when
167 * evaluated.
168 *
169 * @param propName
170 * property name
171 */
172 public final void setIf(String propName) {
173 ifCond = propName;
174 }
175 /**
176 * Specifies that this element should behave as if the content of the
177 * element with the matching id attribute was inserted at this location. If
178 * specified, no other attributes should be specified.
179 *
180 */
181 public void setRefid(Reference r) throws BuildException {
182 super.setRefid(r);
183 }
184 /**
185 * Set the property name for the 'unless' condition.
186 *
187 * If named property is set, the define will be ignored.
188 *
189 * The value of the property is insignificant, but values that would imply
190 * misinterpretation ("false", "no") of the behavior will throw an
191 * exception when evaluated.
192 *
193 * @param propName
194 * name of property
195 */
196 public final void setUnless(String propName) {
197 unlessCond = propName;
198 }
199 /**
200 * Gets file version.
201 * @return file version, may be null.
202 *
203 */
204 public String getFileversion() {
205 if (isReference()) {
206 VersionInfo refVersion = (VersionInfo)
207 getCheckedRef(VersionInfo.class,
208 "VersionInfo");
209 return refVersion.getFileversion();
210 }
211 return fileVersion;
212 }
213 /**
214 * Gets Product version.
215 * @return product version, may be null
216 */
217 public String getProductversion() {
218 if (isReference()) {
219 VersionInfo refVersion = (VersionInfo)
220 getCheckedRef(VersionInfo.class,
221 "VersionInfo");
222 return refVersion.getProductversion();
223 }
224 return productVersion;
225 }
226 /**
227 * Gets compatibility version.
228 * @return compatibility version, may be null
229 */
230 public String getCompatibilityversion() {
231 if (isReference()) {
232 VersionInfo refVersion = (VersionInfo)
233 getCheckedRef(VersionInfo.class,
234 "VersionInfo");
235 return refVersion.getCompatibilityversion();
236 }
237 return compatibilityVersion;
238 }
239 /**
240 * Gets file language, should be an IETF RFC 3066 identifier, for example, en-US.
241 * @return language, may be null.
242 */
243 public String getLanguage() {
244 if (isReference()) {
245 VersionInfo refVersion = (VersionInfo)
246 getCheckedRef(VersionInfo.class,
247 "VersionInfo");
248 return refVersion.getLanguage();
249 }
250 return language;
251 }
252
253 /**
254 * Gets comments.
255 * @return comments, may be null.
256 */
257 public String getFilecomments() {
258 if (isReference()) {
259 VersionInfo refVersion = (VersionInfo)
260 getCheckedRef(VersionInfo.class,
261 "VersionInfo");
262 return refVersion.getFilecomments();
263 }
264 return fileComments;
265 }
266 /**
267 * Gets Company name.
268 * @return company name, may be null.
269 */
270 public String getCompanyname() {
271 if (isReference()) {
272 VersionInfo refVersion = (VersionInfo)
273 getCheckedRef(VersionInfo.class,
274 "VersionInfo");
275 return refVersion.getCompanyname();
276 }
277 return companyName;
278 }
279 /**
280 * Gets Description.
281 * @return description, may be null.
282 */
283 public String getDescription() {
284 if (isReference()) {
285 VersionInfo refVersion = (VersionInfo)
286 getCheckedRef(VersionInfo.class,
287 "VersionInfo");
288 return refVersion.getDescription();
289 }
290 return description;
291 }
292 /**
293 * Gets internal name.
294 * @return internal name, may be null.
295 */
296 public String getInternalname() {
297 if (isReference()) {
298 VersionInfo refVersion = (VersionInfo)
299 getCheckedRef(VersionInfo.class,
300 "VersionInfo");
301 return refVersion.getInternalname();
302 }
303 return internalName;
304 }
305 /**
306 * Gets legal copyright.
307 * @return legal copyright, may be null.
308 */
309 public String getLegalcopyright() {
310 if (isReference()) {
311 VersionInfo refVersion = (VersionInfo)
312 getCheckedRef(VersionInfo.class,
313 "VersionInfo");
314 return refVersion.getLegalcopyright();
315 }
316 return legalCopyright;
317 }
318 /**
319 * Gets legal trademark.
320 * @return legal trademark, may be null;
321 */
322 public String getLegaltrademark() {
323 if (isReference()) {
324 VersionInfo refVersion = (VersionInfo)
325 getCheckedRef(VersionInfo.class,
326 "VersionInfo");
327 return refVersion.getLegaltrademark();
328 }
329 return legalTrademark;
330 }
331 /**
332 * Gets original filename.
333 * @return original filename, may be null.
334 */
335 public String getOriginalfilename() {
336 if (isReference()) {
337 VersionInfo refVersion = (VersionInfo)
338 getCheckedRef(VersionInfo.class,
339 "VersionInfo");
340 return refVersion.getOriginalfilename();
341 }
342 return originalFilename;
343 }
344 /**
345 * Gets private build.
346 * @return private build, may be null.
347 */
348 public String getPrivatebuild() {
349 if (isReference()) {
350 VersionInfo refVersion = (VersionInfo)
351 getCheckedRef(VersionInfo.class,
352 "VersionInfo");
353 return refVersion.getPrivatebuild();
354 }
355 return privateBuild;
356 }
357 /**
358 * Gets product name.
359 * @return product name, may be null.
360 */
361 public String getProductname() {
362 if (isReference()) {
363 VersionInfo refVersion = (VersionInfo)
364 getCheckedRef(VersionInfo.class,
365 "VersionInfo");
366 return refVersion.getProductname();
367 }
368 return productName;
369 }
370 /**
371 * Special build
372 * @return special build, may be null.
373 */
374 public String getSpecialbuild() {
375 if (isReference()) {
376 VersionInfo refVersion = (VersionInfo)
377 getCheckedRef(VersionInfo.class,
378 "VersionInfo");
379 return refVersion.getSpecialbuild();
380 }
381 return specialBuild;
382 }
383
384 /**
385 * Sets file version.
386 * @param value new value
387 * @throws BuildException if specified with refid
388 */
389 public void setFileversion(String value) throws BuildException {
390 if (isReference()) {
391 throw tooManyAttributes();
392 }
393 fileVersion = value;
394 }
395 /**
396 * Sets product version.
397 * @param value new value
398 * @throws BuildException if specified with refid
399 */
400 public void setProductversion(String value) throws BuildException {
401 if (isReference()) {
402 throw tooManyAttributes();
403 }
404 productVersion = value;
405 }
406 /**
407 * Sets compatibility version.
408 * @param value new value
409 * @throws BuildException if specified with refid
410 */
411 public void setCompatibilityversion(String value) throws BuildException {
412 if (isReference()) {
413 throw tooManyAttributes();
414 }
415 compatibilityVersion = value;
416 }
417 /**
418 * Sets language.
419 * @param value new value, should be an IETF RFC 3066 language identifier.
420 * @throws BuildException if specified with refid
421 */
422 public void setLanguage(String value) throws BuildException {
423 if (isReference()) {
424 throw tooManyAttributes();
425 }
426 language = value;
427 }
428 /**
429 * Sets comments.
430 * @param value new value
431 * @throws BuildException if specified with refid
432 */
433 public void setFilecomments(String value) throws BuildException {
434 if (isReference()) {
435 throw tooManyAttributes();
436 }
437 fileComments = value;
438 }
439
440 /**
441 * Sets company name.
442 * @param value new value
443 * @throws BuildException if specified with refid
444 */
445 public void setCompanyname(String value) throws BuildException {
446 if (isReference()) {
447 throw tooManyAttributes();
448 }
449 companyName = value;
450 }
451
452
453 /**
454 * Sets internal name. Internal name will automatically be
455 * specified from build step, only set this value if
456 * intentionally overriding that value.
457 *
458 * @param value new value
459 * @throws BuildException if specified with refid
460 */
461 public void setInternalname(String value) throws BuildException {
462 if (isReference()) {
463 throw tooManyAttributes();
464 }
465 internalName = value;
466 }
467
468 /**
469 * Sets legal copyright.
470 * @param value new value
471 * @throws BuildException if specified with refid
472 */
473 public void setLegalcopyright(String value) throws BuildException {
474 if (isReference()) {
475 throw tooManyAttributes();
476 }
477 legalCopyright = value;
478 }
479 /**
480 * Sets legal trademark.
481 * @param value new value
482 * @throws BuildException if specified with refid
483 */
484 public void setLegaltrademark(String value) throws BuildException {
485 if (isReference()) {
486 throw tooManyAttributes();
487 }
488 legalTrademark = value;
489 }
490 /**
491 * Sets original name. Only set this value if
492 * intentionally overriding the value from the build set.
493 *
494 * @param value new value
495 * @throws BuildException if specified with refid
496 */
497 public void setOriginalfilename(String value) throws BuildException {
498 if (isReference()) {
499 throw tooManyAttributes();
500 }
501 originalFilename = value;
502 }
503 /**
504 * Sets private build.
505 * @param value new value
506 * @throws BuildException if specified with refid
507 */
508 public void setPrivatebuild(String value) throws BuildException {
509 if (isReference()) {
510 throw tooManyAttributes();
511 }
512 privateBuild = value;
513 }
514 /**
515 * Sets product name.
516 * @param value new value
517 * @throws BuildException if specified with refid
518 */
519 public void setProductname(String value) throws BuildException {
520 if (isReference()) {
521 throw tooManyAttributes();
522 }
523 productName= value;
524 }
525 /**
526 * Sets private build.
527 * @param value new value
528 * @throws BuildException if specified with refid
529 */
530 public void setSpecialbuild(String value) throws BuildException {
531 if (isReference()) {
532 throw tooManyAttributes();
533 }
534 specialBuild = value;
535 }
536
537 /**
538 * Writes windows resource
539 * @param writer writer, may not be null.
540 * @param project project, may not be null
541 * @param executableName name of executable
542 */
543 public void writeResource(final Writer writer,
544 final Project p,
545 final String executableName) throws IOException {
546 // TODO:
547
548 }
549
550 }