]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/GenBuild/org/tianocore/build/pcd/entity/DynamicTokenValue.java
533bd51920dedd6c60f3db78d27c814ce8f23f50
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
.build
.pcd
.entity
;
18 import java
.util
.List
;
19 import java
.util
.UUID
;
21 import org
.tianocore
.build
.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 /// Following member is for VPD case.
69 /// BUGBUG: Consider 64 bit integer by using java.math.BigInteger.
71 public String vpdOffset
;
74 /// Following member is for default case.
78 public DynamicTokenValue() {
79 this.type
= VALUE_TYPE
.DEFAULT_TYPE
;
80 this.variableName
= null;
81 this.variableGuid
= null;
82 this.variableOffset
= null;
83 this.hiiDefaultValue
= null;
85 this.vpdOffset
= null;
91 Set the HII case data.
96 @param hiiDefaultValue
98 public void setHiiData(List variableName
,
100 String variableOffset
,
101 String hiiDefaultValue
) {
102 this.type
= VALUE_TYPE
.HII_TYPE
;
104 this.variableName
= variableName
;
105 this.variableGuid
= variableGuid
;
106 this.variableOffset
= variableOffset
;
107 this.hiiDefaultValue
= hiiDefaultValue
;
111 Get the string like L"xxx" for a variable Name.
113 BUGBUG: In fact, it is not correctly, variable name should be
114 treated as unicode UINT16 array.
118 public String
getStringOfVariableName()
119 throws EntityException
{
125 for (index
= 0; index
< variableName
.size(); index
++) {
126 num
= Integer
.decode(variableName
.get(index
).toString());
127 if ((num
> 127 ) || (num
< 0)) {
128 throw new EntityException(String
.format("variable name contains >0x80 character, now is not support!"));
141 public void setVpdData(String vpdOffset
) {
142 this.type
= VALUE_TYPE
.VPD_TYPE
;
144 this.vpdOffset
= vpdOffset
;
148 Set default case data.
152 public void setValue(String value
) {
153 this.type
= VALUE_TYPE
.DEFAULT_TYPE
;