]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/Python/UPT/Object/Parser/InfCommonObject.py
BaseTools: Replace BSD License with BSD+Patent License
[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 - 2018, Intel Corporation. All rights reserved.<BR>
6 #
7 # SPDX-License-Identifier: BSD-2-Clause-Patent
8
9 '''
10 InfCommonObject
11 '''
12
13 ## InfLineCommentObject
14 #
15 # Comment Object for any line in the INF file
16 #
17 # #
18 # # HeaderComment
19 # #
20 # Line # TailComment
21 #
22 class InfLineCommentObject():
23 def __init__(self):
24 self.HeaderComments = ''
25 self.TailComments = ''
26
27 def SetHeaderComments(self, HeaderComments):
28 self.HeaderComments = HeaderComments
29
30 def GetHeaderComments(self):
31 return self.HeaderComments
32
33 def SetTailComments(self, TailComments):
34 self.TailComments = TailComments
35
36 def GetTailComments(self):
37 return self.TailComments
38
39 ## CurrentLine
40 #
41 class CurrentLine():
42 def __init__(self):
43 self.LineNo = ''
44 self.LineString = ''
45 self.FileName = ''
46
47 ## SetLineNo
48 #
49 # @param LineNo: LineNo
50 #
51 def SetLineNo(self, LineNo):
52 self.LineNo = LineNo
53
54 ## GetLineNo
55 #
56 def GetLineNo(self):
57 return self.LineNo
58
59 ## SetLineString
60 #
61 # @param LineString: Line String content
62 #
63 def SetLineString(self, LineString):
64 self.LineString = LineString
65
66 ## GetLineString
67 #
68 def GetLineString(self):
69 return self.LineString
70
71 ## SetFileName
72 #
73 # @param FileName: File Name
74 #
75 def SetFileName(self, FileName):
76 self.FileName = FileName
77
78 ## GetFileName
79 #
80 def GetFileName(self):
81 return self.FileName
82
83 ##
84 # Inf Section common data
85 #
86 class InfSectionCommonDef():
87 def __init__(self):
88 #
89 # #
90 # # HeaderComments at here
91 # #
92 # [xxSection] TailComments at here
93 # data
94 #
95 self.HeaderComments = ''
96 self.TailComments = ''
97 #
98 # The support arch list of this section
99 #
100 self.SupArchList = []
101
102 #
103 # Store all section content
104 # Key is supported Arch
105 #
106 self.AllContent = {}
107
108 ## SetHeaderComments
109 #
110 # @param HeaderComments: HeaderComments
111 #
112 def SetHeaderComments(self, HeaderComments):
113 self.HeaderComments = HeaderComments
114
115 ## GetHeaderComments
116 #
117 def GetHeaderComments(self):
118 return self.HeaderComments
119
120 ## SetTailComments
121 #
122 # @param TailComments: TailComments
123 #
124 def SetTailComments(self, TailComments):
125 self.TailComments = TailComments
126
127 ## GetTailComments
128 #
129 def GetTailComments(self):
130 return self.TailComments
131
132 ## SetSupArchList
133 #
134 # @param Arch: Arch
135 #
136 def SetSupArchList(self, Arch):
137 if Arch not in self.SupArchList:
138 self.SupArchList.append(Arch)
139
140 ## GetSupArchList
141 #
142 def GetSupArchList(self):
143 return self.SupArchList
144
145 ## SetAllContent
146 #
147 # @param ArchList: ArchList
148 # @param Content: Content
149 #
150 def SetAllContent(self, Content):
151 self.AllContent = Content
152
153 ## GetAllContent
154 #
155 def GetAllContent(self):
156 return self.AllContent