The doxygen XML file Abstracts the parsing of the Doxygen XML file and contains some reasoning about the class (e.g. its members, is it pure abstract, etc.) Can generate a viable PXD file from the doxygen information alone.
| 311 | ## Class holding Doxygen XML file and next one function declaration |
| 312 | # |
| 313 | class DoxygenXMLFile(object): |
| 314 | """ |
| 315 | The doxygen XML file |
| 316 | |
| 317 | Abstracts the parsing of the Doxygen XML file and contains some reasoning |
| 318 | about the class (e.g. its members, is it pure abstract, etc.) |
| 319 | |
| 320 | Can generate a viable PXD file from the doxygen information alone. |
| 321 | """ |
| 322 | |
| 323 | def __init__(self, fname): |
| 324 | self.fname = fname |
| 325 | self.parsed_file = None |
| 326 | self.compound = None |
| 327 | self.parsing_error = False |
| 328 | self.parsing_error_message = None |
| 329 | |
| 330 | def parse_doxygen(self): |
| 331 | try: |
| 332 | self.parsed_file = doxygen_parse(self.fname) |
| 333 | self.compound = self.parsed_file.get_compounddef() |
| 334 | return self.parsed_file |
| 335 | except Exception as e: |
| 336 | print ("Error parsing doxygen xml file", e.message) |
| 337 | self.parsing_error_message = e.message |
| 338 | self.parsing_error = True |
| 339 | return None |
| 340 | |
| 341 | def getInternalFileName(self): |
| 342 | location = self.parsed_file.get_compounddef().get_location() |
| 343 | if location is None: |
| 344 | return None |
| 345 | return location.get_file() |
| 346 | |
| 347 | def getCompoundFileLocation(self, source_dir): |
| 348 | location = self.parsed_file.get_compounddef().get_location() |
| 349 | if location is None: |
| 350 | return None |
| 351 | return os.path.realpath( os.path.join(source_dir, "src", "openms", "include", location.get_file()) ) |
| 352 | |
| 353 | def isEmpty(self, discard_defines=False): |
| 354 | compound = self.compound |
| 355 | if not discard_defines: |
| 356 | return len(compound.get_sectiondef()) == 0 |
| 357 | |
| 358 | # check whether there is more than defines and typdefs |
| 359 | empty = True |
| 360 | for mdef in self.iterMemberDef(): |
| 361 | if not mdef.get_kind() in ["define", "typedef", "slot", "signal"]: |
| 362 | # DoxMemberKind: define property event variable typedef enum function signal prototype friend dcop slot |
| 363 | empty = False |
| 364 | if empty and not len(compound.get_sectiondef()) == 0: |
| 365 | # contains only typedefs etc |
| 366 | pass |
| 367 | return empty |
| 368 | |
| 369 | def get_pxd_from_class(self, dfile, internal_file_name, xml_output_path): |
| 370 | """ |
no outgoing calls
no test coverage detected