--- /dev/null
+## @file\r
+# This file is used to define class objects of INF file [BuildOptions] section. \r
+# It will consumed by InfParser. \r
+#\r
+# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+#\r
+# This program and the accompanying materials are licensed and made available \r
+# under the terms and conditions of the BSD License which accompanies this \r
+# distribution. The full text of the license may be found at \r
+# http://opensource.org/licenses/bsd-license.php\r
+#\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+'''\r
+InfBuildOptionObject\r
+'''\r
+\r
+from Library import GlobalData \r
+\r
+from Object.Parser.InfCommonObject import InfSectionCommonDef\r
+\r
+class InfBuildOptionItem():\r
+ def __init__(self):\r
+ self.Content = ''\r
+ self.SupArchList = []\r
+ self.AsBuildList = []\r
+ \r
+ def SetContent(self, Content):\r
+ self.Content = Content\r
+ def GetContent(self):\r
+ return self.Content\r
+ \r
+ def SetSupArchList(self, SupArchList):\r
+ self.SupArchList = SupArchList\r
+ def GetSupArchList(self):\r
+ return self.SupArchList\r
+ \r
+ #\r
+ # AsBuild Information\r
+ #\r
+ def SetAsBuildList(self, AsBuildList):\r
+ self.AsBuildList = AsBuildList\r
+ def GetAsBuildList(self):\r
+ return self.AsBuildList\r
+ \r
+ \r
+## INF BuildOption section\r
+# Macro define is not permitted for this section.\r
+#\r
+# \r
+class InfBuildOptionsObject(InfSectionCommonDef):\r
+ def __init__(self):\r
+ self.BuildOptions = []\r
+ InfSectionCommonDef.__init__(self)\r
+ ## SetBuildOptions function\r
+ #\r
+ # For BuildOptionName, need to validate it's format\r
+ # For BuildOptionValue, just ignore it. \r
+ #\r
+ # @param Arch Indicated which arch of build options belong to.\r
+ # @param BuildOptCont A list contain BuildOption related information.\r
+ # The element in the list contain 3 members.\r
+ # BuildOptionName, BuildOptionValue and IsReplace\r
+ # flag.\r
+ # \r
+ # @return True Build options set/validate successfully\r
+ # @return False Build options set/validate failed\r
+ #\r
+ def SetBuildOptions(self, BuildOptCont, ArchList = None, SectionContent = ''):\r
+\r
+ if not GlobalData.gIS_BINARY_INF: \r
+ \r
+ if SectionContent.strip() != '':\r
+ InfBuildOptionItemObj = InfBuildOptionItem()\r
+ InfBuildOptionItemObj.SetContent(SectionContent)\r
+ InfBuildOptionItemObj.SetSupArchList(ArchList)\r
+ \r
+ self.BuildOptions.append(InfBuildOptionItemObj)\r
+ else:\r
+ #\r
+ # For AsBuild INF file \r
+ #\r
+ if len(BuildOptCont) >= 1:\r
+ InfBuildOptionItemObj = InfBuildOptionItem()\r
+ InfBuildOptionItemObj.SetAsBuildList(BuildOptCont)\r
+ self.BuildOptions.append(InfBuildOptionItemObj)\r
+ \r
+ \r
+ return True\r
+ \r
+ def GetBuildOptions(self):\r
+ return self.BuildOptions
\ No newline at end of file