]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/PcdTools/org/tianocore/pcd/entity/DynamicTokenValue.java
2 DynamicTokenValue class.
4 This module contains the value type of a dynamic token.
6 Copyright (c) 2006, Intel Corporation
7 All rights reserved. This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 package org
.tianocore
.pcd
.entity
;
18 import java
.util
.List
;
19 import java
.util
.UUID
;
21 import org
.tianocore
.pcd
.exception
.EntityException
;
23 /** This class is to descript a value type of dynamic PCD.
24 For a dynamic or dynamicEx type PCD data, the value type can be:
25 1) Hii type: the value of dynamic or dynamicEx is stored into a variable.
26 2) Vpd type: the value of dynamic or dynamicEx is stored into somewhere set
28 3) Default type: the value of dynamic or dynamicEx is stored into PCD dynamic
31 public class DynamicTokenValue
{
33 /// Enumeration macro defintion for value type.
34 /// BUGBUG: Not use upcase charater is to facility for reading. It may be changed
36 public enum VALUE_TYPE
{HII_TYPE
, VPD_TYPE
, DEFAULT_TYPE
}
38 public VALUE_TYPE type
;
41 /// ---------------------------------------------------------------------
42 /// Following member is for HII case.
43 /// ---------------------------------------------------------------------
47 /// variableName is valid only when this token support Hii functionality. variableName
48 /// indicates the value of token is associated with what variable.
49 /// variableName is defined in FPD.
50 public List variableName
;
53 /// variableGuid is the GUID this token associated with.
55 public UUID variableGuid
;
58 /// Variable offset indicate the associated variable's offset in NV storage.
60 public String variableOffset
;
63 /// The default value for HII case.
65 public String hiiDefaultValue
;
68 /// ---------------------------------------------------------------------
69 /// Following member is for VPD case.
70 /// ---------------------------------------------------------------------
72 public String vpdOffset
;
74 /// ---------------------------------------------------------------------
75 /// Following member is for default case.
76 /// ---------------------------------------------------------------------
80 Constructor function for DynamicTokenValue class.
83 public DynamicTokenValue() {
84 type
= VALUE_TYPE
.DEFAULT_TYPE
;
87 variableOffset
= null;
88 hiiDefaultValue
= null;
94 Set the HII case data.
96 @param variableName The variable name
97 @param variableGuid The variable guid
98 @param variableOffset The offset of value in this variable
99 @param hiiDefaultValue Default value for this PCD
101 public void setHiiData(List variableName
,
103 String variableOffset
,
104 String hiiDefaultValue
) {
105 this.type
= VALUE_TYPE
.HII_TYPE
;
107 this.variableName
= variableName
;
108 this.variableGuid
= variableGuid
;
109 this.variableOffset
= variableOffset
;
110 this.hiiDefaultValue
= hiiDefaultValue
;
114 Get the string like L"xxx" for a variable Name.
116 BUGBUG: In fact, it is not correctly, variable name should be
117 treated as unicode UINT16 array.
121 public String
getStringOfVariableName()
122 throws EntityException
{
127 for (index
= 0; index
< variableName
.size(); index
++) {
128 num
= Integer
.decode(variableName
.get(index
).toString());
129 if ((num
> 127 ) || (num
< 0)) {
130 throw new EntityException(String
.format("variable name contains >0x80 character, now is not support!"));
143 public void setVpdData(String vpdOffset
) {
144 this.type
= VALUE_TYPE
.VPD_TYPE
;
146 this.vpdOffset
= vpdOffset
;
150 Set default case data.
154 public void setValue(String value
) {
155 this.type
= VALUE_TYPE
.DEFAULT_TYPE
;