pygccxml.parser.source_reader module¶
-
bind_aliases
(decls)¶ This function binds between class and it’s typedefs.
Deprecated since 1.9.0, will be removed in 2.0.0
- Parameters
decls – list of all declarations
- Return type
None
-
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 GCC-XML or CastXML.
It has only one responsibility: it calls GCC-XML 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 GCC-XML
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 GCC-XML or CastXML generated id’s.
- linker_t - this class contains logic for replacing GCC-XML or 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 external tool can be either gccxml or castxml. 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 GCC-XML or CastXML.
- 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 GCC-XML generated file
- Return type
returns file name of GCC-XML generated file
-
join_declarations
(namespace)¶
-
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
-
property
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