+++ /dev/null
-/** @file\r
-This file is used to nest elements which is meant for tool's argument\r
-\r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-package org.tianocore.framework.tasks;\r
-\r
-/**\r
- ToolArg class is defined to represent the argument of a tool. The argument \r
- includes the prefix (e.g. -I, -o) and the value.\r
- **/\r
-public class ToolArg extends NestElement {\r
- ///\r
- /// A constant which is used to represent an empty argument\r
- /// \r
- public final static ToolArg EMPTY_ARG = new ToolArg();\r
-\r
- //\r
- // Keep track the prefix of this argument\r
- // \r
- private String prefix = "";\r
-\r
- /**\r
- Default constructor\r
- **/\r
- public ToolArg() {\r
- }\r
-\r
- /**\r
- Constructor which will initialize the prefix of this argument\r
-\r
- @param prefix The string of prefix\r
- */\r
- public ToolArg(String prefix) {\r
- this.prefix = prefix;\r
- }\r
-\r
- /**\r
- Constructor which will initialize both the prefix and value of this argument\r
- \r
- @param prefix The prefix of this argument\r
- @param value The value of this argument\r
- */\r
- public ToolArg(String prefix, String value) {\r
- setArg(prefix, value);\r
- }\r
-\r
- /**\r
- Set the prefix and value of this argument\r
-\r
- @param prefix The prefix of this argument\r
- @param value The value of this argument \r
- */\r
- public void setArg(String prefix, String value) {\r
- this.prefix = prefix;\r
- super.setName(value);\r
- }\r
-\r
- /**\r
- Set the prefix of this argument\r
-\r
- @param prefix The prefix of this argument\r
- */\r
- public void setPrefix(String prefix) {\r
- this.prefix = prefix;\r
- }\r
-\r
- /**\r
- Get the prefix of this argument\r
-\r
- @return String The prefix of this argument\r
- */\r
- public String getPrefix() {\r
- return this.prefix.trim();\r
- }\r
-\r
- /**\r
- Set the value of this argument\r
-\r
- @param value The value of this argument\r
- */\r
- public void setValue(String value) {\r
- super.setName(value);\r
- }\r
-\r
- /**\r
- Add a value for this argument\r
-\r
- @param value The value of this argument\r
- */\r
- public void insValue(String value) {\r
- super.insName(value);\r
- }\r
-\r
- /**\r
- Get the value list of this argument, separated by space\r
-\r
- @return String The value list\r
- */\r
- public String getValue() {\r
- return super.toString(" ").trim();\r
- }\r
-\r
- /**\r
- Set the argument as a whole\r
-\r
- @param line The argument string line\r
- */\r
- public void setLine(String line) {\r
- //\r
- // Since the prefix is in the "line", we don't need another prefix.\r
- // \r
- this.prefix = " ";\r
- super.setName(line);\r
- }\r
-\r
- /**\r
- Get the argument line\r
-\r
- @return String The argument string line\r
- */\r
- public String getLine() {\r
- return this.toString();\r
- }\r
-\r
- /**\r
- Compose a complete argument string.\r
-\r
- @return String The complete argument\r
- */\r
- public String toString() {\r
- return super.toString(prefix);\r
- }\r
-\r
- /**\r
- Check if the argument is empty or not\r
-\r
- @return boolean\r
- **/\r
- public boolean isEmpty() {\r
- return (prefix.length() == 0) && (nameList.isEmpty());\r
- }\r
-}\r