# pygccxml.utils package

## Modules

Logger classes and a few convenience methods.

class `pygccxml.utils.utils.``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 `pygccxml.utils.utils.``cached`(method)

  Bases: `property`

  Convert a method into a cached attribute.

  static `reset`()

`pygccxml.utils.utils.``contains_parent_dir`(fpath, dirs)

  Returns true if paths in dirs start with fpath.

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

`pygccxml.utils.utils.``create_temp_file_name`(suffix, prefix=None, dir=None)

  Small convenience function that creates temporary files.

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

class `pygccxml.utils.utils.``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

class `pygccxml.utils.utils.``enum`

  Bases: `object`

  A small enum object.

  Deprecated since 1.8.0. Will be removed in 1.9.0.

  Usage example:

      class fruits(enum):
          apple = 0
          orange = 1

      fruits.has_value( 1 )
      fruits.name_of( 1 )

  classmethod `has_value`(enum_numeric_value)

    Check if the enum contains the value.

    Deprecated since 1.8.0. Will be removed in 1.9.0.

    Parameters: | enum_numeric_value (int) – the value to search for
    Returns: | True or False
    Return type: | bool

  classmethod `name_of`(enum_numeric_value)

    Name of the value.

    Deprecated since 1.8.0. Will be removed in 1.9.0.

    Parameters: | enum_numeric_value (int) – the value to search for
    Returns: | the name of the value
    Return type: | str

`pygccxml.utils.utils.``find_xml_generator`(name=None)

  Try to find a c++ parser. Returns path and name.

  Parameters: | name (str) – name of the c++ parser: castxml or gccxml

  If no name is given the function first looks for castxml, then for gccxml. If no c++ parser is found the function raises an exception.

`pygccxml.utils.utils.``get_architecture`()

  Returns computer architecture: 32 or 64.

  The guess is based on maxint.

`pygccxml.utils.utils.``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

`pygccxml.utils.utils.``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 `pygccxml.utils.utils.``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.

class `pygccxml.utils.utils.``native_compiler`

  Bases: `object`

  Get the compiler used to build the Python executable.

  static `get_gccxml_compiler`()

    Get a modified version string of the compiler.

    Deprecated since 1.8.0. Will be removed in 1.9.0.

    Returns: | mscvXX, where XX is a version number. Works only on windows.
    Return type: | str

  static `get_version`()

    Get the version of the compiler used to build the Python executable.

    Deprecated since 1.8.0. Will be removed in 1.9.0.

    Returns:

    - name of compiler (str): mscv
    - compiler version (str): msvccompiler.get_build_version()

    Return type: | tuple

`pygccxml.utils.utils.``normalize_path`(some_path)

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

`pygccxml.utils.utils.``remove_file_no_raise`(file_name, config)

  Removes file from disk if exception is raised.