Mercurial > hg > orthanc
comparison OrthancFramework/Resources/CheckOrthancFrameworkSymbols.py @ 4310:2ae905070221
renaming pure interface JobOperationValue as IJobOperationValue
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 09 Nov 2020 14:40:51 +0100 |
parents | 8992faf451fc |
children | 91554aecff9a |
comparison
equal
deleted
inserted
replaced
4309:73de065622ec | 4310:2ae905070221 |
---|---|
144 | 144 |
145 ## | 145 ## |
146 ## Ignore pure abstract interfaces, by checking the following | 146 ## Ignore pure abstract interfaces, by checking the following |
147 ## criteria: | 147 ## criteria: |
148 ## - It must be a C++ class (not a struct) | 148 ## - It must be a C++ class (not a struct) |
149 ## - It must start with "I" | |
149 ## - All its methods must be pure virtual (abstract) and public | 150 ## - All its methods must be pure virtual (abstract) and public |
150 ## - Its destructor must be public, virtual, and must do nothing | 151 ## - Its destructor must be public, virtual, and must do nothing |
151 ## | 152 ## |
152 | 153 |
153 if child.kind == clang.cindex.CursorKind.CLASS_DECL: | 154 if (child.kind == clang.cindex.CursorKind.CLASS_DECL and |
155 child.spelling[0] == 'I' and | |
156 child.spelling[1].isupper()): | |
154 abstract = True | 157 abstract = True |
155 isPublic = False | 158 isPublic = False |
156 | 159 |
157 for i in child.get_children(): | 160 for i in child.get_children(): |
158 if i.kind == clang.cindex.CursorKind.VISIBILITY_ATTR: # "default" | 161 if i.kind == clang.cindex.CursorKind.VISIBILITY_ATTR: # "default" |
179 c = list(i.get_children()) | 182 c = list(i.get_children()) |
180 if (len(c) != 1 or | 183 if (len(c) != 1 or |
181 c[0].kind != clang.cindex.CursorKind.COMPOUND_STMT or | 184 c[0].kind != clang.cindex.CursorKind.COMPOUND_STMT or |
182 len(list(c[0].get_children())) != 0): | 185 len(list(c[0].get_children())) != 0): |
183 abstract = False | 186 abstract = False |
184 elif (i.kind == clang.cindex.CursorKind.CLASS_DECL or | 187 elif i.kind == clang.cindex.CursorKind.CLASS_DECL: |
185 i.kind == clang.cindex.CursorKind.STRUCT_DECL): | |
186 ExploreClass(i, fqn + [ i.spelling ]) | 188 ExploreClass(i, fqn + [ i.spelling ]) |
187 elif (i.kind == clang.cindex.CursorKind.TYPEDEF_DECL or # Allow "typedef" | 189 elif (i.kind == clang.cindex.CursorKind.TYPEDEF_DECL or # Allow "typedef" |
188 i.kind == clang.cindex.CursorKind.ENUM_DECL): # Allow enums | 190 i.kind == clang.cindex.CursorKind.ENUM_DECL): # Allow enums |
189 pass | 191 pass |
190 else: | 192 else: |
191 abstract = False | 193 abstract = False |
192 | 194 |
193 if abstract: | 195 if abstract: |
194 print('Detected a pure interface (this is fine): %s' % ('::'.join(fqn))) | 196 print('Detected a pure interface (this is fine): %s' % ('::'.join(fqn))) |
195 return | 197 else: |
196 | 198 ReportProblem('Not a pure interface', fqn, child) |
199 | |
200 return | |
201 | |
197 | 202 |
198 ## | 203 ## |
199 ## We are facing a standard C++ class or struct | 204 ## We are facing a standard C++ class or struct |
200 ## | 205 ## |
201 | 206 |
207 pass | 212 pass |
208 | 213 |
209 elif i.kind == clang.cindex.CursorKind.CXX_ACCESS_SPEC_DECL: | 214 elif i.kind == clang.cindex.CursorKind.CXX_ACCESS_SPEC_DECL: |
210 isPublic = (i.access_specifier == clang.cindex.AccessSpecifier.PUBLIC) | 215 isPublic = (i.access_specifier == clang.cindex.AccessSpecifier.PUBLIC) |
211 | 216 |
212 elif (i.kind == clang.cindex.CursorKind.CLASS_DECL or | 217 elif i.kind == clang.cindex.CursorKind.CLASS_DECL: |
213 i.kind == clang.cindex.CursorKind.STRUCT_DECL): | |
214 # This is a subclass | 218 # This is a subclass |
215 if isPublic: | 219 if isPublic: |
216 ExploreClass(i, fqn + [ i.spelling ]) | 220 ExploreClass(i, fqn + [ i.spelling ]) |
217 | 221 |
218 elif (i.kind == clang.cindex.CursorKind.CXX_METHOD or | 222 elif (i.kind == clang.cindex.CursorKind.CXX_METHOD or |