]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/Python/UPT/Object/Parser/InfCommonObject.py
Sync BaseTools Branch (version r2271) to EDKII main trunk.
[mirror_edk2.git] / BaseTools / Source / Python / UPT / Object / Parser / InfCommonObject.py
1 ## @file
2 # This file is used to define common class objects for INF file.
3 # It will consumed by InfParser
4 #
5 # Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
6 #
7 # This program and the accompanying materials are licensed and made available
8 # under the terms and conditions of the BSD License which accompanies this
9 # distribution. The full text of the license may be found at
10 # http://opensource.org/licenses/bsd-license.php
11 #
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.
14
15 '''
16 InfCommonObject
17 '''
18
19 ## InfLineCommentObject
20 #
21 # Comment Object for any line in the INF file
22 #
23 # #
24 # # HeaderComment
25 # #
26 # Line # TailComment
27 #
28 class InfLineCommentObject():
29 def __init__(self):
30 self.HeaderComments = ''
31 self.TailComments = ''
32
33 def SetHeaderComments(self, HeaderComments):
34 self.HeaderComments = HeaderComments
35
36 def GetHeaderComments(self):
37 return self.HeaderComments
38
39 def SetTailComments(self, TailComments):
40 self.TailComments = TailComments
41
42 def GetTailComments(self):
43 return self.TailComments
44
45 ## CurrentLine
46 #
47 class CurrentLine():
48 def __init__(self):
49 self.LineNo = ''
50 self.LineString = ''
51 self.FileName = ''
52
53 ## SetLineNo
54 #
55 # @param LineNo: LineNo
56 #
57 def SetLineNo(self, LineNo):
58 self.LineNo = LineNo
59
60 ## GetLineNo
61 #
62 def GetLineNo(self):
63 return self.LineNo
64
65 ## SetLineString
66 #
67 # @param LineString: Line String content
68 #
69 def SetLineString(self, LineString):
70 self.LineString = LineString
71
72 ## GetLineString
73 #
74 def GetLineString(self):
75 return self.LineString
76
77 ## SetFileName
78 #
79 # @param FileName: File Name
80 #
81 def SetFileName(self, FileName):
82 self.FileName = FileName
83
84 ## GetFileName
85 #
86 def GetFileName(self):
87 return self.FileName
88
89 ##
90 # Inf Section common data
91 #
92 class InfSectionCommonDef():
93 def __init__(self):
94 #
95 # #
96 # # HeaderComments at here
97 # #
98 # [xxSection] TailComments at here
99 # data
100 #
101 self.HeaderComments = ''
102 self.TailComments = ''
103 #
104 # The support arch list of this section
105 #
106 self.SupArchList = []
107
108 #
109 # Store all section content
110 # Key is supported Arch
111 #
112 self.AllContent = {}
113
114 ## SetHeaderComments
115 #
116 # @param HeaderComments: HeaderComments
117 #
118 def SetHeaderComments(self, HeaderComments):
119 self.HeaderComments = HeaderComments
120
121 ## GetHeaderComments
122 #
123 def GetHeaderComments(self):
124 return self.HeaderComments
125
126 ## SetTailComments
127 #
128 # @param TailComments: TailComments
129 #
130 def SetTailComments(self, TailComments):
131 self.TailComments = TailComments
132
133 ## GetTailComments
134 #
135 def GetTailComments(self):
136 return self.TailComments
137
138 ## SetSupArchList
139 #
140 # @param Arch: Arch
141 #
142 def SetSupArchList(self, Arch):
143 if Arch not in self.SupArchList:
144 self.SupArchList.append(Arch)
145
146 ## GetSupArchList
147 #
148 def GetSupArchList(self):
149 return self.SupArchList
150
151 ## SetAllContent
152 #
153 # @param ArchList: ArchList
154 # @param Content: Content
155 #
156 def SetAllContent(self, Content):
157 self.AllContent = Content
158
159 ## GetAllContent
160 #
161 def GetAllContent(self):
162 return self.AllContent