Parser sub-package.
Parse header files.
| Parameters: |
|
|---|---|
| Return type: | list of declarations.declaration_t |
defines C++ parser configuration classes
Bases: pygccxml.parser.config.parser_configuration_t
Configuration object to collect parameters for invoking gccxml.
This class serves as a container for the parameters that can be used to customize the call to gccxml.
Constructor.
loads GCC-XML configuration from an .ini file or any other file class ConfigParser.SafeConfigParser is able to parse.
| Parameter: | configuration – configuration could be string( configuration file path ) or instance of ConfigParser.SafeConfigParser class |
|---|---|
| Return type: | gccxml_configuration_t |
Configuration file sceleton:
[gccxml]
#path to gccxml executable file - optional, if not provided, os.environ['PATH']
#variable is used to find it
gccxml_path=
#gccxml working directory - optional, could be set to your source code directory
working_directory=
#additional include directories, separated by ';'
include_paths=
#gccxml has a nice algorithms, which selects what C++ compiler to emulate.
#You can explicitly set what compiler it should emulate.
#Valid options are: g++, msvc6, msvc7, msvc71, msvc8, cl.
compiler=
Bases: object
C++ parser configuration holder
This class serves as a base class for the parameters that can be used to customize the call to a C++ parser.
This class also allows users to work with relative files paths. In this case files are searched in the following order:
- current directory
- working directory
- additional include paths specified by the user
Constructor.
Bases: object
update cache entry
| Parameters: |
|
|---|
Bases: pygccxml.parser.declarations_cache.cache_base_t
Bases: pygccxml.parser.declarations_cache.cache_base_t
Cache implementation to store data in a pickled form in a file. This class contains some cache logic that keeps track of which entries have been ‘hit’ in the cache and if an entry has not been hit then it is deleted at the time of the flush(). This keeps the cache from growing larger when files change and are not used again.
| Parameter: | name – name of the cache file. |
|---|
Bases: object
directory cache implementation.
This module contains the implementation of a cache that uses individual files, stored in a dedicated cache directory, to store the cached contents.
The parser.directory_cache_t class instance could be passed as the cache argument of the parser.parse() function.
Bases: pygccxml.parser.declarations_cache.cache_base_t
cache class that stores its data as multiple files inside a directory.
The cache stores one index file called index.dat which is always read by the cache when the cache object is created. Each header file will have its corresponding .cache file that stores the declarations found in the header file. The index file is used to determine whether a .cache file is still valid or not (by checking if one of the dependent files (i.e. the header file itself and all included files) have been modified since the last run).
| Parameters: |
|
|---|
Return the cached declarations or None.
| Parameters: |
|
|---|---|
| Return type: | Cached declarations or None |
Replace a cache entry by a new value.
| Parameters: |
|
|---|
This is a record stored in the filename_repository_t class.
The class is an internal class used in the implementation of the filename_repository_t class and it just serves as a container for the file name and the reference count.
Constructor.
The reference count is initially set to 0.
File name repository.
This class stores file names and can check whether a file has been modified or not since a previous call. A file name is stored by calling acquire_filename() which returns an ID and a signature of the file. The signature can later be used to check if the file was modified by calling is_file_modified(). If the file name is no longer required release_filename() should be called so that the entry can be removed from the repository.
Constructor.
Entry of the index table in the directory cache index.
Each cached header file (i.e. each .cache file) has a corresponding index_entry_t object. This object is used to determine whether the cache file with the declarations is still valid or not.
This class is a helper class for the directory_cache_t class.
| Parameters: |
|
|---|
Creates parser.file_configuration_t instance, configured to contain path to GCC-XML generated XML file and C++ source file. If XML file does not exists, it will be created and used for parsing. If XML file exists, it will be used for parsing.
| Parameters: |
|
|---|---|
| Return type: | parser.file_configuration_t |
Creates parser.file_configuration_t instance, configured to contain path to GCC-XML generated XML file.
| Parameter: | xml_file (str) – path to GCC-XML generated XML file |
|---|---|
| Return type: | parser.file_configuration_t |
Creates parser.file_configuration_t instance, configured to contain path to C++ source file
| Parameter: | header (str) – path to C++ source file |
|---|---|
| Return type: | parser.file_configuration_t |
Creates parser.file_configuration_t instance, configured to contain Python string, that contains valid C++ code
| Parameter: | text (str) – C++ code |
|---|---|
| Return type: | parser.file_configuration_t |
Bases: object
source code location configuration.
The class instance uses “variant” interface to represent the following data:
path to a C++ source file
path to GCC-XML generated XML file
path to a C++ source file and path to GCC-XML generated file
In this case, if XML file does not exists, it will be created. Next time you will ask to parse the source file, the XML file will be used instead.
Small tip: you can setup your makefile to delete XML files every time, the relevant source file was changed.
Python string, that contains valid C++ code
There are few functions, that will help you to construct file_configuration_t object:
parses header files and returns the contained declarations
| Parameters: |
|
|---|
returns file names
| Parameter: | files (list) – list of strings andor file_configuration_t instances. |
|---|
parses a set of files
| Parameters: |
|
|---|---|
| Return type: | [declaration_t] |
Parse a string containing C/C++ source code.
| Parameter: | content (str) – C/C++ source code. |
|---|---|
| Return type: | Declarations |
This function binds between class and it’s typedefs.
| Parameter: | decls – list of all declarations |
|---|---|
| Return type: | None |
This class reads C++ source code and returns declarations tree.
This class is the only class that works with GCC-XML directly.
It has only one responsibility: it calls GCC-XML with a source file specified by user and creates declarations tree. The implementation of this class is split to two classes:
| Parameters: |
|
|---|
This function will return the file name of the file, created by GCC-XML for “header” file. If destination_file_path is not None, then this file path will be used and returned.
| Parameters: |
|
|---|---|
| Return type: | path to GCC-XML generated file |
Creates XML file from text.
| Parameters: |
|
|---|---|
| Return type: | returns file name of GCC-XML generated file |
Reads C++ source file and returns declarations tree
| Parameter: | source_file (str) – path to C++ source file |
|---|
Reads GCC-XML generated XML file.
| Parameter: | gccxml_created_file (str) – path to GCC-XML generated file |
|---|---|
| Return type: | declarations tree |