2 # This file is used to define common items of class object
4 # Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
6 # SPDX-License-Identifier: BSD-2-Clause-Patent
11 from Library
.DataType
import TAB_LANGUAGE_EN_US
15 # @param object: Inherited from object class
17 class HelpTextObject(object):
19 self
.HelpText
= TextObject()
21 def SetHelpText(self
, HelpText
):
22 self
.HelpText
= HelpText
24 def GetHelpText(self
):
29 # @param object: Inherited from object class
31 class HelpTextListObject(object):
33 self
.HelpTextList
= []
35 def SetHelpTextList(self
, HelpTextList
):
36 self
.HelpTextList
= HelpTextList
38 def GetHelpTextList(self
):
39 return self
.HelpTextList
43 # @param object: Inherited from object class
45 class PromptListObject(object):
49 def SetPromptList(self
, PromptList
):
50 self
.PromptList
= PromptList
52 def GetPromptList(self
):
53 return self
.PromptList
55 ## CommonPropertiesObject
57 # This class defined common attribution used in Module/Platform/Package files
59 # @param object: Inherited from object class
60 # @param Usage: Input value for Usage, default is []
61 # @param FeatureFlag: Input value for FeatureFalg, default is ''
62 # @param SupArchList: Input value for SupArchList, default is []
63 # @param HelpText: Input value for HelpText, default is ''
64 # @param HelpTextList: Input value for HelpTextList, default is []
66 class CommonPropertiesObject(HelpTextObject
, HelpTextListObject
):
72 HelpTextObject
.__init
__(self
)
73 HelpTextListObject
.__init
__(self
)
75 def SetUsage(self
, Usage
):
81 def SetFeatureFlag(self
, FeatureFlag
):
82 self
.FeatureFlag
= FeatureFlag
84 def GetFeatureFlag(self
):
85 return self
.FeatureFlag
87 def SetSupArchList(self
, SupArchList
):
88 self
.SupArchList
= SupArchList
90 def GetSupArchList(self
):
91 return self
.SupArchList
93 def SetGuidValue(self
, GuidValue
):
94 self
.GuidValue
= GuidValue
96 def GetGuidValue(self
):
101 # This class defined common header items used in Module/Platform/Package files
103 # @param object: Inherited from object class
105 class CommonHeaderObject(object):
107 self
.AbstractList
= []
108 self
.DescriptionList
= []
109 self
.CopyrightList
= []
110 self
.LicenseList
= []
112 def SetAbstract(self
, Abstract
):
113 if isinstance(Abstract
, list):
114 self
.AbstractList
= Abstract
116 self
.AbstractList
.append(Abstract
)
118 def GetAbstract(self
):
119 return self
.AbstractList
121 def SetDescription(self
, Description
):
122 if isinstance(Description
, list):
123 self
.DescriptionList
= Description
125 self
.DescriptionList
.append(Description
)
127 def GetDescription(self
):
128 return self
.DescriptionList
130 def SetCopyright(self
, Copyright
):
131 if isinstance(Copyright
, list):
132 self
.CopyrightList
= Copyright
134 self
.CopyrightList
.append(Copyright
)
136 def GetCopyright(self
):
137 return self
.CopyrightList
139 def SetLicense(self
, License
):
140 if isinstance(License
, list):
141 self
.LicenseList
= License
143 self
.LicenseList
.append(License
)
145 def GetLicense(self
):
146 return self
.LicenseList
148 ## BinaryHeaderObject
150 # This class defined Binary header items used in Module/Platform/Package files
152 # @param object: Inherited from object class
154 class BinaryHeaderObject(object):
156 self
.BinaryHeaderAbstractList
= []
157 self
.BinaryHeaderDescriptionList
= []
158 self
.BinaryHeaderCopyrightList
= []
159 self
.BinaryHeaderLicenseList
= []
161 def SetBinaryHeaderAbstract(self
, Abstract
):
162 if isinstance(Abstract
, list) and Abstract
:
163 self
.BinaryHeaderAbstractList
= Abstract
164 elif isinstance(Abstract
, tuple) and Abstract
[1]:
165 self
.BinaryHeaderAbstractList
.append(Abstract
)
167 def GetBinaryHeaderAbstract(self
):
168 return self
.BinaryHeaderAbstractList
170 def SetBinaryHeaderDescription(self
, Description
):
171 if isinstance(Description
, list) and Description
:
172 self
.BinaryHeaderDescriptionList
= Description
173 elif isinstance(Description
, tuple) and Description
[1]:
174 self
.BinaryHeaderDescriptionList
.append(Description
)
176 def GetBinaryHeaderDescription(self
):
177 return self
.BinaryHeaderDescriptionList
179 def SetBinaryHeaderCopyright(self
, Copyright
):
180 if isinstance(Copyright
, list) and Copyright
:
181 self
.BinaryHeaderCopyrightList
= Copyright
182 elif isinstance(Copyright
, tuple) and Copyright
[1]:
183 self
.BinaryHeaderCopyrightList
.append(Copyright
)
185 def GetBinaryHeaderCopyright(self
):
186 return self
.BinaryHeaderCopyrightList
188 def SetBinaryHeaderLicense(self
, License
):
189 if isinstance(License
, list) and License
:
190 self
.BinaryHeaderLicenseList
= License
191 elif isinstance(License
, tuple) and License
[1]:
192 self
.BinaryHeaderLicenseList
.append(License
)
194 def GetBinaryHeaderLicense(self
):
195 return self
.BinaryHeaderLicenseList
197 ## ClonedRecordObject
199 # This class defined ClonedRecord items used in Module/Platform/Package files
201 # @param object: Inherited from object class
203 class ClonedRecordObject(object):
207 self
.PackageGuid
= ''
208 self
.PackageVersion
= ''
210 self
.ModuleVersion
= ''
212 def SetId(self
, IdNo
):
218 def SetFarGuid(self
, FarGuid
):
219 self
.FarGuid
= FarGuid
221 def GetFarGuid(self
):
224 def SetPackageGuid(self
, PackageGuid
):
225 self
.PackageGuid
= PackageGuid
227 def GetPackageGuid(self
):
228 return self
.PackageGuid
230 def SetPackageVersion(self
, PackageVersion
):
231 self
.PackageVersion
= PackageVersion
233 def GetPackageVersion(self
):
234 return self
.PackageVersion
236 def SetModuleGuid(self
, ModuleGuid
):
237 self
.ModuleGuid
= ModuleGuid
239 def GetModuleGuid(self
):
240 return self
.ModuleGuid
242 def SetModuleVersion(self
, ModuleVersion
):
243 self
.ModuleVersion
= ModuleVersion
245 def GetModuleVersion(self
):
246 return self
.ModuleVersion
250 # This class defined Text item used in PKG file
252 # @param object: Inherited from object class
254 class TextObject(object):
256 self
.Lang
= TAB_LANGUAGE_EN_US
259 def SetLang(self
, Lang
):
265 def SetString(self
, String
):
273 # This class defined File item used in module, for binary files
275 # @param CommonPropertiesObject: Inherited from CommonPropertiesObject class
277 class FileNameObject(CommonPropertiesObject
):
281 CommonPropertiesObject
.__init
__(self
)
283 def SetFileType(self
, FileType
):
284 self
.FileType
= FileType
286 def GetFileType(self
):
289 def SetFilename(self
, Filename
):
290 self
.Filename
= Filename
292 def GetFilename(self
):
297 # This class defined File item used in PKG file
299 # @param object: Inherited from object class
301 class FileObject(object):
307 def SetExecutable(self
, Executable
):
308 self
.Executable
= Executable
310 def GetExecutable(self
):
311 return self
.Executable
313 def SetURI(self
, URI
):
319 def SetOS(self
, OsType
):
326 # MiscFileObject is used for xml
328 # @param CommonHeaderObject: Inherited from CommonHeaderObject class
330 class MiscFileObject(CommonHeaderObject
):
334 CommonHeaderObject
.__init
__(self
)
336 def SetName(self
, Name
):
342 def SetFileList(self
, FileList
):
343 self
.FileList
= FileList
345 def GetFileList(self
):
351 class ToolsObject(MiscFileObject
):
356 # This class defined GUID/Version items used in PKG file
358 # @param object: Inherited from object class
360 class GuidVersionObject(object):
365 def SetGuid(self
, Guid
):
371 def SetVersion(self
, Version
):
372 self
.Version
= Version
374 def GetVersion(self
):
377 ## IdentificationObject
379 # This class defined Identification items used in Module/Platform/Package files
381 # @param object: Inherited from object class
383 class IdentificationObject(GuidVersionObject
):
390 self
.PackagePath
= ''
392 self
.CombinePath
= ''
393 GuidVersionObject
.__init
__(self
)
395 def SetName(self
, Name
):
401 def SetBaseName(self
, BaseName
):
402 self
.BaseName
= BaseName
404 def GetBaseName(self
):
407 def SetFileName(self
, FileName
):
408 self
.FileName
= FileName
410 def GetFileName(self
):
413 def SetFullPath(self
, FullPath
):
414 self
.FullPath
= FullPath
416 def GetFullPath(self
):
419 def SetRelaPath(self
, RelaPath
):
420 self
.RelaPath
= RelaPath
422 def GetRelaPath(self
):
425 def SetPackagePath(self
, PackagePath
):
426 self
.PackagePath
= PackagePath
428 def GetPackagePath(self
):
429 return self
.PackagePath
431 def SetModulePath(self
, ModulePath
):
432 self
.ModulePath
= ModulePath
434 def GetModulePath(self
):
435 return self
.ModulePath
437 def SetCombinePath(self
, CombinePath
):
438 self
.CombinePath
= CombinePath
440 def GetCombinePath(self
):
441 return self
.CombinePath
443 ## GuidProtocolPpiCommonObject
445 # This class defined Guid, Protocol and Ppi like items used in
446 # Module/Platform/Package files
448 # @param CommonPropertiesObject: Inherited from CommonPropertiesObject class
450 class GuidProtocolPpiCommonObject(CommonPropertiesObject
):
455 self
.SupModuleList
= []
456 CommonPropertiesObject
.__init
__(self
)
458 def SetName(self
, Name
):
464 def SetCName(self
, CName
):
470 def SetGuid(self
, Guid
):
476 def SetSupModuleList(self
, SupModuleList
):
477 self
.SupModuleList
= SupModuleList
479 def GetSupModuleList(self
):
480 return self
.SupModuleList
484 # This class defined Guid item used in Module/Platform/Package files
486 # @param GuidProtocolPpiCommonObject: GuidProtocolPpiCommonObject
488 class GuidObject(GuidProtocolPpiCommonObject
):
490 self
.VariableName
= ''
491 self
.GuidTypeList
= []
492 GuidProtocolPpiCommonObject
.__init
__(self
)
493 def SetVariableName(self
, VariableName
):
494 self
.VariableName
= VariableName
496 def GetVariableName(self
):
497 return self
.VariableName
499 def SetGuidTypeList(self
, GuidTypeList
):
500 self
.GuidTypeList
= GuidTypeList
502 def GetGuidTypeList(self
):
503 return self
.GuidTypeList
507 # This class defined Protocol item used in Module/Platform/Package files
509 # @param GuidProtocolPpiCommonObject: Inherited from
510 # GuidProtocolPpiCommonObject
512 class ProtocolObject(GuidProtocolPpiCommonObject
):
515 GuidProtocolPpiCommonObject
.__init
__(self
)
516 def SetNotify(self
, Notify
):
524 # This class defined Ppi item used in Module/Platform/Package files
526 # @param GuidProtocolPpiCommonObject: Inherited from
527 # GuidProtocolPpiCommonObject
529 class PpiObject(GuidProtocolPpiCommonObject
):
532 GuidProtocolPpiCommonObject
.__init
__(self
)
533 def SetNotify(self
, Notify
):
541 # This class defined item DEFINE used in Module/Platform/Package files
543 # @param object: Inherited from object class
545 class DefineClass(object):
549 ## UserExtensionObject
551 # @param object: Inherited from object class
553 class UserExtensionObject(object):
557 self
.BinaryAbstractList
= []
558 self
.BinaryDescriptionList
= []
559 self
.BinaryCopyrightList
= []
560 self
.BinaryLicenseList
= []
561 self
.UniLangDefsList
= []
563 # { Statement : Arch , ... }
565 self
.DefinesDict
= {}
567 # { Arch : Statement , ... }
569 self
.BuildOptionDict
= {}
570 self
.IncludesDict
= {}
571 self
.SourcesDict
= {}
572 self
.BinariesDict
= {}
574 # UserExtension statement from meta-data file [UserExtension] section
577 self
.SupArchList
= []
579 def SetStatement(self
, Statement
):
580 self
.Statement
= Statement
582 def GetStatement(self
):
583 return self
.Statement
585 def SetSupArchList(self
, ArchList
):
586 self
.SupArchList
= ArchList
588 def GetSupArchList(self
):
589 return self
.SupArchList
591 def SetUserID(self
, UserID
):
597 def SetIdentifier(self
, Identifier
):
598 self
.Identifier
= Identifier
600 def GetIdentifier(self
):
601 return self
.Identifier
603 def SetUniLangDefsList(self
, UniLangDefsList
):
604 self
.UniLangDefsList
= UniLangDefsList
606 def GetUniLangDefsList(self
):
607 return self
.UniLangDefsList
609 def SetBinaryAbstract(self
, BinaryAbstractList
):
610 self
.BinaryAbstractList
= BinaryAbstractList
612 def GetBinaryAbstract(self
, Lang
=None):
614 for (Key
, Value
) in self
.BinaryAbstractList
:
619 return self
.BinaryAbstractList
621 def SetBinaryDescription(self
, BinaryDescriptionList
):
622 self
.BinaryDescriptionList
= BinaryDescriptionList
624 def GetBinaryDescription(self
, Lang
=None):
626 for (Key
, Value
) in self
.BinaryDescriptionList
:
631 return self
.BinaryDescriptionList
633 def SetBinaryCopyright(self
, BinaryCopyrightList
):
634 self
.BinaryCopyrightList
= BinaryCopyrightList
636 def GetBinaryCopyright(self
, Lang
=None):
638 for (Key
, Value
) in self
.BinaryCopyrightList
:
643 return self
.BinaryCopyrightList
645 def SetBinaryLicense(self
, BinaryLicenseList
):
646 self
.BinaryLicenseList
= BinaryLicenseList
648 def GetBinaryLicense(self
, Lang
=None):
650 for (Key
, Value
) in self
.BinaryLicenseList
:
655 return self
.BinaryLicenseList
657 def SetDefinesDict(self
, DefinesDict
):
658 self
.DefinesDict
= DefinesDict
660 def GetDefinesDict(self
):
661 return self
.DefinesDict
663 def SetBuildOptionDict(self
, BuildOptionDict
):
664 self
.BuildOptionDict
= BuildOptionDict
666 def GetBuildOptionDict(self
):
667 return self
.BuildOptionDict
669 def SetIncludesDict(self
, IncludesDict
):
670 self
.IncludesDict
= IncludesDict
672 def GetIncludesDict(self
):
673 return self
.IncludesDict
675 def SetSourcesDict(self
, SourcesDict
):
676 self
.SourcesDict
= SourcesDict
678 def GetSourcesDict(self
):
679 return self
.SourcesDict
681 def SetBinariesDict(self
, BinariesDict
):
682 self
.BinariesDict
= BinariesDict
684 def GetBinariesDict(self
):
685 return self
.BinariesDict
687 ## LibraryClassObject
689 # This class defined Library item used in Module/Platform/Package files
691 # @param CommonPropertiesObject: Inherited from CommonPropertiesObject class
693 class LibraryClassObject(CommonPropertiesObject
):
695 self
.LibraryClass
= ''
696 self
.IncludeHeader
= ''
697 self
.SupModuleList
= []
698 self
.RecommendedInstance
= GuidVersionObject()
699 CommonPropertiesObject
.__init
__(self
)
701 def SetLibraryClass(self
, LibraryClass
):
702 self
.LibraryClass
= LibraryClass
704 def GetLibraryClass(self
):
705 return self
.LibraryClass
707 def SetSupModuleList(self
, SupModuleList
):
708 self
.SupModuleList
= SupModuleList
710 def GetSupModuleList(self
):
711 return self
.SupModuleList
713 def SetIncludeHeader(self
, IncludeHeader
):
714 self
.IncludeHeader
= IncludeHeader
716 def GetIncludeHeader(self
):
717 return self
.IncludeHeader
719 def SetRecommendedInstance(self
, RecommendedInstance
):
720 self
.RecommendedInstance
= RecommendedInstance
722 def GetRecommendedInstance(self
):
723 return self
.RecommendedInstance
728 # @param object: Inherited from object class
730 class PcdErrorObject(object):
733 self
.ValidValueLang
= ''
734 self
.ValidValueRange
= ''
736 self
.ErrorNumber
= ''
737 self
.ErrorMessageList
= []
738 self
.TokenSpaceGuidCName
= ''
743 def SetValidValue(self
, ValidValue
):
744 self
.ValidValue
= ValidValue
746 def GetValidValue(self
):
747 return self
.ValidValue
749 def SetValidValueLang(self
, ValidValueLang
):
750 self
.ValidValueLang
= ValidValueLang
752 def GetValidValueLang(self
):
753 return self
.ValidValueLang
755 def SetValidValueRange(self
, ValidValueRange
):
756 self
.ValidValueRange
= ValidValueRange
758 def GetValidValueRange(self
):
759 return self
.ValidValueRange
761 def SetExpression(self
, Expression
):
762 self
.Expression
= Expression
764 def GetExpression(self
):
765 return self
.Expression
767 def SetErrorNumber(self
, ErrorNumber
):
768 self
.ErrorNumber
= ErrorNumber
770 def GetErrorNumber(self
):
771 return self
.ErrorNumber
773 def SetErrorMessageList(self
, ErrorMessageList
):
774 self
.ErrorMessageList
= ErrorMessageList
776 def GetErrorMessageList(self
):
777 return self
.ErrorMessageList
779 def SetTokenSpaceGuidCName(self
, TokenSpaceGuidCName
):
780 self
.TokenSpaceGuidCName
= TokenSpaceGuidCName
782 def GetTokenSpaceGuidCName(self
):
783 return self
.TokenSpaceGuidCName
785 def SetCName(self
, CName
):
791 def SetFileLine(self
, FileLine
):
792 self
.FileLine
= FileLine
794 def GetFileLine(self
):
797 def SetLineNum(self
, LineNum
):
798 self
.LineNum
= LineNum
800 def GetLineNum(self
):
806 # This class defined Include item used in Module/Platform/Package files
808 # @param CommonPropertiesObject: Inherited from CommonPropertiesObject class
810 class IncludeObject(CommonPropertiesObject
):
814 self
.SupModuleList
= []
816 CommonPropertiesObject
.__init
__(self
)
818 def SetFilePath(self
, FilePath
):
819 self
.FilePath
= FilePath
821 def GetFilePath(self
):
824 def SetModuleType(self
, ModuleType
):
825 self
.ModuleType
= ModuleType
827 def GetModuleType(self
):
828 return self
.ModuleType
830 def SetSupModuleList(self
, SupModuleList
):
831 self
.SupModuleList
= SupModuleList
833 def GetSupModuleList(self
):
834 return self
.SupModuleList
836 def SetComment(self
, Comment
):
837 self
.Comment
= Comment
839 def GetComment(self
):
844 # This class defined Pcd item used in Module/Platform/Package files
846 # @param CName: Input value for CName, default is ''
847 # @param Token: Input value for Token, default is ''
848 # @param TokenSpaceGuidCName: Input value for TokenSpaceGuidCName, default is
850 # @param DatumType: Input value for DatumType, default is ''
851 # @param MaxDatumSize: Input value for MaxDatumSize, default is ''
852 # @param DefaultValue: Input value for DefaultValue, default is ''
853 # @param ItemType: Input value for ItemType, default is ''
854 # @param ValidUsage: Input value for ValidUsage, default is []
855 # @param SkuInfoList: Input value for SkuInfoList, default is {}
856 # @param SupModuleList: Input value for SupModuleList, default is []
858 class PcdObject(CommonPropertiesObject
, HelpTextListObject
, PromptListObject
):
863 self
.TokenSpaceGuidCName
= ''
864 self
.TokenSpaceGuidValue
= ''
866 self
.MaxDatumSize
= ''
867 self
.DefaultValue
= ''
871 self
.PcdErrorsList
= []
872 self
.SupModuleList
= []
873 CommonPropertiesObject
.__init
__(self
)
874 HelpTextListObject
.__init
__(self
)
875 PromptListObject
.__init
__(self
)
877 def SetPcdCName(self
, PcdCName
):
878 self
.PcdCName
= PcdCName
880 def GetPcdCName(self
):
883 def SetCName(self
, CName
):
889 def SetToken(self
, Token
):
895 def SetOffset(self
, Offset
):
901 def SetTokenSpaceGuidCName(self
, TokenSpaceGuidCName
):
902 self
.TokenSpaceGuidCName
= TokenSpaceGuidCName
904 def GetTokenSpaceGuidCName(self
):
905 return self
.TokenSpaceGuidCName
907 def SetTokenSpaceGuidValue(self
, TokenSpaceGuidValue
):
908 self
.TokenSpaceGuidValue
= TokenSpaceGuidValue
910 def GetTokenSpaceGuidValue(self
):
911 return self
.TokenSpaceGuidValue
913 def SetDatumType(self
, DatumType
):
914 self
.DatumType
= DatumType
916 def GetDatumType(self
):
917 return self
.DatumType
919 def SetMaxDatumSize(self
, MaxDatumSize
):
920 self
.MaxDatumSize
= MaxDatumSize
922 def GetMaxDatumSize(self
):
923 return self
.MaxDatumSize
925 def SetDefaultValue(self
, DefaultValue
):
926 self
.DefaultValue
= DefaultValue
928 def GetDefaultValue(self
):
929 return self
.DefaultValue
931 def SetValidUsage(self
, ValidUsage
):
932 self
.ValidUsage
= ValidUsage
934 def GetValidUsage(self
):
935 return self
.ValidUsage
937 def SetPcdErrorsList(self
, PcdErrorsList
):
938 self
.PcdErrorsList
= PcdErrorsList
940 def GetPcdErrorsList(self
):
941 return self
.PcdErrorsList
943 def SetItemType(self
, ItemType
):
944 self
.ItemType
= ItemType
946 def GetItemType(self
):
949 def SetSupModuleList(self
, SupModuleList
):
950 self
.SupModuleList
= SupModuleList
952 def GetSupModuleList(self
):
953 return self
.SupModuleList