parse_doxygen_xml.py
Go to the documentation of this file.
1 import os
2 import os.path as path
3 import xml.etree.ElementTree as ET
4 
5 from docs.docs import ClassDoc, Doc, Docs, FreeDoc
6 
7 DOXYGEN_CONF = 'doxygen.conf'
8 
9 
11  def __init__(self, input_path, output_path):
12  """Parse the Doxygen generated XML files.
13 
14  Arguments:
15  input_path -- path to the input folder or file
16  output_path -- path to the output folder
17  """
18  self.input_path = input_path
19  self.output_path = output_path
20 
21  def run(self, quiet=True):
22  """Run the Doxygen XML parser.
23 
24  Arguments:
25  quiet -- turn on/off the messages that are generated to standard
26  output by Doxygen (default = True)
27 
28  Returns:
29  A Docs template storing all the class and free documentation in the
30  file.
31  """
32  class_docs = {}
33  free_docs = {}
34 
35  for root, dirs, files in os.walk(self.output_path):
36  for f in files:
37  if f.endswith('.xml'):
38  file_path = path.join(root, f)
39  tree = ET.parse(file_path)
40 
41  if tree.getroot().tag == 'compounddef':
42  first_compound_def = tree.getroot()
43  else:
44  first_compound_def = tree.find(
45  './/{}'.format('compounddef'))
46 
47  if first_compound_def is None:
48  continue
49 
50  category = first_compound_def.get('kind')
51 
52  if category == 'class':
53  class_docs[file_path] = ClassDoc(tree)
54 
55  return Docs(class_docs, free_docs)
56 
57 
58 # TODO: This should be done in the make file.
59 def generate_xml(input_path, output_path, quiet=False):
60  '''Parse the file for documentation and output it as in an xml format'''
61  if not quiet:
62  print('--------------Generating XML--------------')
63 
64  input_path = path.relpath(input_path, os.getcwd())
65  conf_path = path.relpath(path.join(path.dirname(__file__), DOXYGEN_CONF))
66  output_path = path.relpath(output_path)
67 
68  if not path.isdir(output_path):
69  os.mkdir(output_path)
70 
71  command = '( cat {conf_path} ; echo "INPUT={input_path}" ; echo "OUTPUT_DIRECTORY={output_path}" ; echo "EXTRACT_ALL={quiet}" ) | doxygen -'.format(
72  conf_path=conf_path,
73  input_path=input_path,
74  output_path=output_path,
75  quiet='YES' if quiet else 'NO'
76  )
77 
78  os.system(command)
Eigen::internal::print
EIGEN_STRONG_INLINE Packet4f print(const Packet4f &a)
Definition: NEON/PacketMath.h:3115
format
std::string format(const std::string &str, const std::vector< std::string > &find, const std::vector< std::string > &replace)
Definition: openglsupport.cpp:226
parse_doxygen_xml.generate_xml
def generate_xml(input_path, output_path, quiet=False)
Definition: parse_doxygen_xml.py:59
parse_doxygen_xml.ParseDoxygenXML.output_path
output_path
Definition: parse_doxygen_xml.py:19
parse_doxygen_xml.ParseDoxygenXML.__init__
def __init__(self, input_path, output_path)
Definition: parse_doxygen_xml.py:11
parse_doxygen_xml.ParseDoxygenXML.run
def run(self, quiet=True)
Definition: parse_doxygen_xml.py:21
parse_doxygen_xml.ParseDoxygenXML.input_path
input_path
Definition: parse_doxygen_xml.py:18
parse_doxygen_xml.ParseDoxygenXML
Definition: parse_doxygen_xml.py:10


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:03:30