pygccxml.parser.source_reader module¶
-
class
source_reader_t
(configuration, cache=None, decl_factory=None)¶ Bases:
object
This class reads C++ source code and returns the declarations tree.
This class is the only class that works directly with CastXML.
It has only one responsibility: it calls CastXML with a source file specified by the user and creates declarations tree. The implementation of this class is split to two classes:
- scanner_t - this class scans the “XML” file, generated by CastXML
- or CastXML and creates
pygccxml
declarations and types classes. After the XML file has been processed declarations and type class instances keeps references to each other using CastXML generated id’s.
- linker_t - this class contains logic for replacing CastXML
- generated ids with references to declarations or type class instances.
-
create_xml_file
(source_file, destination=None)¶ This method will generate a xml file using an external tool.
The method will return the file path of the generated xml file.
Parameters: - source_file (str) – path to the source file that should be parsed.
- destination (str) – if given, will be used as target file path for the xml generator.
Return type: path to xml file.
-
create_xml_file_from_string
(content, destination=None)¶ Creates XML file from text.
Parameters: - content (str) – C++ source code
- destination (str) – file name for xml file
Return type: returns file name of xml file
-
read_cpp_source_file
(source_file)¶ Reads C++ source file and returns declarations tree
Parameters: source_file (str) – path to C++ source file
-
read_file
(source_file)¶
-
read_string
(content)¶ Reads a Python string that contains C++ code, and return the declarations tree.
-
read_xml_file
(xml_file)¶ Read generated XML file.
Parameters: xml_file (str) – path to xml file Return type: declarations tree
-
xml_generator_from_xml_file
¶ Configuration object containing information about the xml generator read from the xml file.
Returns: configuration object Return type: utils.xml_generators