2 This file is used to nest elements which is meant for tool's argument
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 package org
.tianocore
.framework
.tasks
;
17 ToolArg class is defined to represent the argument of a tool. The argument
18 includes the prefix (e.g. -I, -o) and the value.
20 public class ToolArg
extends NestElement
{
22 /// A constant which is used to represent an empty argument
24 public final static ToolArg EMPTY_ARG
= new ToolArg();
27 // Keep track the prefix of this argument
29 private String prefix
= "";
38 Constructor which will initialize the prefix of this argument
40 @param prefix The string of prefix
42 public ToolArg(String prefix
) {
47 Constructor which will initialize both the prefix and value of this argument
49 @param prefix The prefix of this argument
50 @param value The value of this argument
52 public ToolArg(String prefix
, String value
) {
53 setArg(prefix
, value
);
57 Set the prefix and value of this argument
59 @param prefix The prefix of this argument
60 @param value The value of this argument
62 public void setArg(String prefix
, String value
) {
68 Set the prefix of this argument
70 @param prefix The prefix of this argument
72 public void setPrefix(String prefix
) {
77 Get the prefix of this argument
79 @return String The prefix of this argument
81 public String
getPrefix() {
82 return this.prefix
.trim();
86 Set the value of this argument
88 @param value The value of this argument
90 public void setValue(String value
) {
95 Add a value for this argument
97 @param value The value of this argument
99 public void insValue(String value
) {
100 super.insName(value
);
104 Get the value list of this argument, separated by space
106 @return String The value list
108 public String
getValue() {
109 return super.toString(" ").trim();
113 Set the argument as a whole
115 @param line The argument string line
117 public void setLine(String line
) {
119 // Since the prefix is in the "line", we don't need another prefix.
126 Get the argument line
128 @return String The argument string line
130 public String
getLine() {
131 return this.toString();
135 Compose a complete argument string.
137 @return String The complete argument
139 public String
toString() {
140 return super.toString(prefix
);
144 Check if the argument is empty or not
148 public boolean isEmpty() {
149 return (prefix
.length() == 0) && (nameList
.isEmpty());