pygccxml.declarations package

Overview

Contains classes that describe different C++ declarations

pygccxml.declarations.access_type_matcher

see access_type_matcher_t for documentation

alias of access_type_matcher_t

pygccxml.declarations.all_container_traits = (<pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61a9a50>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61a9b10>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61a9b90>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61a9c10>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61a9c90>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61a9f50>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61a9fd0>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61b5090>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61b5110>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61b5190>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61b5210>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61b5310>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61b5290>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61b5390>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61b5410>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61b5490>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61b5510>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61b5590>)

tuple of all STD container traits classes

pygccxml.declarations.and_matcher

see and_matcher_t for documentation

alias of and_matcher_t

pygccxml.declarations.calldef_matcher

see calldef_matcher_t for documentation

alias of calldef_matcher_t

pygccxml.declarations.custom_matcher

see custom_matcher_t for documentation

alias of custom_matcher_t

pygccxml.declarations.declaration_matcher

see declaration_matcher_t for documentation

alias of declaration_matcher_t

pygccxml.declarations.namespace_matcher

see namespace_matcher_t for documentation

alias of namespace_matcher_t

pygccxml.declarations.not_matcher

see not_matcher_t for documentation

alias of not_matcher_t

pygccxml.declarations.operator_matcher

see operator_matcher_t for documentation

alias of operator_matcher_t

pygccxml.declarations.or_matcher

see or_matcher_t for documentation

alias of or_matcher_t

pygccxml.declarations.regex_matcher

see regex_matcher_t for documentation

alias of regex_matcher_t

pygccxml.declarations.sequential_container_traits = [<pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61a9a50>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61a9b10>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61a9b90>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61a9c10>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61a9c90>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61a9f50>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61b5210>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61b5310>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61b5290>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61b5390>]

list, that contains all STD container traits classes

pygccxml.declarations.variable_matcher

see variable_matcher_t for documentation

alias of variable_matcher_t

pygccxml.declarations.virtuality_type_matcher

see virtuality_type_matcher_t for documentation

alias of virtuality_type_matcher_t

Modules

algorithm

Define few unrelated algorithms that work on declarations.

pygccxml.declarations.algorithm.apply_visitor(visitor, decl_inst)

Applies a visitor on declaration instance.

Parameters:visitor (type_visitor_t or decl_visitor_t) – instance
pygccxml.declarations.algorithm.declaration_files(decl_or_decls)

Returns set of files

Every declaration is declared in some file. This function returns set, that contains all file names of declarations.

Parameters:decl_or_decls (declaration_t or [declaration_t]) – reference to list of declaration’s or single declaration
Return type:set(declaration file names)
pygccxml.declarations.algorithm.declaration_path(decl, with_defaults=True)

Returns a list of parent declarations names.

Parameters:decl (declaration_t) – declaration for which declaration path should be calculated
Return type:[names], where first item contains top parent name and last item contains the decl name
pygccxml.declarations.algorithm.find_all_declarations(declarations, type=None, name=None, parent=None, recursive=True, fullname=None)

Returns a list of all declarations that match criteria, defined by developer.

For more information about arguments see match_declaration_t class.

Return type:[ matched declarations ]
pygccxml.declarations.algorithm.find_declaration(declarations, type=None, name=None, parent=None, recursive=True, fullname=None)

Returns single declaration that match criteria, defined by developer. If more the one declaration was found None will be returned.

For more information about arguments see match_declaration_t class.

Return type:matched declaration declaration_t or None
pygccxml.declarations.algorithm.find_first_declaration(declarations, type=None, name=None, parent=None, recursive=True, fullname=None)

Returns first declaration that match criteria, defined by developer.

For more information about arguments see match_declaration_t class.

Return type:matched declaration declaration_t or None
pygccxml.declarations.algorithm.full_name(decl, with_defaults=True)

Returns declaration full qualified name.

If decl belongs to anonymous namespace or class, the function will return C++ illegal qualified name. :param decl: declaration_t :type decl: declaration_t :rtype: full name of declarations.

pygccxml.declarations.algorithm.full_name_from_declaration_path(dpath)
pygccxml.declarations.algorithm.get_global_namespace(decls)
pygccxml.declarations.algorithm.get_named_parent(decl)

Returns a reference to a named parent declaration.

Parameters:decl (declaration_t) – the child declaration
Return type:reference to declaration_t or None if not found
pygccxml.declarations.algorithm.make_flatten(decl_or_decls)

Converts tree representation of declarations to flatten one.

Parameters:decl_or_decls (declaration_t or [ declaration_t ]) – reference to list of declaration’s or single declaration
Return type:[ all internal declarations ]
class pygccxml.declarations.algorithm.match_declaration_t(type=None, name=None, fullname=None, parent=None)

Bases: object

Helper class for different search algorithms.

This class will help developer to match declaration by:
  • declaration type, for example class_t or

    operator_t.

  • declaration name

  • declaration full name

  • reference to parent declaration

does_match_exist(inst)

Returns True if inst does match one of specified criteria.

Parameters:inst (declaration_t) – declaration instance
Return type:bool
pygccxml.declarations.algorithm.partial_declaration_path(decl)

Returns a list of parent declarations names without template arguments that have default value.

Parameters:decl (declaration_t) – declaration for which declaration path should be calculated
Return type:[names], where first item contains top parent name and last item contains the decl name
exception pygccxml.declarations.algorithm.visit_function_has_not_been_found_t(visitor, decl_inst)

Bases: exceptions.RuntimeError

Exception that is raised, from apply_visitor(), when a visitor could not be applied.

algorithms_cache

Defines classes that will keep results of different calculations.

class pygccxml.declarations.algorithms_cache.declaration_algs_cache_t

Bases: object

access_type
container_element_type
container_key_type
declaration_path
demangled_name
disable()
enable()
enabled
full_name
full_partial_name
partial_declaration_path
reset()
reset_access_type()
reset_name_based()
class pygccxml.declarations.algorithms_cache.type_algs_cache_t

Bases: object

static disable()
static enable()
enabled = True
remove_alias
reset()

calldef

defines classes, that describes “callable” declarations

This modules contains definition for next C++ declarations:
  • operator
    • member
    • free
  • function
    • member
    • free
  • constructor

  • destructor

class pygccxml.declarations.calldef.CALLING_CONVENTION_TYPES

Bases: object

class that defines “calling convention” constants

CDECL = 'cdecl'
FASTCALL = 'fastcall'
STDCALL = 'stdcall'
SYSTEM_DEFAULT = '<<<system default>>>'
THISCALL = 'thiscall'
UNKNOWN = ''
all = ('', 'cdecl', 'stdcall', 'thiscall', 'fastcall', '<<<system default>>>')
static extract(text, default='')

extracts calling convention from the text. If the calling convention could not be found, the “default”is used

pattern = <_sre.SRE_Pattern object at 0x1d126c0>
pygccxml.declarations.calldef.FUNCTION_VIRTUALITY_TYPES

alias of VIRTUALITY_TYPES

class pygccxml.declarations.calldef.VIRTUALITY_TYPES

Bases: object

class that defines “virtuality” constants

ALL = ['not virtual', 'virtual', 'pure virtual']
NOT_VIRTUAL = 'not virtual'
PURE_VIRTUAL = 'pure virtual'
VIRTUAL = 'virtual'
class pygccxml.declarations.calldef.argument_t(name='', type=None, default_value=None, attributes=None)

Bases: object

class, that describes argument of “callable” declaration

attributes

GCCXML attributes, set using __attribute__((gccxml(”...”))) @type: str

clone(**keywd)

constructs new argument_t instance

return argument_t(
name=keywd.get(‘name’, self.name), type=keywd.get(‘type’, self.type), default_value=keywd.get(‘default_value’, self.default_value), attributes=keywd.get(‘attributes’, self.attributes ))
default_value

Argument’s default value or None. @type: str

ellipsis

bool, if True argument represents ellipsis ( ”...” ) in function definition

name

Argument name. @type: str

type

The argument type

class pygccxml.declarations.calldef.calldef_t(name='', arguments=None, exceptions=None, return_type=None, has_extern=False, does_throw=True, mangled=None)

Bases: pygccxml.declarations.declaration.declaration_t

base class for all “callable” declarations

