Public Member Functions | Private Member Functions | Private Attributes | List of all members
gtwrap.xml_parser.xml_parser.XMLDocParser Class Reference

Public Member Functions

def __init__ (self)
 
def determine_documenting_index (self, str cpp_class, str cpp_method, list method_args_names, list member_defs)
 
def extract_docstring (self, str xml_folder, str cpp_class, str cpp_method, 'list[str]' method_args_names)
 
def filter_member_defs (self, list[ET.Element] maybe_member_defs, list[str] method_args_names, str cpp_class, str cpp_method)
 
def get_formatted_docstring (self, 'ET.Element' member_def, list ignored_params)
 
list[ET.Element] get_member_defs_from_root (self, ET.Element class_root, str cpp_method)
 
def parse_xml (self, Path|str xml_file)
 
def print_if_verbose (self, str text)
 

Private Member Functions

Path|None _get_class_xml_path (self, str xml_folder, str cpp_class)
 

Private Attributes

 _memory
 
 _parsed_xml_cache
 
 _verbose
 

Detailed Description

Parses and extracts docs from Doxygen-generated XML.

Definition at line 7 of file xml_parser.py.

Constructor & Destructor Documentation

◆ __init__()

def gtwrap.xml_parser.xml_parser.XMLDocParser.__init__ (   self)

Definition at line 12 of file xml_parser.py.

Member Function Documentation

◆ _get_class_xml_path()

Path | None gtwrap.xml_parser.xml_parser.XMLDocParser._get_class_xml_path (   self,
str  xml_folder,
str  cpp_class 
)
private
Finds the XML file path for a given class name using the index.

Definition at line 22 of file xml_parser.py.

◆ determine_documenting_index()

def gtwrap.xml_parser.xml_parser.XMLDocParser.determine_documenting_index (   self,
str  cpp_class,
str  cpp_method,
list  method_args_names,
list  member_defs 
)
Determine which member definition to retrieve documentation from, if there are multiple.

Args:
    cpp_class (str): The name of the C++ class that contains the function whose docstring is to be extracted.
    cpp_method (str): The name of the C++ method whose docstring is to be extracted.
    method_args_names (list): A list of the names of the cpp_method's parameters.
    member_defs (list): All of the member definitions of cpp_class which match cpp_method in name
and whose arguments have the same names as method_args_names.

Returns:
    int: The index indicating which member definition to document.

Definition at line 368 of file xml_parser.py.

◆ extract_docstring()

def gtwrap.xml_parser.xml_parser.XMLDocParser.extract_docstring (   self,
str  xml_folder,
str  cpp_class,
str  cpp_method,
'list[str]'  method_args_names 
)
Extract the docstrings for a C++ class's method from the Doxygen-generated XML.
If not found in the specified class, searches parent classes recursively.

Args:
    xml_folder (str): The path to the folder that contains all of the Doxygen-generated XML.
    cpp_class (str): The name of the C++ class that contains the function whose docstring is to be extracted.
    cpp_method (str): The name of the C++ method whose docstring is to be extracted.
    method_args_names (list): A list of the names of the cpp_method's parameters.

Definition at line 82 of file xml_parser.py.

◆ filter_member_defs()

def gtwrap.xml_parser.xml_parser.XMLDocParser.filter_member_defs (   self,
list[ET.Element]  maybe_member_defs,
list[str method_args_names,
str  cpp_class,
str  cpp_method 
)
Remove member definitions which do not match the supplied argument names list.

Args:
    maybe_member_defs (list): The list of all member definitions in the class which share the same name.
    method_args_names (list): The list of argument names in the definition of the function whose documentation is desired.
    cpp_class (str): The name of the class being investigated (for verbose output).
    cpp_method (str): The name of the method being investigated (for verbose output).

Returns:
    tuple[list, list]: (the filtered member definitions, parameters which should be ignored because they are optional)

Definition at line 238 of file xml_parser.py.

◆ get_formatted_docstring()

def gtwrap.xml_parser.xml_parser.XMLDocParser.get_formatted_docstring (   self,
'ET.Element'  member_def,
list  ignored_params 
)
Gets the formatted docstring for the supplied XML element representing a member definition.

Args:
    member_def (xml.etree.ElementTree.Element): The member definition to document.
    ignored_params (list): The optional parameters which should be ignored *for this specific overload match*, if any.

Returns:
    str: The formatted docstring. Returns empty string if member_def lacks documentation tags.

Definition at line 420 of file xml_parser.py.

◆ get_member_defs_from_root()

list[ET.Element] gtwrap.xml_parser.xml_parser.XMLDocParser.get_member_defs_from_root (   self,
ET.Element  class_root,
str  cpp_method 
)
Finds member definitions for a method name within a given class XML root.

Definition at line 217 of file xml_parser.py.

◆ parse_xml()

def gtwrap.xml_parser.xml_parser.XMLDocParser.parse_xml (   self,
Path | str  xml_file 
)
Get the ElementTree of an XML file given the file name.
Uses a cache to avoid re-parsing.
If an error occurs, prints a warning and returns None.

Definition at line 57 of file xml_parser.py.

◆ print_if_verbose()

def gtwrap.xml_parser.xml_parser.XMLDocParser.print_if_verbose (   self,
str  text 
)
Print text if the parser is in verbose mode.

Definition at line 552 of file xml_parser.py.

Member Data Documentation

◆ _memory

gtwrap.xml_parser.xml_parser.XMLDocParser._memory
private

Definition at line 14 of file xml_parser.py.

◆ _parsed_xml_cache

gtwrap.xml_parser.xml_parser.XMLDocParser._parsed_xml_cache
private

Definition at line 20 of file xml_parser.py.

◆ _verbose

gtwrap.xml_parser.xml_parser.XMLDocParser._verbose
private

Definition at line 18 of file xml_parser.py.


The documentation for this class was generated from the following file:


gtsam
Author(s):
autogenerated on Wed May 28 2025 03:15:42