pygccxml.utils.utils module

Logger classes and a few convenience methods.

class DeprecationWrapper(new_target, old_name, new_name, version)

Bases: object

A small wrapper class useful when deprecation classes.

This class is not part of the public API.

class cached(method)

Bases: property

Convert a method into a cached attribute.

deleter()

Descriptor to change the deleter on a property.

fdel
fget
fset
getter()

Descriptor to change the getter on a property.

reset()
setter()

Descriptor to change the setter on a property.

contains_parent_dir(fpath, dirs)

Returns true if paths in dirs start with fpath.

Precondition: dirs and fpath should be normalized before calling this function.

create_temp_file_name(suffix, prefix=None, dir=None, directory=None)

Small convenience function that creates temporary files.

This function is a wrapper around the Python built-in function tempfile.mkstemp.

class cxx_standard(cflags)

Bases: object

Helper class for parsing the C++ standard version.

This class holds the C++ standard version the XML generator has been configured with, and provides helpers functions for querying C++ standard version related information.

is_cxx03

Returns true if -std=c++03 is being used

is_cxx11

Returns true if -std=c++11 is being used

is_cxx11_or_greater

Returns true if -std=c++11 or a newer standard is being used

is_cxx14

Returns true if -std=c++14 is being used

is_cxx14_or_greater

Returns true if -std=c++14 or a newer standard is being used

is_cxx1z

Returns true if -std=c++1z is being used

is_implicit

Indicates whether a -std=c++xx was specified

stdcxx

Returns the -std=c++xx option passed to the constructor

find_xml_generator(name='castxml')

Try to find a c++ parser (xml generator)

Parameters:name (str) – name of the c++ parser (e.g. castxml)
Returns:path to the xml generator and it’s name
Return type:path (str), name (str)

If no c++ parser is found the function raises an exception. pygccxml does currently only support castxml as c++ parser.

get_architecture()

Returns computer architecture: 32 or 64.

The guess is based on maxint.

get_tr1(name)

In libstd++ the tr1 namespace needs special care.

Return either an empty string or tr1::, useful for appending to search patterns.

Parameters:name (str) – the name of the declaration
Returns:an empty string or “tr1::”
Return type:str
is_str(string)

Python 2 and 3 compatible string checker.

Parameters:string (str | basestring) – the string to check
Returns:True or False
Return type:bool
class loggers

Bases: object

Class-namespace, defines a few loggers classes, used in the project.

all_loggers = [<logging.Logger object>, <logging.Logger object>, <logging.Logger object>, <logging.Logger object>, <logging.Logger object>]

Contains all logger classes, defined by the class.

cxx_parser = <logging.Logger object>

Logger for C++ parser functionality

If you set this logger level to DEBUG, you will be able to see the exact command line, used to invoke GCC-XML and errors that occures during XML parsing

declarations_cache = <logging.Logger object>

Logger for declarations tree cache functionality

If you set this logger level to DEBUG, you will be able to see what is exactly happens, when you read the declarations from cache file. You will be able to decide, whether it worse for you to use this or that cache strategy.

pdb_reader = <logging.Logger object>

Logger for MS .pdb file reader functionality

queries_engine = <logging.Logger object>

Logger for query engine functionality.

If you set this logger level to DEBUG, you will be able to see what queries you do against declarations tree, measure performance and may be even to improve it. Query engine reports queries and whether they are optimized or not.

root = <logging.Logger object>

Root logger exists for your convenience only.

static set_level(level)

Set the same logging level for all the loggers at once.

normalize_path(some_path)

Return os.path.normpath(os.path.normcase(some_path)).

remove_file_no_raise(file_name, config)

Removes file from disk if exception is raised.