BaseTools: Replace StandardError with Expression
[mirror_edk2.git] / BaseTools / Source / Python / CommonDataClass / CommonClass.py
CommitLineData
30fdf114
LG
1## @file\r
2# This file is used to define common items of class object\r
3#\r
34a24786 4# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
40d841f6 5# This program and the accompanying materials\r
30fdf114
LG
6# are licensed and made available under the terms and conditions of the BSD License\r
7# which accompanies this distribution. The full text of the license may be found at\r
8# http://opensource.org/licenses/bsd-license.php\r
9#\r
10# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13\r
30fdf114
LG
14## SkuInfoClass\r
15#\r
16# This class defined SkuInfo item used in Module/Platform/Package files\r
17# \r
18# @param object: Inherited from object class\r
19# @param SkuIdName: Input value for SkuIdName, default is ''\r
20# @param SkuId: Input value for SkuId, default is ''\r
21# @param VariableName: Input value for VariableName, default is ''\r
22# @param VariableGuid: Input value for VariableGuid, default is ''\r
23# @param VariableOffset: Input value for VariableOffset, default is ''\r
24# @param HiiDefaultValue: Input value for HiiDefaultValue, default is ''\r
25# @param VpdOffset: Input value for VpdOffset, default is ''\r
26# @param DefaultValue: Input value for DefaultValue, default is ''\r
27#\r
28# @var SkuIdName: To store value for SkuIdName\r
29# @var SkuId: To store value for SkuId\r
30# @var VariableName: To store value for VariableName\r
31# @var VariableGuid: To store value for VariableGuid\r
32# @var VariableOffset: To store value for VariableOffset\r
33# @var HiiDefaultValue: To store value for HiiDefaultValue\r
34# @var VpdOffset: To store value for VpdOffset\r
35# @var DefaultValue: To store value for DefaultValue\r
36#\r
37class SkuInfoClass(object):\r
38 def __init__(self, SkuIdName = '', SkuId = '', VariableName = '', VariableGuid = '', VariableOffset = '', \r
8518bf0b 39 HiiDefaultValue = '', VpdOffset = '', DefaultValue = '', VariableGuidValue = '', VariableAttribute = '', DefaultStore = None):\r
30fdf114
LG
40 self.SkuIdName = SkuIdName\r
41 self.SkuId = SkuId\r
42 \r
43 #\r
44 # Used by Hii\r
45 #\r
8518bf0b
LG
46 if DefaultStore is None:\r
47 DefaultStore = {}\r
30fdf114
LG
48 self.VariableName = VariableName\r
49 self.VariableGuid = VariableGuid\r
50 self.VariableGuidValue = VariableGuidValue\r
51 self.VariableOffset = VariableOffset\r
52 self.HiiDefaultValue = HiiDefaultValue\r
82a6a960 53 self.VariableAttribute = VariableAttribute\r
8518bf0b 54 self.DefaultStoreDict = DefaultStore\r
30fdf114
LG
55 \r
56 #\r
57 # Used by Vpd\r
58 #\r
59 self.VpdOffset = VpdOffset\r
60 \r
61 #\r
62 # Used by Default\r
63 #\r
64 self.DefaultValue = DefaultValue\r
65 \r
66 ## Convert the class to a string\r
67 #\r
68 # Convert each member of the class to string\r
69 # Organize to a signle line format string\r
70 #\r
71 # @retval Rtn Formatted String\r
72 #\r
73 def __str__(self):\r
08dd311f 74 Rtn = 'SkuId = ' + str(self.SkuId) + "," + \\r
30fdf114
LG
75 'SkuIdName = ' + str(self.SkuIdName) + "," + \\r
76 'VariableName = ' + str(self.VariableName) + "," + \\r
77 'VariableGuid = ' + str(self.VariableGuid) + "," + \\r
78 'VariableOffset = ' + str(self.VariableOffset) + "," + \\r
79 'HiiDefaultValue = ' + str(self.HiiDefaultValue) + "," + \\r
80 'VpdOffset = ' + str(self.VpdOffset) + "," + \\r
81 'DefaultValue = ' + str(self.DefaultValue) + ","\r
82 return Rtn\r