DecObject.py revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
## @file
# This file is used to define class objects for DEC file. It will consumed by
#DecParser
#
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this
# distribution. The full text of the license may be found at
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
'''
DecObject
'''
## Import modules
#
## _DecComments
#
# Base class for all data objects which have head and tail comments
#
class _DecComments:
##constructor
#
self._HeadComment = []
self._TailComment = []
## GetComments
#
def GetComments(self):
## GetHeadComment
#
def GetHeadComment(self):
return self._HeadComment
## SetHeadComment
#
# @param Comment: comment content
#
## GetTailComment
#
def GetTailComment(self):
return self._TailComment
## SetTailComment
#
# @param Comment: comment content
#
## _DecBaseObject
#
# Base class that hold common info
#
class _DecBaseObject(_DecComments):
#
# Key is combined with (Arch, SectionType)
# Default is common
#
## GetSectionName
#
def GetSectionName(self):
## GetPackagePath
#
def GetPackagePath(self):
return self._PackagePath
## GetPackageFile
#
def GetPackageFile(self):
## GetPackageFullName
#
def GetPackageFullName(self):
return self._PkgFullName
## AddItem
# Add sub-item to current object, sub-class should override it if needed
#
# @param Item: Sub-item to be added
# @param Scope: A list store section name and arch info
#
if not Scope:
return
if not Item:
return
ArchModule = []
else:
## _GetItemByArch
# Helper class used by sub-class
# @param Arch: arch
#
return []
## _GetAllItems
# Get all items, union all arches, items in returned list are unique
#
def _GetAllItems(self):
Retlst = []
return Retlst
## _DecItemBaseObject
#
# Module type and arch the item belongs to
#
class _DecItemBaseObject(_DecComments):
#
# Item's arch, if PCD, also include PCD type
#
self.ArchAndModuleType = []
## GetArchList
#
def GetArchList(self):
## DecDefineObject
#
# Class to hold define section infomation
#
class DecDefineObject(_DecBaseObject):
## GetPackageSpecification
#
def GetPackageSpecification(self):
## GetPackageName
#
def GetPackageName(self):
## GetPackageGuid
#
def GetPackageGuid(self):
## GetPackageVersion
#
def GetPackageVersion(self):
return self._PkgVersion
## GetPackageUniFile
#
def GetPackageUniFile(self):
return self._PkgUniFile
## GetDefines
#
def GetDefines(self):
## GetAllDefines
#
def GetAllDefines(self):
return self._GetAllItems()
## DecDefineItemObject
#
# Each item of define section
#
## __hash__
#
## __eq__
#
## __str__
#
## DecIncludeObject
#
# Class to hold include section info
#
class DecIncludeObject(_DecBaseObject):
## GetIncludes
#
## GetAllIncludes
#
def GetAllIncludes(self):
return self._GetAllItems()
## DecIncludeItemObject
#
# Item of include section
#
## __hash__
#
## __eq__
#
## __str__
#
## DecLibraryclassObject
#
# Class to hold library class section info
#
class DecLibraryclassObject(_DecBaseObject):
## GetLibraryclasses
#
## GetAllLibraryclasses
#
def GetAllLibraryclasses(self):
return self._GetAllItems()
## DecLibraryclassItemObject
# Item of library class section
#
## __hash__
#
## __eq__
#
## __str__
#
## DecPcdObject
# Class to hold PCD section
#
class DecPcdObject(_DecBaseObject):
## AddItem
#
# Diff from base class
#
# @param Item: Item
# @param Scope: Scope
#
if not Scope:
return
if not Item:
return
ArchModule = []
else:
## GetPcds
#
# @param PcdType: PcdType
# @param Arch: Arch
#
return []
## GetPcdsByType
#
# @param PcdType: PcdType
#
Retlst = []
if TypeInDict != PcdType:
continue
return Retlst
## DecPcdItemObject
#
# Item of PCD section
#
# @param _DecItemBaseObject: _DecItemBaseObject object
#
class DecPcdItemObject(_DecItemBaseObject):
## __hash__
#
## __eq__
#
## GetArchListOfType
#
# @param PcdType: PcdType
#
continue
## DecGuidObjectBase
#
# Base class for PPI, Protocol, and GUID.
# Hold same data but has different method for clarification in sub-class
#
# @param _DecBaseObject: Dec Base Object
#
class DecGuidObjectBase(_DecBaseObject):
## GetGuidStyleItems
#
# @param Arch: Arch
#
## GetGuidStyleAllItems
#
def GetGuidStyleAllItems(self):
return self._GetAllItems()
## DecGuidItemObject
#
# Item of GUID, PPI and Protocol section
#
# @param _DecItemBaseObject: Dec Item Base Object
#
class DecGuidItemObject(_DecItemBaseObject):
## __hash__
#
## __eq__
#
## __str__
#
## DecGuidObject
#
# Class for GUID section
#
# @param DecGuidObjectBase: Dec Guid Object Base
#
class DecGuidObject(DecGuidObjectBase):
## GetGuids
#
# @param Arch: Arch
#
## GetAllGuids
#
def GetAllGuids(self):
return self._GetAllItems()
## DecPpiObject
#
# Class for PPI seciont
#
# @param DecGuidObjectBase: Dec Guid Object Base
#
class DecPpiObject(DecGuidObjectBase):
## GetPpis
#
# @param Arch: Arch
#
## GetAllPpis
#
def GetAllPpis(self):
return self._GetAllItems()
## DecProtocolObject
#
# Class for protocol section
#
# @param DecGuidObjectBase: Dec Guid Object Base
#
class DecProtocolObject(DecGuidObjectBase):
## GetProtocols
#
# @param Arch: Arch
#
## GetAllProtocols
#
def GetAllProtocols(self):
return self._GetAllItems()
## DecUserExtensionObject
#
# Class for user extension section
#
# @param _DecBaseObject: Dec Guid Object Base
#
class DecUserExtensionObject(_DecBaseObject):
## GetProtocols
#
# @param Item: Item
# @param Scope: Scope
#
if not Scope:
pass
if not Item:
return
## GetAllUserExtensions
#
def GetAllUserExtensions(self):
## DecUserExtensionItemObject
# Item for user extension section
#
# @param _DecItemBaseObject: Dec Item Base Object
#