argument_types

list of all argument types

arguments

The argument list. @type: list of argument_t

calling_convention

function calling convention. See :class:CALLING_CONVENTION_TYPES class for possible values

demangled_name

returns function demangled name. It can help you to deal with function template instantiations

does_throw

If False, than function does not throw any exception. In this case, function was declared with empty throw statement.

exceptions

The list of exceptions. @type: list of declaration_t

guess_calling_convention()

This function should be overriden in the derived classes and return more-or-less successfull guess about calling convention

has_ellipsis
has_extern

Was this callable declared as “extern”? @type: bool

has_inline

Was this callable declared with “inline” specifier @type: bool

i_depend_on_them(recursive=True)
mangled

Unique declaration name generated by the compiler.

Returns:the mangled name
Return type:str
optional_args

list of all optional arguments, the arguments that have default value

overloads

A list of overloaded “callables” (i.e. other callables with the same name within the same scope.

@type: list of calldef_t

required_args

list of all required arguments

return_type

The type of the return value of the “callable” or None (constructors). @type: type_t

class pygccxml.declarations.calldef.casting_operator_t(*args, **keywords)

Bases: pygccxml.declarations.calldef.member_calldef_t, pygccxml.declarations.calldef.operator_t

describes casting operator declaration

class pygccxml.declarations.calldef.constructor_t(*args, **keywords)

Bases: pygccxml.declarations.calldef.member_calldef_t

describes constructor declaration

explicit

True, if constructor has “explicit” keyword, False otherwise @type: bool

is_copy_constructor

Returns True if described declaration is copy constructor, otherwise False.

is_trivial_constructor
class pygccxml.declarations.calldef.destructor_t(*args, **keywords)

Bases: pygccxml.declarations.calldef.member_calldef_t

describes deconstructor declaration

class pygccxml.declarations.calldef.free_calldef_t(*args, **keywords)

Bases: pygccxml.declarations.calldef.calldef_t

base class for “callable” declarations that defined within C++ namespace

create_decl_string(with_defaults=True)
function_type()

returns function type. See type_t hierarchy

guess_calling_convention()

This function should be overriden in the derived classes and return more-or-less successfull guess about calling convention

class pygccxml.declarations.calldef.free_function_t(*args, **keywords)

Bases: pygccxml.declarations.calldef.free_calldef_t

describes free function declaration

get_mangled_name()
class pygccxml.declarations.calldef.free_operator_t(*args, **keywords)

Bases: pygccxml.declarations.calldef.free_calldef_t, pygccxml.declarations.calldef.operator_t

describes free operator declaration

class_types

list of class/class declaration types, extracted from the operator arguments

class pygccxml.declarations.calldef.member_calldef_t(virtuality=None, has_const=None, has_static=None, *args, **keywords)

Bases: pygccxml.declarations.calldef.calldef_t

base class for “callable” declarations that defined within C++ class or struct

access_type

Return the access type of the member (as defined by the string constants in the class :class:ACCESS_TYPES. @type: str

create_decl_string(with_defaults=True)
function_type()

returns function type. See type_t hierarchy

guess_calling_convention()
has_const

describes, whether “callable” has const modifier or not

has_static

describes, whether “callable” has static modifier or not

virtuality

Describes the “virtuality” of the member (as defined by the string constants in the class :class:VIRTUALITY_TYPES). @type: str

class pygccxml.declarations.calldef.member_function_t(*args, **keywords)

Bases: pygccxml.declarations.calldef.member_calldef_t

describes member function declaration

class pygccxml.declarations.calldef.member_operator_t(*args, **keywords)

Bases: pygccxml.declarations.calldef.member_calldef_t, pygccxml.declarations.calldef.operator_t

describes member operator declaration

class pygccxml.declarations.calldef.operator_t

Bases: object

base class for “operator” declarations

OPERATOR_WORD_LEN = 8
symbol

operator’s symbol. For example: operator+, symbol is equal to ‘+’

call_invocation

Free function invocation parser

The parser is able to extract function name and list of arguments from a function invocation statement. For example, for the following code

do_something( x1, x2, x3 )

the parser will extract - function name - do_something - argument names - [ x1, x2, x3 ]

pygccxml.declarations.call_invocation.args(declaration_string)

Returns list of function arguments

Return type:[str]
pygccxml.declarations.call_invocation.find_args(text, start=None)

Finds arguments within function invocation.

Return type:[ arguments ] or :data:NOT_FOUND if arguments could not be found.
pygccxml.declarations.call_invocation.is_call_invocation(declaration_string)

Returns True if declaration_string is a function invocation.

Parameters:declaration_string (str) – string that should be checked for pattern.
Return type:bool
pygccxml.declarations.call_invocation.join(name, args, arg_separator=None)

Returns name( argument_1, argument_2, ..., argument_n ).

pygccxml.declarations.call_invocation.name(declaration_string)

Returns the name of a function.

Return type:str
pygccxml.declarations.call_invocation.split(declaration_string)

Returns (name, [arguments] )

pygccxml.declarations.call_invocation.split_recursive(declaration_string)

Returns [(name, [arguments])].

class_declaration

defines classes, that describes C++ classes

This modules contains definition for next C++ declarations:
  • class definition
  • class declaration
  • small helper class for describing C++ class hierarchy
class pygccxml.declarations.class_declaration.ACCESS_TYPES

Bases: object

class that defines “access” constants

ALL = ['public', 'private', 'protected']
PRIVATE = 'private'
PROTECTED = 'protected'
PUBLIC = 'public'
class pygccxml.declarations.class_declaration.CLASS_TYPES

Bases: object

class that defines “class” type constants

ALL = ['class', 'struct', 'union']
CLASS = 'class'
STRUCT = 'struct'
UNION = 'union'
class pygccxml.declarations.class_declaration.class_declaration_t(name='')

Bases: pygccxml.declarations.declaration.declaration_t

describes class declaration

aliases

List of aliases to this instance

container_traits

reference to container_traits_impl_t or None

i_depend_on_them(recursive=True)
class pygccxml.declarations.class_declaration.class_t(name='', class_type='class', is_abstract=False)

Bases: pygccxml.declarations.scopedef.scopedef_t

describes class definition

USE_DEMANGLED_AS_NAME = True
adopt_declaration(decl, access)

adds new declaration to the class

Parameters:
  • decl – reference to a declaration_t
  • access (:class:ACCESS_TYPES) – member access type
aliases

List of aliases to this instance

bases

list of base classes

byte_align

Alignment of this class in bytes @type: int

byte_size

Size of this class in bytes @type: int

class_type

describes class type

container_traits

reference to container_traits_impl_t or None

derived

list of derived classes

find_copy_constructor()
find_noncopyable_vars()

returns list of all noncopyable variables

find_out_member_access_type(member)

returns member access type

Parameters:member (declaration_t) – member of the class
Return type::class:ACCESS_TYPES
find_trivial_constructor()
get_members(access=None)

returns list of members according to access type

If access equals to None, then returned list will contain all members. You should not modify the list content, otherwise different optimization data will stop work and may to give you wrong results.

Parameters:access (:class:ACCESS_TYPES) – describes desired members
Return type:[ members ]
has_vtable

True, if class has virtual table, False otherwise

i_depend_on_them(recursive=True)
is_abstract

describes whether class abstract or not

private_members

list of all private members

protected_members

list of all protected members

public_members

list of all public members

recursive_bases

list of all base classes

recursive_derived

list of all derive classes

remove_declaration(decl)

removes decl from members list

Parameters:decl (declaration_t) – declaration to be removed
top_class

reference to a parent class, which contains this class and defined within a namespace

if this class is defined under a namespace, self will be returned

use_demangled_as_name
pygccxml.declarations.class_declaration.get_partial_name(name)
class pygccxml.declarations.class_declaration.hierarchy_info_t(related_class=None, access=None, is_virtual=False)

Bases: object

describes class relationship

access
access_type

describes hierarchy type

is_virtual

indicates whether the inheritance is virtual or not

related_class

reference to base or derived class

xml_generators

Contains enumeration of all xml_generators supported by the project.

pygccxml.declarations.xml_generators.on_missing_functionality(xml_generator, functionality)

container_traits

Define a few algorithms that deal with different properties of std containers.

pygccxml.declarations.container_traits.container_traits = (<pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61a9a50>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61a9b10>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61a9b90>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61a9c10>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61a9c90>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61a9f50>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61a9fd0>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61b5090>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61b5110>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61b5190>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61b5210>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61b5310>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61b5290>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61b5390>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61b5410>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61b5490>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61b5510>, <pygccxml.declarations.container_traits.container_traits_impl_t object at 0x7faea61b5590>)

tuple of all STD container traits classes

class pygccxml.declarations.container_traits.container_traits_impl_t(container_name, element_type_index, element_type_typedef, eraser, key_type_index=None, key_type_typedef=None, unordered_maps_and_sets=False)

Bases: object

Implements the functionality needed for convenient work with STD container classes

Implemented functionality:
  • find out whether a declaration is STD container or not
  • find out container value( mapped ) type

This class tries to be useful as much as possible. For example, for class declaration (and not definition) it parses the class name in order to extract the information.

class_declaration(type_)

Returns reference to the class declaration.

element_type(type_)

returns reference to the class valuemapped type declaration

get_container_or_none(type_)

Returns reference to the class declaration or None.

is_mapping(type_)
is_my_case(type_)

Checks, whether type is STD container or not.

is_sequence(type_)
key_type(type_)

returns reference to the class key type declaration

name()
remove_defaults(type_or_string)

Removes template defaults from a templated class instantiation.

For example:
std::vector< int, std::allocator< int > >
will become:
std::vector< int >
class pygccxml.declarations.container_traits.defaults_eraser(unordered_maps_and_sets)

Bases: object

decorated_call_prefix(cls_name, text, doit)
decorated_call_suffix(cls_name, text, doit)
erase_allocator(cls_name, default_allocator='std::allocator')
erase_call(cls_name)
erase_compare_allocator(cls_name, default_compare='std::less', default_allocator='std::allocator')
erase_container(cls_name, default_container_name='std::deque')
erase_container_compare(cls_name, default_container_name='std::vector', default_compare='std::less')
erase_hash_allocator(cls_name)
erase_hashmap_compare_allocator(cls_name)
erase_map_compare_allocator(cls_name, default_compare='std::less', default_allocator='std::allocator')
erase_recursive(cls_name)
no_const(cls_name)
no_end_const(cls_name)
no_gnustd(cls_name)
no_std(cls_name)
no_stdext(cls_name)
normalize(type_str)
replace_basic_string(cls_name)
pygccxml.declarations.container_traits.find_container_traits(cls_or_string)

cpptypes

defines classes, that describe C++ types

pygccxml.declarations.cpptypes.FUNDAMENTAL_TYPES = {'short unsigned int': <pygccxml.declarations.cpptypes.short_unsigned_int_t object at 0x7faea622c610>, 'jdouble': <pygccxml.declarations.cpptypes.jdouble_t object at 0x7faea6231150>, '__java_float': <pygccxml.declarations.cpptypes.jfloat_t object at 0x7faea62314d0>, 'int': <pygccxml.declarations.cpptypes.int_t object at 0x7faea622c710>, 'void': <pygccxml.declarations.cpptypes.void_t object at 0x7faea622c190>, 'float': <pygccxml.declarations.cpptypes.float_t object at 0x7faea622cb90>, 'jlong': <pygccxml.declarations.cpptypes.jlong_t object at 0x7faea6231050>, 'long unsigned int': <pygccxml.declarations.cpptypes.long_unsigned_int_t object at 0x7faea622c910>, 'complex double': <pygccxml.declarations.cpptypes.complex_double_t object at 0x7faea622cd90>, 'char': <pygccxml.declarations.cpptypes.char_t object at 0x7faea622c310>, '__java_long': <pygccxml.declarations.cpptypes.jlong_t object at 0x7faea6231450>, '__java_int': <pygccxml.declarations.cpptypes.jint_t object at 0x7faea62313d0>, 'long int': <pygccxml.declarations.cpptypes.long_int_t object at 0x7faea622c890>, 'signed int': <pygccxml.declarations.cpptypes.int_t object at 0x7faea622c790>, 'jfloat': <pygccxml.declarations.cpptypes.jfloat_t object at 0x7faea62310d0>, '__int128_t': <pygccxml.declarations.cpptypes.int128_t object at 0x7faea622ca90>, 'long long int': <pygccxml.declarations.cpptypes.long_long_int_t object at 0x7faea622c990>, 'unsigned int': <pygccxml.declarations.cpptypes.unsigned_int_t object at 0x7faea622c810>, '__java_byte': <pygccxml.declarations.cpptypes.jbyte_t object at 0x7faea62312d0>, 'long long unsigned int': <pygccxml.declarations.cpptypes.long_long_unsigned_int_t object at 0x7faea622ca10>, 'jchar': <pygccxml.declarations.cpptypes.jchar_t object at 0x7faea62311d0>, 'short int': <pygccxml.declarations.cpptypes.short_int_t object at 0x7faea622c510>, 'signed short int': <pygccxml.declarations.cpptypes.short_int_t object at 0x7faea622c590>, 'long double': <pygccxml.declarations.cpptypes.long_double_t object at 0x7faea622cc90>, 'double': <pygccxml.declarations.cpptypes.double_t object at 0x7faea622cc10>, 'complex long double': <pygccxml.declarations.cpptypes.complex_long_double_t object at 0x7faea622cd10>, '__java_short': <pygccxml.declarations.cpptypes.jshort_t object at 0x7faea6231350>, 'jshort': <pygccxml.declarations.cpptypes.jshort_t object at 0x7faea622cf10>, '__java_boolean': <pygccxml.declarations.cpptypes.jboolean_t object at 0x7faea6231650>, 'jint': <pygccxml.declarations.cpptypes.jint_t object at 0x7faea622cf90>, '__java_char': <pygccxml.declarations.cpptypes.jchar_t object at 0x7faea62315d0>, 'bool': <pygccxml.declarations.cpptypes.bool_t object at 0x7faea622c690>, 'wchar_t': <pygccxml.declarations.cpptypes.wchar_t object at 0x7faea622c490>, 'signed char': <pygccxml.declarations.cpptypes.signed_char_t object at 0x7faea622c390>, '__java_double': <pygccxml.declarations.cpptypes.jdouble_t object at 0x7faea6231550>, 'jbyte': <pygccxml.declarations.cpptypes.jbyte_t object at 0x7faea622ce90>, 'jboolean': <pygccxml.declarations.cpptypes.jboolean_t object at 0x7faea6231250>, '__uint128_t': <pygccxml.declarations.cpptypes.uint128_t object at 0x7faea622cb10>, 'unsigned char': <pygccxml.declarations.cpptypes.unsigned_char_t object at 0x7faea622c410>, 'complex float': <pygccxml.declarations.cpptypes.complex_float_t object at 0x7faea622ce10>}

defines a mapping between fundamental type name and its synonym to the instance of class that describes the type

class pygccxml.declarations.cpptypes.array_t(base, size)

Bases: pygccxml.declarations.cpptypes.compound_t

represents C++ array type

SIZE_UNKNOWN = -1
build_decl_string(with_defaults=True)
size

returns array size

class pygccxml.declarations.cpptypes.bool_t

Bases: pygccxml.declarations.cpptypes.fundamental_t

represents bool type

CPPNAME = 'bool'
class pygccxml.declarations.cpptypes.calldef_type_t(return_type=None, arguments_types=None)

Bases: object

base class for all types that describes “callable” declaration

arguments_types

list of argument types

has_ellipsis
return_type

reference to return type

class pygccxml.declarations.cpptypes.char_t

Bases: pygccxml.declarations.cpptypes.fundamental_t

represents char type

CPPNAME = 'char'
class pygccxml.declarations.cpptypes.complex_double_t

Bases: pygccxml.declarations.cpptypes.fundamental_t

represents complex double type

CPPNAME = 'complex double'
class pygccxml.declarations.cpptypes.complex_float_t

Bases: pygccxml.declarations.cpptypes.fundamental_t

represents complex float type

CPPNAME = 'complex float'
class pygccxml.declarations.cpptypes.complex_long_double_t

Bases: pygccxml.declarations.cpptypes.fundamental_t

represents complex long double type

CPPNAME = 'complex long double'
class pygccxml.declarations.cpptypes.compound_t(base)

Bases: pygccxml.declarations.cpptypes.type_t

class that allows to represent compound types like const int*

base

reference to internal/base class

class pygccxml.declarations.cpptypes.const_t(base)

Bases: pygccxml.declarations.cpptypes.compound_t

represents whatever const type

build_decl_string(with_defaults=True)
class pygccxml.declarations.cpptypes.declarated_t(declaration)

Bases: pygccxml.declarations.cpptypes.type_t

class that binds between to hierarchies: type_t and declaration_t

build_decl_string(with_defaults=True)
byte_align

alignment of this type in bytes @type: int

byte_size

Size of this type in bytes @type: int

declaration

reference to declaration_t

class pygccxml.declarations.cpptypes.double_t

Bases: pygccxml.declarations.cpptypes.fundamental_t

represents double type

CPPNAME = 'double'
class pygccxml.declarations.cpptypes.dummy_type_t(decl_string)

Bases: pygccxml.declarations.cpptypes.type_t

provides type_t interface for a string, that defines C++ type.

This class could be very useful in the code generator.

build_decl_string(with_defaults=True)
class pygccxml.declarations.cpptypes.ellipsis_t

Bases: pygccxml.declarations.cpptypes.type_t

type, that represents ”...” in function definition

build_decl_string(with_defaults=True)
class pygccxml.declarations.cpptypes.float_t

Bases: pygccxml.declarations.cpptypes.fundamental_t

represents float type

CPPNAME = 'float'
class pygccxml.declarations.cpptypes.free_function_type_t(return_type=None, arguments_types=None)

Bases: pygccxml.declarations.cpptypes.type_t, pygccxml.declarations.cpptypes.calldef_type_t

describes free function type

NAME_TEMPLATE = '%(return_type)s (*)( %(arguments)s )'
TYPEDEF_NAME_TEMPLATE = '%(return_type)s ( *%(typedef_name)s )( %(arguments)s )'
build_decl_string(with_defaults=True)
static create_decl_string(return_type, arguments_types, with_defaults=True)

Returns free function type

Parameters:
  • return_type (type_t) – function return type
  • arguments_types – list of argument type
Return type:

free_function_type_t

create_typedef(typedef_name, unused=None, with_defaults=True)

returns string, that contains valid C++ code, that defines typedef to function type

Parameters:name – the desired name of typedef
class pygccxml.declarations.cpptypes.fundamental_t(name)

Bases: pygccxml.declarations.cpptypes.type_t

base class for all fundamental, build-in types

build_decl_string(with_defaults=True)
class pygccxml.declarations.cpptypes.int128_t

Bases: pygccxml.declarations.cpptypes.fundamental_t

represents __int128_t type

CPPNAME = '__int128_t'
class pygccxml.declarations.cpptypes.int_t

Bases: pygccxml.declarations.cpptypes.fundamental_t

represents int type

CPPNAME = 'int'
class pygccxml.declarations.cpptypes.java_fundamental_t(name)

Bases: pygccxml.declarations.cpptypes.fundamental_t

base class for all JNI defined fundamental types

class pygccxml.declarations.cpptypes.jboolean_t

Bases: pygccxml.declarations.cpptypes.java_fundamental_t

represents jboolean type

JNAME = 'jboolean'
class pygccxml.declarations.cpptypes.jbyte_t

Bases: pygccxml.declarations.cpptypes.java_fundamental_t

represents jbyte type

JNAME = 'jbyte'
class pygccxml.declarations.cpptypes.jchar_t

Bases: pygccxml.declarations.cpptypes.java_fundamental_t

represents jchar type

JNAME = 'jchar'
class pygccxml.declarations.cpptypes.jdouble_t

Bases: pygccxml.declarations.cpptypes.java_fundamental_t

represents jdouble type

JNAME = 'jdouble'
class pygccxml.declarations.cpptypes.jfloat_t

Bases: pygccxml.declarations.cpptypes.java_fundamental_t

represents jfloat type

JNAME = 'jfloat'
class pygccxml.declarations.cpptypes.jint_t

Bases: pygccxml.declarations.cpptypes.java_fundamental_t

represents jint type

JNAME = 'jint'
class pygccxml.declarations.cpptypes.jlong_t

Bases: pygccxml.declarations.cpptypes.java_fundamental_t

represents jlong type

JNAME = 'jlong'
class pygccxml.declarations.cpptypes.jshort_t

Bases: pygccxml.declarations.cpptypes.java_fundamental_t

represents jshort type

JNAME = 'jshort'
class pygccxml.declarations.cpptypes.long_double_t

Bases: pygccxml.declarations.cpptypes.fundamental_t

represents long double type

CPPNAME = 'long double'
class pygccxml.declarations.cpptypes.long_int_t

Bases: pygccxml.declarations.cpptypes.fundamental_t

represents long int type

CPPNAME = 'long int'
class pygccxml.declarations.cpptypes.long_long_int_t

Bases: pygccxml.declarations.cpptypes.fundamental_t

represents long long int type

CPPNAME = 'long long int'
class pygccxml.declarations.cpptypes.long_long_unsigned_int_t

Bases: pygccxml.declarations.cpptypes.fundamental_t

represents long long unsigned int type

CPPNAME = 'long long unsigned int'
class pygccxml.declarations.cpptypes.long_unsigned_int_t

Bases: pygccxml.declarations.cpptypes.fundamental_t

represents long unsigned int type

CPPNAME = 'long unsigned int'
class pygccxml.declarations.cpptypes.member_function_type_t(class_inst=None, return_type=None, arguments_types=None, has_const=False)

Bases: pygccxml.declarations.cpptypes.type_t, pygccxml.declarations.cpptypes.calldef_type_t

describes member function type

NAME_TEMPLATE = '%(return_type)s ( %(class)s::* )( %(arguments)s )%(has_const)s'
TYPEDEF_NAME_TEMPLATE = '%(return_type)s ( %(class)s::*%(typedef_name)s)( %(arguments)s ) %(has_const)s'
build_decl_string(with_defaults=True)
class_inst

reference to parent class

create()
static create_decl_string(return_type, class_decl_string, arguments_types, has_const, with_defaults=True)
create_typedef(typedef_name, class_alias=None, with_defaults=True)

creates typedef to the function type

Parameters:typedef_name – desired type name
Return type:string
has_const

describes, whether function has const modifier

class pygccxml.declarations.cpptypes.member_variable_type_t(class_inst=None, variable_type=None)

Bases: pygccxml.declarations.cpptypes.compound_t

describes member variable type

NAME_TEMPLATE = '%(type)s ( %(class)s::* )'
build_decl_string(with_defaults=True)
variable_type

describes member variable type

class pygccxml.declarations.cpptypes.pointer_t(base)

Bases: pygccxml.declarations.cpptypes.compound_t

represents whatever* type

build_decl_string(with_defaults=True)
class pygccxml.declarations.cpptypes.reference_t(base)

Bases: pygccxml.declarations.cpptypes.compound_t

represents whatever& type

build_decl_string(with_defaults=True)
class pygccxml.declarations.cpptypes.restrict_t(base)

Bases: pygccxml.declarations.cpptypes.compound_t

represents restrict whatever type

build_decl_string(with_defaults=True)
class pygccxml.declarations.cpptypes.short_int_t

Bases: pygccxml.declarations.cpptypes.fundamental_t

represents short int type

CPPNAME = 'short int'
class pygccxml.declarations.cpptypes.short_unsigned_int_t

Bases: pygccxml.declarations.cpptypes.fundamental_t

represents short unsigned int type

CPPNAME = 'short unsigned int'
class pygccxml.declarations.cpptypes.signed_char_t

Bases: pygccxml.declarations.cpptypes.fundamental_t

represents signed char type

CPPNAME = 'signed char'
class pygccxml.declarations.cpptypes.type_qualifiers_t(has_static=False, has_mutable=False)

Bases: object

contains additional information about type: mutable, static, extern

has_extern

synonym to static

has_mutable
has_static
class pygccxml.declarations.cpptypes.type_t

Bases: object

base class for all types

build_decl_string(with_defaults=True)
byte_align

Alignment of this type in bytes @type: int

byte_size

Size of this type in bytes @type: int

clone()

returns new instance of the type

decl_string
partial_decl_string
class pygccxml.declarations.cpptypes.uint128_t

Bases: pygccxml.declarations.cpptypes.fundamental_t

represents __uint128_t type

CPPNAME = '__uint128_t'
class pygccxml.declarations.cpptypes.unknown_t

Bases: pygccxml.declarations.cpptypes.type_t

type, that represents all C++ types, that could not be parsed by GCC-XML

build_decl_string(with_defaults=True)
class pygccxml.declarations.cpptypes.unsigned_char_t

Bases: pygccxml.declarations.cpptypes.fundamental_t

represents unsigned char type

CPPNAME = 'unsigned char'
class pygccxml.declarations.cpptypes.unsigned_int_t

Bases: pygccxml.declarations.cpptypes.fundamental_t

represents unsigned int type

CPPNAME = 'unsigned int'
class pygccxml.declarations.cpptypes.void_t

Bases: pygccxml.declarations.cpptypes.fundamental_t

represents void type

CPPNAME = 'void'
class pygccxml.declarations.cpptypes.volatile_t(base)

Bases: pygccxml.declarations.cpptypes.compound_t

represents volatile whatever type

build_decl_string(with_defaults=True)
class pygccxml.declarations.cpptypes.wchar_t

Bases: pygccxml.declarations.cpptypes.fundamental_t

represents wchar_t type

CPPNAME = 'wchar_t'

declaration

Defines pygccxml.declarations.declaration_t class - all declarations base class.

class pygccxml.declarations.declaration.declaration_t(name='', location=None, is_artificial=False, mangled=None, demangled=None, attributes=None)

Bases: object

Base class for all classes that represent a C++ declaration.

attributes

GCCXML attributes, set using __attribute__((gccxml(”...”)))

@type: str
cache

Implementation detail.

Reference to instance of algorithms_cache_t class.

compiler

Compiler name + version.

@type: str
create_decl_string(with_defaults=True)
decl_string

Declaration full name.

decorated_name

Unique declaration name extracted from a binary file ( .map, .dll, .so, etc ).

@type: str
demangled

Declaration name, reconstructed from GCCXML generated unique name.

@type: str
get_mangled_name()
i_depend_on_them(recursive=True)

Return list of all types and declarations the declaration depends on

is_artificial

Describes whether declaration is compiler generated or not

@type: bool
location

Location of the declaration within source file

@type: location_t
mangled

Unique declaration name generated by the compiler.

For GCCXML, you can get the mangled name for all the declarations. When using CastXML, calling mangled is only allowed on functions and variables. For other declarations it will raise an exception.

Returns:the mangled name
Return type:str
name
Declaration name
@type: str
parent

Reference to parent declaration.

@type: declaration_t
partial_decl_string

Declaration full name.

partial_name

Declaration name, without template default arguments.

Right now std containers is the only classes that support this functionality.

top_parent

Reference to top parent declaration.

@type: declaration_t

decl_factory

defines default declarations factory class

class pygccxml.declarations.decl_factory.decl_factory_t

Bases: object

declarations factory class

create_casting_operator(*arguments, **keywords)

creates instance of class that describes casting operator declaration

create_class(*arguments, **keywords)

creates instance of class that describes class definition declaration

create_class_declaration(*arguments, **keywords)

creates instance of class that describes class declaration

create_constructor(*arguments, **keywords)

creates instance of class that describes constructor declaration

create_destructor(*arguments, **keywords)

creates instance of class that describes destructor declaration

create_enumeration(*arguments, **keywords)

creates instance of class that describes enumeration declaration

create_free_function(*arguments, **keywords)

creates instance of class that describes free function declaration

create_free_operator(*arguments, **keywords)

creates instance of class that describes free operator declaration

create_member_function(*arguments, **keywords)

creates instance of class that describes member function declaration

create_member_operator(*arguments, **keywords)

creates instance of class that describes member operator declaration

create_namespace(*arguments, **keywords)

creates instance of class that describes namespace declaration

create_typedef(*arguments, **keywords)

creates instance of class that describes typedef declaration

create_variable(*arguments, **keywords)

creates instance of class that describes variable declaration

decl_printer

defines class, decl_printer_t that prints declarations tree in a user friendly format

class pygccxml.declarations.decl_printer.decl_printer_t(level=0, print_details=True, recursive=True, writer=None, verbose=True)

Bases: pygccxml.declarations.decl_visitor.decl_visitor_t

helper class for printing declarations tree

INDENT_SIZE = 4
JUSTIFY = 20
clone(increment_level=True)
instance
is_builtin_decl(decl)
level
print_calldef_info(decl=None)
print_decl_header()
print_details
recursive
verbose
visit_casting_operator()
visit_class()
visit_class_declaration()
visit_constructor()
visit_destructor()
visit_enumeration()
visit_free_function()
visit_free_operator()
visit_member_function()
visit_member_operator()
visit_namespace()
visit_typedef()
visit_variable()
writer
pygccxml.declarations.decl_printer.dump_declarations(declarations, file_path)

Dump declarations tree rooted at each of the included nodes to the file

Parameters:
  • declarations – either a single :class:declaration_t object or a list of :class:declaration_t objects
  • file_path – path to a file
pygccxml.declarations.decl_printer.print_declarations(decls, detailed=True, recursive=True, writer=<function <lambda>>, verbose=True)

print declarations tree rooted at each of the included nodes.

Parameters:decls – either a single :class:declaration_t object or list of :class:declaration_t objects

decl_visitor

defines declarations visitor class interface

class pygccxml.declarations.decl_visitor.decl_visitor_t

Bases: object

declarations visitor interface

All functions within this class should be redefined in derived classes.

visit_casting_operator()
visit_class()
visit_class_declaration()
visit_constructor()
visit_destructor()
visit_enumeration()
visit_free_function()
visit_free_operator()
visit_member_function()
visit_member_operator()
visit_namespace()
visit_typedef()
visit_variable()

dependencies

this module contains class that keeps dependency information of some declaration

class pygccxml.declarations.dependencies.dependency_info_t(declaration, depend_on_it, access_type=None, hint=None)

Bases: object

access_type
decl
declaration
depend_on_it
find_out_depend_on_it_declarations()

If declaration depends on other declaration and not on some type this function will return reference to it. Otherwise None will be returned

hint

The declaration, that report dependency can put some additional inforamtion about dependency. It can be used later

static i_depend_on_them(decl)

Returns set of declarations. every item in the returned set, depends on a declaration from the input

static we_depend_on_them(decls)

Returns set of declarations. every item in the returned set, depends on a declaration from the input

class pygccxml.declarations.dependencies.impl_details
static dig_declarations(depend_on_it)

enumeration

defines class, that describes C++ enum

class pygccxml.declarations.enumeration.enumeration_t(name='', values=None)

Bases: pygccxml.declarations.declaration.declaration_t

describes C++ enum

append_value(valuename, valuenum=None)

Append another enumeration value to the enum.

The numeric value may be None in which case it is automatically determined by increasing the value of the last item.

When the ‘values’ attribute is accessed the resulting list will be in the same order as append_value() was called.

Parameters:
  • valuename (str) – The name of the value.
  • valuenum (int) – The numeric value or None.
byte_align

Alignment of this class in bytes @type: int

byte_size

Size of this class in bytes @type: int

get_name2value_dict()

returns a dictionary, that maps between enum name( key ) and enum value( value )

has_value_name(name)

Check if this enum has a particular name among its values.

Parameters:name (str) – Enumeration value name
Return type:True if there is an enumeration value with the given name
i_depend_on_them(recursive=True)
values

A list of tuples (valname(str), valnum(int)) that contain the enumeration values. @type: list

function_traits

defines few algorithms, that deals with different properties of functions

pygccxml.declarations.function_traits.is_same_function(f1, f2)

returns true if f1 and f2 is same function

Use case: sometimes when user defines some virtual function in base class, it overrides it in a derived one. Sometimes we need to know whether two member functions is actually same function.

pygccxml.declarations.function_traits.is_same_return_type(f1, f2)

matcher

Implements a few “find” algorithms on declarations tree

class pygccxml.declarations.matcher.matcher

Bases: object

Class-namespace, contains implementation of a few “find” algorithms and definition of the related exception classes

exception declaration_not_found_t(matcher)

Bases: exceptions.RuntimeError

Exception raised when the declaration could not be found

static matcher.find(decl_matcher, decls, recursive=True)

Returns a list of declarations that match decl_matcher defined criteria or None

Parameters:
  • decl_matcher – Python callable object, that takes one argument - reference to a declaration
  • decls – the search scope, :class:declaration_t object or :class:declaration_t objects list t
  • recursive – boolean, if True, the method will run decl_matcher on the internal declarations too
static matcher.find_single(decl_matcher, decls, recursive=True)

Returns a reference to the declaration, that match decl_matcher defined criteria.

if a unique declaration could not be found the method will return None.

Parameters:
  • decl_matcher – Python callable object, that takes one argument - reference to a declaration
  • decls – the search scope, :class:declaration_t object or :class:declaration_t objects list t
  • recursive – boolean, if True, the method will run decl_matcher on the internal declarations too
static matcher.get_single(decl_matcher, decls, recursive=True)

Returns a reference to declaration, that match decl_matcher defined criteria.

If a unique declaration could not be found, an appropriate exception will be raised.

Parameters:
  • decl_matcher – Python callable object, that takes one argument - reference to a declaration
  • decls – the search scope, :class:declaration_t object or :class:declaration_t objects list t
  • recursive – boolean, if True, the method will run decl_matcher on the internal declarations too
exception matcher.multiple_declarations_found_t(matcher)

Bases: exceptions.RuntimeError

Exception raised when more than one declaration was found

matchers

defines all “built-in” classes that implement declarations compare functionality according to some criteria

class pygccxml.declarations.matchers.access_type_matcher_t(access_type)

Bases: pygccxml.declarations.matchers.matcher_base_t

Instance of this class will match declaration by its access type: public, private or protected. If declarations does not have access type, for example free function, then False will be returned.

class pygccxml.declarations.matchers.and_matcher_t(matchers)

Bases: pygccxml.declarations.matchers.matcher_base_t

Combine several other matchers with “&” (and) operator.

For example: find all private functions with name XXX

matcher = access_type_matcher_t( 'private' ) &            calldef_matcher_t( name='XXX' )
class pygccxml.declarations.matchers.calldef_matcher_t(name=None, return_type=None, arg_types=None, decl_type=None, header_dir=None, header_file=None)

Bases: pygccxml.declarations.matchers.declaration_matcher_t

Instance of this class will match callable by the following criteria:
class pygccxml.declarations.matchers.custom_matcher_t(function)

Bases: pygccxml.declarations.matchers.matcher_base_t

Instance of this class will match declaration by user custom criteria.

class pygccxml.declarations.matchers.declaration_matcher_t(name=None, decl_type=None, header_dir=None, header_file=None)

Bases: pygccxml.declarations.matchers.matcher_base_t

Instance of this class will match declarations by next criteria:
  • declaration name, also could be fully qualified name Example: wstring or ::std::wstring
  • declaration type Example: class_t, namespace_t, enumeration_t
  • location within file system ( file or directory )
check_name(decl)
decl_name_only
is_full_name()
name
class pygccxml.declarations.matchers.matcher_base_t

Bases: object

matcher_base_t class defines interface for classes that will implement compare functionality according to some criteria.

class pygccxml.declarations.matchers.namespace_matcher_t(name=None)

Bases: pygccxml.declarations.matchers.declaration_matcher_t

Instance of this class will match namespaces by name.

class pygccxml.declarations.matchers.not_matcher_t(matcher)

Bases: pygccxml.declarations.matchers.matcher_base_t

return the inverse result of a matcher

For example: find all public and protected declarations

matcher = ~access_type_matcher_t( 'private' )
class pygccxml.declarations.matchers.operator_matcher_t(name=None, symbol=None, return_type=None, arg_types=None, decl_type=None, header_dir=None, header_file=None)

Bases: pygccxml.declarations.matchers.calldef_matcher_t

Instance of this class will match operators by next criteria:
class pygccxml.declarations.matchers.or_matcher_t(matchers)

Bases: pygccxml.declarations.matchers.matcher_base_t

Combine several other matchers with “|” (or) operator.

For example: find all functions and variables with name ‘XXX’

matcher = variable_matcher_t( name='XXX' ) |            calldef_matcher_t( name='XXX' )
class pygccxml.declarations.matchers.regex_matcher_t(regex, function=None)

Bases: pygccxml.declarations.matchers.matcher_base_t

Instance of this class will match declaration using regular expression. User should supply a function that will extract from declaration desired information as string. Later, this matcher will match that string using user regular expression.

class pygccxml.declarations.matchers.variable_matcher_t(name=None, type=None, header_dir=None, header_file=None)

Bases: pygccxml.declarations.matchers.declaration_matcher_t

Instance of this class will match variables by next criteria:
class pygccxml.declarations.matchers.virtuality_type_matcher_t(virtuality_type)

Bases: pygccxml.declarations.matchers.matcher_base_t

Instance of this class will match declaration by its virtual type: not virtual, virtual or pure virtual. If declarations does not have “virtual” property, for example free function, then False will be returned.

mdecl_wrapper

defines class mdecl_wrapper_t that allows to work on set of declarations, as it was one declaration.

The class allows user to not write “for” loops within the code.

class pygccxml.declarations.mdecl_wrapper.call_redirector_t(name, decls)

Bases: object

Internal class used to call some function of objects

class pygccxml.declarations.mdecl_wrapper.mdecl_wrapper_t(decls)

Bases: object

multiple declarations class wrapper

The main purpose of this class is to allow an user to work on many declarations, as they were only one single declaration.

For example, instead of writing for loop like the following

for c in global_namespace.classes():
    c.attribute = "xxxx"

you can write:

global_namespace.classes().attribute = "xxxx"

The same functionality could be applied on “set” methods too.

to_list()

namespace

Describe a C++ namespace declaration.

class pygccxml.declarations.namespace.namespace_t(name='', declarations=None)

Bases: pygccxml.declarations.scopedef.scopedef_t

Describes C++ namespace.

adopt_declaration(decl)
declarations

list of children declarations

free_fun(name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None)

Returns reference to free function declaration that matches a defined criteria.

free_function(name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None)

Returns reference to free function declaration that matches a defined criteria.

free_functions(name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)

Returns a set of free function declarations that match a defined criteria.

free_funs(name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)

Returns a set of free function declarations that match a defined criteria.

free_operator(name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None)

Returns reference to free operator declaration that matches a defined criteria.

free_operators(name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)

Returns a set of free operator declarations that match a defined criteria.

i_depend_on_them(recursive=True)
namespace(name=None, function=None, recursive=None)

Returns reference to namespace declaration that matches a defined criteria.

namespaces(name=None, function=None, recursive=None, allow_empty=None)

Returns a set of namespace declarations that match a defined criteria.

ns(name=None, function=None, recursive=None)

Returns reference to namespace declaration that matches a defined criteria.

nss(name=None, function=None, recursive=None, allow_empty=None)

Returns a set of namespace declarations that match a defined criteria.

remove_declaration(decl)

Removes declaration from members list.

Parameters:decl (declaration_t) – declaration to be removed
take_parenting(inst)

Takes parenting from inst and transfers it to self.

scopedef

Defines scopedef_t class

class pygccxml.declarations.scopedef.scopedef_t(name='')

Bases: pygccxml.declarations.declaration.declaration_t

Base class for namespace_t and class_t classes.

This is the base class for all declaration classes that may have children nodes. The children can be accessed via the scopedef_t.declarations property.

Also this class provides “get/select/find” interface. Using this class you can get instance or instances of internal declaration(s).

You can find declaration(s) using next criteria:

  1. name - declaration name, could be full qualified name

  2. header_dir - directory, to which belongs file, that the

    declaration was declared in. header_dir should be absolute path.

  3. header_file - file that the declaration was declared in.

  4. function - user ( your ) custom criteria. The interesting thing

    is that this function will be joined with other arguments (criteria).

  5. recursive - the search declaration range, if True will be search

    in internal declarations too.

Every “”query”” API, takes name or function as the first argument.

global_namespace.member_function("do_something)

the statement returns reference to member function named “do_something”. If there the function doesn’t exist or more than one function exists, an exception is raised.

If you want to query for many declarations, use other function(s):

do_something = global_namespace.member_functions("do_something")

the statement returns mdecl_wrapper_t instance. That object will save you writing for loops. For more information see the class documentation.

ALLOW_EMPTY_MDECL_WRAPPER = False
RECURSIVE_DEFAULT = True
calldef(name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None)

returns reference to “calldef” declaration, that is matched defined criteria

calldefs(name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)

returns a set of calldef_t declarations, that are matched defined criteria

casting_operator(name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None)

returns reference to casting operator declaration, that is matched defined criteria

casting_operators(name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)

returns a set of casting operator declarations, that are matched defined criteria

class_(name=None, function=None, header_dir=None, header_file=None, recursive=None)

returns reference to class declaration, that is matched defined criteria

classes(name=None, function=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)

returns a set of class declarations, that are matched defined criteria

clear_optimizer()

Cleans query optimizer state

constructor(name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None)

returns reference to constructor declaration, that is matched defined criteria

constructors(name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)

returns a set of constructor declarations, that are matched defined criteria

decl(name=None, function=None, decl_type=None, header_dir=None, header_file=None, recursive=None)

returns reference to declaration, that is matched defined criteria

exception declaration_not_found_t(matcher)

Bases: exceptions.RuntimeError

Exception raised when the declaration could not be found

scopedef_t.declarations

list of children declarations

scopedef_t.decls(name=None, function=None, decl_type=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)

returns a set of declarations, that are matched defined criteria

scopedef_t.enum(name=None, function=None, header_dir=None, header_file=None, recursive=None)

adding small aliase to enumeration method

scopedef_t.enumeration(name=None, function=None, header_dir=None, header_file=None, recursive=None)

returns reference to enumeration declaration, that is matched defined criteria

scopedef_t.enumerations(name=None, function=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)

returns a set of enumeration declarations, that are matched defined criteria

scopedef_t.enums(name=None, function=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)

returns a set of enumeration declarations, that are matched defined criteria

scopedef_t.init_optimizer()

Initializes query optimizer state.

There are 4 internals hash tables:
  1. from type to declarations
  2. from type to declarations for non-recursive queries
  3. from type to name to declarations
  4. from type to name to declarations for non-recursive queries

Almost every query includes declaration type information. Also very common query is to search some declaration(s) by name or full name. Those hash tables allows to search declaration very quick.

scopedef_t.mem_fun(name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None)

returns reference to member declaration, that is matched defined criteria

scopedef_t.mem_funs(name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)

returns a set of member function declarations, that are matched defined criteria

scopedef_t.mem_oper(name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None)

returns reference to member operator declaration, that is matched defined criteria

scopedef_t.mem_opers(name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)

returns a set of member operator declarations, that are matched defined criteria

scopedef_t.member_function(name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None)

returns reference to member declaration, that is matched defined criteria

scopedef_t.member_functions(name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)

returns a set of member function declarations, that are matched defined criteria

scopedef_t.member_operator(name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None)

returns reference to member operator declaration, that is matched defined criteria

scopedef_t.member_operators(name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)

returns a set of member operator declarations, that are matched defined criteria

exception scopedef_t.multiple_declarations_found_t(matcher)

Bases: exceptions.RuntimeError

Exception raised when more than one declaration was found

scopedef_t.operator(name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None)

returns reference to operator declaration, that is matched defined criteria

scopedef_t.operators(name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)

returns a set of operator declarations, that are matched defined criteria

scopedef_t.remove_declaration(decl)
scopedef_t.typedef(name=None, function=None, header_dir=None, header_file=None, recursive=None)

returns reference to typedef declaration, that is matched defined criteria

scopedef_t.typedefs(name=None, function=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)

returns a set of typedef declarations, that are matched defined criteria

scopedef_t.var(name=None, function=None, type=None, header_dir=None, header_file=None, recursive=None)
scopedef_t.variable(name=None, function=None, type=None, header_dir=None, header_file=None, recursive=None)

returns reference to variable declaration, that is matched defined criteria

scopedef_t.variables(name=None, function=None, type=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)

returns a set of variable declarations, that are matched defined criteria

scopedef_t.vars(name=None, function=None, type=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)

templates

template instantiation parser

This module provides functionality necessary to

C++ template instantiations

pygccxml.declarations.templates.args(decl_string)

returns list of template arguments

Return type:[str]
pygccxml.declarations.templates.is_instantiation(decl_string)

returns True if decl_string is template instantiation and False otherwise

Parameters:decl_string (str) – string that should be checked for pattern presence
Return type:bool
pygccxml.declarations.templates.join(name, args)

returns name< argument_1, argument_2, ..., argument_n >

pygccxml.declarations.templates.name(decl_string)

returns name of instantiated template

Return type:str
pygccxml.declarations.templates.normalize(decl_string)

returns decl_string, which contains “normalized” spaces

this functionality allows to implement comparison of 2 different string which are actually same: x::y< z > and x::y<z>

pygccxml.declarations.templates.split(decl_string)

returns (name, [arguments] )

pygccxml.declarations.templates.split_recursive(decl_string)

returns [(name, [arguments])]

typedef

defines class that describes C++ typedef declaration

class pygccxml.declarations.typedef.typedef_t(name='', type=None)

Bases: pygccxml.declarations.declaration.declaration_t

describes C++ typedef declaration

byte_align

alignment of this type in bytes @type: int

byte_size

Size of this type in bytes @type: int

i_depend_on_them(recursive=True)
type

reference to the original type

type_traits

defines few algorithms, that deals with different C++ type properties

Are you aware of boost::type_traits library? pygccxml implements the same functionality.

This module contains a set of very specific traits functionsclasses, each of which encapsulate a single trait from the C++ type system. For example: * is a type a pointer or a reference type ? * does a type have a trivial constructor ? * does a type have a const-qualifier ?

pygccxml.declarations.type_traits.array_item_type(type_)

returns array item type

pygccxml.declarations.type_traits.array_size(type)

returns array size

class pygccxml.declarations.type_traits.auto_ptr_traits

Bases: object

implements functionality, needed for convenient work with std::auto_ptr pointers

static is_smart_pointer(type_)

returns True, if type represents instantiation of boost::shared_ptr, False otherwise

static value_type(type_)

returns reference to boost::shared_ptr value type

pygccxml.declarations.type_traits.base_type(type)

returns base type.

For const int will return int

pygccxml.declarations.type_traits.class_declaration_traits = <pygccxml.declarations.type_traits.declaration_xxx_traits object>

implements functionality, needed for convenient work with C++ class declarations

pygccxml.declarations.type_traits.class_traits = <pygccxml.declarations.type_traits.declaration_xxx_traits object>

implements functionality, needed for convenient work with C++ classes

pygccxml.declarations.type_traits.create_cv_types(base)

implementation details

class pygccxml.declarations.type_traits.declaration_xxx_traits(declaration_class)

Bases: object

this class implements the functionality needed for convenient work with declaration classes

Implemented functionality:
  • find out whether a declaration is a desired one
  • get reference to the declaration
get_declaration(type_)

returns reference to the declaration

Precondition: self.is_my_case( type ) == True

is_my_case(type_)

returns True, if type represents the desired declaration, False otherwise

sequence = [<function remove_alias at 0x7faea61a52a8>, <function remove_cv at 0x7faea61accf8>, <function remove_declarated at 0x7faea61acb18>]
pygccxml.declarations.type_traits.decompose_class(type)

implementation details

pygccxml.declarations.type_traits.decompose_type(tp)

implementation details

pygccxml.declarations.type_traits.does_match_definition(given, main, secondary)

implementation details

pygccxml.declarations.type_traits.enum_declaration = <bound method declaration_xxx_traits.get_declaration of <pygccxml.declarations.type_traits.declaration_xxx_traits object at 0x7faea61a92d0>>

returns reference to enum declaration

pygccxml.declarations.type_traits.enum_traits = <pygccxml.declarations.type_traits.declaration_xxx_traits object>

implements functionality, needed for convenient work with C++ enums

pygccxml.declarations.type_traits.find_trivial_constructor(type_)

returns reference to trivial constructor or None

pygccxml.declarations.type_traits.has_any_non_copyconstructor(type)

if class has any public constructor, which is not copy constructor, this function will return list of them, otherwise None

pygccxml.declarations.type_traits.has_copy_constructor(class_)

if class has public copy constructor, this function will return reference to it, None otherwise

pygccxml.declarations.type_traits.has_destructor(class_)

if class has destructor, this function will return reference to it, None otherwise

pygccxml.declarations.type_traits.has_public_assign(class_)

returns True, if class has public assign operator, False otherwise

pygccxml.declarations.type_traits.has_public_binary_operator(type_, operator_symbol)

returns True, if type_ has public binary operator, otherwise False

pygccxml.declarations.type_traits.has_public_constructor(class_)

if class has any public constructor, this function will return list of them, otherwise None

pygccxml.declarations.type_traits.has_public_destructor(type)

returns True, if class has public destructor, False otherwise

pygccxml.declarations.type_traits.has_public_equal(type)

returns True, if class has public operator==, otherwise False

pygccxml.declarations.type_traits.has_public_less(type)

returns True, if class has public operator<, otherwise False

pygccxml.declarations.type_traits.has_trivial_constructor(class_)

if class has public trivial constructor, this function will return reference to it, None otherwise

class pygccxml.declarations.type_traits.impl_details

Bases: object

implementation details

static find_value_type(global_ns, value_type_str)

implementation details

static is_defined_in_xxx(xxx, cls)

implementation details

class pygccxml.declarations.type_traits.internal_type_traits

Bases: object

small convenience class, which provides access to internal types

static get_by_name(type_, name)
pygccxml.declarations.type_traits.is_arithmetic(type)

returns True, if type represents C++ integral or floating point type, False otherwise

pygccxml.declarations.type_traits.is_array(type)

returns True, if type represents C++ array type, False otherwise

pygccxml.declarations.type_traits.is_base_and_derived(based, derived)

returns True, if there is “base and derived” relationship between classes, False otherwise

pygccxml.declarations.type_traits.is_binary_operator(oper)

returns True, if operator is binary operator, otherwise False

pygccxml.declarations.type_traits.is_bool(type_)

returns True, if type represents bool, False otherwise

pygccxml.declarations.type_traits.is_calldef_pointer(type)

returns True, if type represents pointer to free/member function, False otherwise

pygccxml.declarations.type_traits.is_class = <bound method declaration_xxx_traits.is_my_case of <pygccxml.declarations.type_traits.declaration_xxx_traits object at 0x7faea61a9310>>

returns True, if type represents C++ class definition, False otherwise

pygccxml.declarations.type_traits.is_class_declaration = <bound method declaration_xxx_traits.is_my_case of <pygccxml.declarations.type_traits.declaration_xxx_traits object at 0x7faea61a9350>>

returns True, if type represents C++ class declaration, False otherwise

pygccxml.declarations.type_traits.is_const(type)

returns True, if type represents C++ const type, False otherwise

pygccxml.declarations.type_traits.is_convertible(source, target)

returns True, if source could be converted to target, otherwise False

pygccxml.declarations.type_traits.is_defined_in_xxx(xxx, cls)

small helper function, that checks whether the class cls is defined under ::xxx namespace

pygccxml.declarations.type_traits.is_enum = <bound method declaration_xxx_traits.is_my_case of <pygccxml.declarations.type_traits.declaration_xxx_traits object at 0x7faea61a92d0>>

returns True, if type represents C++ enumeration declaration, False otherwise

pygccxml.declarations.type_traits.is_floating_point(type)

returns True, if type represents C++ floating point type, False otherwise

pygccxml.declarations.type_traits.is_fundamental(type)

returns True, if type represents C++ fundamental type

pygccxml.declarations.type_traits.is_integral(type)

returns True, if type represents C++ integral type, False otherwise

pygccxml.declarations.type_traits.is_noncopyable(class_)

returns True, if class is noncopyable, False otherwise

pygccxml.declarations.type_traits.is_pointer(type)

returns True, if type represents C++ pointer type, False otherwise

pygccxml.declarations.type_traits.is_reference(type)

returns True, if type represents C++ reference type, False otherwise

pygccxml.declarations.type_traits.is_same(type1, type2)

returns True, if type1 and type2 are same types

pygccxml.declarations.type_traits.is_std_ostream(type_)

Returns True, if type represents C++ std::ostream, False otherwise.

pygccxml.declarations.type_traits.is_std_string(type_)

Returns True, if type represents C++ std::string, False otherwise.

pygccxml.declarations.type_traits.is_std_wostream(type_)

Returns True, if type represents C++ std::wostream, False otherwise.

pygccxml.declarations.type_traits.is_std_wstring(type_)

Returns True, if type represents C++ std::wstring, False otherwise.

pygccxml.declarations.type_traits.is_unary_operator(oper)

returns True, if operator is unary operator, otherwise False

pygccxml.declarations.type_traits.is_union(type_)

returns True if type represents a C++ union

pygccxml.declarations.type_traits.is_void(type)

returns True, if type represents void, False otherwise

pygccxml.declarations.type_traits.is_void_pointer(type)

returns True, if type represents void*, False otherwise

pygccxml.declarations.type_traits.is_volatile(type)

returns True, if type represents C++ volatile type, False otherwise

pygccxml.declarations.type_traits.remove_alias(type_)

returns type without typedefs

pygccxml.declarations.type_traits.remove_const(type_)

removes const from the type definition

If type is not const type, it will be returned as is

pygccxml.declarations.type_traits.remove_cv(type)

removes const and volatile from the type definition

pygccxml.declarations.type_traits.remove_declarated(type_)

removes type-declaration class-binder declarated_t from the type_

If type_ is not declarated_t, it will be returned as is

pygccxml.declarations.type_traits.remove_pointer(type)

removes pointer from the type definition

If type is not pointer type, it will be returned as is.

pygccxml.declarations.type_traits.remove_reference(type)

removes reference from the type definition

If type is not reference type, it will be returned as is.

pygccxml.declarations.type_traits.remove_volatile(type)

removes volatile from the type definition

If type is not volatile type, it will be returned as is

class pygccxml.declarations.type_traits.smart_pointer_traits

Bases: object

implements functionality, needed for convenient work with smart pointers

static is_smart_pointer(type_)

returns True, if type represents instantiation of boost::shared_ptr or std::shared_ptr, False otherwise

static value_type(type_)

returns reference to boost::shared_ptr or std::shared_ptr value type

type_visitor

defines types visitor class interface

class pygccxml.declarations.type_visitor.type_visitor_t

Bases: object

types visitor interface

All functions within this class should be redefined in derived classes.

visit_array()
visit_bool()
visit_char()
visit_complex_double()
visit_complex_float()
visit_complex_long_double()
visit_const()
visit_declarated()
visit_double()
visit_ellipsis()
visit_float()
visit_free_function_type()
visit_int()
visit_int128()
visit_jboolean()
visit_jbyte()
visit_jchar()
visit_jdouble()
visit_jfloat()
visit_jint()
visit_jlong()
visit_jshort()
visit_long_double()
visit_long_int()
visit_long_long_int()
visit_long_long_unsigned_int()
visit_long_unsigned_int()
visit_member_function_type()
visit_member_variable_type()
visit_pointer()
visit_reference()
visit_restrict()
visit_short_int()
visit_short_unsigned_int()
visit_signed_char()
visit_uint128()
visit_unsigned_char()
visit_unsigned_int()
visit_void()
visit_volatile()
visit_wchar()

variable

defines class that describes C++ global and member variable declaration

class pygccxml.declarations.variable.variable_t(name='', type=None, type_qualifiers=None, value=None, bits=None, mangled=None)

Bases: pygccxml.declarations.declaration.declaration_t

describes C++ global and member variable declaration

access_type
bits

integer, that contains information about how many bit takes bit field

byte_offset

integer, offset of the field from the beginning of class.

get_mangled_name()
i_depend_on_them(recursive=True)
mangled

Unique declaration name generated by the compiler.

Returns:the mangled name
Return type:str
type

reference to the variable type

type_qualifiers

reference to the type_qualifiers_t instance

value

string, that contains the variable value