doxygen_scan.py 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import traceback
  2. class Symbol(object):
  3. def __init__(self, anchor, type, cppname):
  4. self.anchor = anchor
  5. self.type = type
  6. self.cppname = cppname
  7. #if anchor == 'ga586ebfb0a7fb604b35a23d85391329be':
  8. # print(repr(self))
  9. # traceback.print_stack()
  10. def __repr__(self):
  11. return '%s:%s@%s' % (self.type, self.cppname, self.anchor)
  12. def add_to_file(files_dict, file, anchor):
  13. anchors = files_dict.setdefault(file, [])
  14. anchors.append(anchor)
  15. def scan_namespace_constants(ns, ns_name, files_dict):
  16. constants = ns.findall("./member[@kind='enumvalue']")
  17. for c in constants:
  18. c_name = c.find("./name").text
  19. name = ns_name + '::' + c_name
  20. file = c.find("./anchorfile").text
  21. anchor = c.find("./anchor").text
  22. #print(' CONST: {} => {}#{}'.format(name, file, anchor))
  23. add_to_file(files_dict, file, Symbol(anchor, "const", name))
  24. def scan_namespace_functions(ns, ns_name, files_dict):
  25. functions = ns.findall("./member[@kind='function']")
  26. for f in functions:
  27. f_name = f.find("./name").text
  28. name = ns_name + '::' + f_name
  29. file = f.find("./anchorfile").text
  30. anchor = f.find("./anchor").text
  31. #print(' FN: {} => {}#{}'.format(name, file, anchor))
  32. add_to_file(files_dict, file, Symbol(anchor, "fn", name))
  33. def scan_class_methods(c, c_name, files_dict):
  34. methods = c.findall("./member[@kind='function']")
  35. for m in methods:
  36. m_name = m.find("./name").text
  37. name = c_name + '::' + m_name
  38. file = m.find("./anchorfile").text
  39. anchor = m.find("./anchor").text
  40. #print(' Method: {} => {}#{}'.format(name, file, anchor))
  41. add_to_file(files_dict, file, Symbol(anchor, "method", name))