Modules
algorithm
defines few unrelated algorithms, that works on declarations
-
pygccxml.declarations.algorithm.apply_visitor(visitor, decl_inst)
applies a visitor on declaration instance
| Parameter: | 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.
| Parameter: | 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
| Parameter: | 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
| Parameter: | 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.
| Parameter: | 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)
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 do match one of specified criteria
| Parameter: | 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
| Parameter: | 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 class 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()
-
remove_alias
-
reset()
calldef
defines classes, that describes “callable” declarations
- This modules contains definition for next C++ declarations:
- operator
-
- function
-
constructor
destructor
-
class pygccxml.declarations.calldef.CALLING_CONVENTION_TYPES
class that defines “calling convention” constants
- extracts calling convention from the text. If the calling convention could not be found, the “default”is used
-
pygccxml.declarations.calldef.FUNCTION_VIRTUALITY_TYPES
- alias of VIRTUALITY_TYPES
-
class pygccxml.declarations.calldef.VIRTUALITY_TYPES
- class that defines “virtuality” constants
-
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)
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
-
get_calling_convention()
-
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
-
i_depend_on_them(recursive=True)
-
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
-
set_calling_convention(cc)
-
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
-
get_virtuality()
-
guess_calling_convention()
-
has_const
- describes, whether “callable” has const modifier or not
-
has_static
- describes, whether “callable” has static modifier or not
-
set_virtuality(virtuality)
-
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
-
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(decl_string)
returns list of function arguments
-
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(decl_string)
returns True if decl_string is function invocation and False otherwise
| Parameter: | decl_string (str) – string that should be checked for pattern presence |
| 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(decl_string)
returns name of function
-
pygccxml.declarations.call_invocation.split(decl_string)
- returns (name, [arguments] )
-
pygccxml.declarations.call_invocation.split_recursive(decl_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
- class that defines “access” constants
-
class pygccxml.declarations.class_declaration.CLASS_TYPES
- class that defines “class” type constants
-
class pygccxml.declarations.class_declaration.class_declaration_t(name='')
Bases: pygccxml.declarations.declaration.declaration_t
describes class declaration
creates class that describes C++ class declaration( and not definition )
-
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
creates class that describes C++ class definition
-
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
| Parameter: | 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.
| Parameter: | 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
| Parameter: | 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
-
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
creates class that contains partial information about 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
compilers
contains enumeration of all compilers supported by the project
-
pygccxml.declarations.compilers.on_missing_functionality(compiler, functionality)
container_traits
defines few algorithms, that deals with different properties of std containers
-
pygccxml.declarations.container_traits.container_traits
- tuple of all STD container traits classes
-
class pygccxml.declarations.container_traits.container_traits_impl_t(container_name, element_type_index, element_type_typedef, defaults_remover, key_type_index=None, key_type_typedef=None)
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 parsers the class name in order to
extract the information.
| Parameters: |
- container_name – std container name
- element_type_index – position of valuemapped type within template arguments list
- element_type_typedef – class typedef to the valuemapped type
- key_type_index – position of key type within template arguments list
- key_type_typedef – class typedef to the key type
|
-
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 template class instantiation
- For example:
std::vector< int, std::allocator< int > >
- will become
-
-
pygccxml.declarations.container_traits.create_traits
- alias of container_traits_impl_t
-
class pygccxml.declarations.container_traits.defaults_eraser
-
static erase_allocator(cls_name, default_allocator='std::allocator')
-
static erase_compare_allocator(cls_name, default_compare='std::less', default_allocator='std::allocator')
-
static erase_container(cls_name, default_container_name='std::deque')
-
static erase_container_compare(cls_name, default_container_name='std::vector', default_compare='std::less')
-
static erase_hash_allocator(cls_name)
-
static erase_hashmap_compare_allocator(cls_name)
-
static erase_map_compare_allocator(cls_name, default_compare='std::less', default_allocator='std::allocator')
-
static erase_recursive(cls_name)
-
static normalize(type_str)
-
class recursive_impl
-
static decorated_call_prefix(cls_name, text, doit)
-
static decorated_call_suffix(cls_name, text, doit)
-
static erase_call(cls_name)
-
static erase_recursive(cls_name)
-
static defaults_eraser.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
- 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
-
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
-
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
-
class pygccxml.declarations.cpptypes.complex_double_t
Bases: pygccxml.declarations.cpptypes.fundamental_t
represents complex double type
-
class pygccxml.declarations.cpptypes.complex_float_t
Bases: pygccxml.declarations.cpptypes.fundamental_t
represents complex float type
-
class pygccxml.declarations.cpptypes.complex_long_double_t
Bases: pygccxml.declarations.cpptypes.fundamental_t
represents complex long double type
-
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
-
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
-
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
-
build_decl_string(with_defaults=True)
-
static create_decl_string(return_type, arguments_types, with_defaults=True)
returns free function type
-
create_typedef(typedef_name, unused=None, with_defaults=True)
returns string, that contains valid C++ code, that defines typedef to function type
| Parameter: | 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.int_t
Bases: pygccxml.declarations.cpptypes.fundamental_t
represents int type
-
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
-
class pygccxml.declarations.cpptypes.jbyte_t
Bases: pygccxml.declarations.cpptypes.java_fundamental_t
represents jbyte type
-
class pygccxml.declarations.cpptypes.jchar_t
Bases: pygccxml.declarations.cpptypes.java_fundamental_t
represents jchar type
-
class pygccxml.declarations.cpptypes.jdouble_t
Bases: pygccxml.declarations.cpptypes.java_fundamental_t
represents jdouble type
-
class pygccxml.declarations.cpptypes.jfloat_t
Bases: pygccxml.declarations.cpptypes.java_fundamental_t
represents jfloat type
-
class pygccxml.declarations.cpptypes.jint_t
Bases: pygccxml.declarations.cpptypes.java_fundamental_t
represents jint type
-
class pygccxml.declarations.cpptypes.jlong_t
Bases: pygccxml.declarations.cpptypes.java_fundamental_t
represents jlong type
-
class pygccxml.declarations.cpptypes.jshort_t
Bases: pygccxml.declarations.cpptypes.java_fundamental_t
represents jshort type
-
class pygccxml.declarations.cpptypes.long_double_t
Bases: pygccxml.declarations.cpptypes.fundamental_t
represents long double type
-
class pygccxml.declarations.cpptypes.long_int_t
Bases: pygccxml.declarations.cpptypes.fundamental_t
represents long int type
-
class pygccxml.declarations.cpptypes.long_long_int_t
Bases: pygccxml.declarations.cpptypes.fundamental_t
represents long long int type
-
class pygccxml.declarations.cpptypes.long_long_unsigned_int_t
Bases: pygccxml.declarations.cpptypes.fundamental_t
represents long long unsigned int type
-
class pygccxml.declarations.cpptypes.long_unsigned_int_t
Bases: pygccxml.declarations.cpptypes.fundamental_t
represents long unsigned int type
-
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
-
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
| Parameter: | 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
-
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
-
class pygccxml.declarations.cpptypes.short_unsigned_int_t
Bases: pygccxml.declarations.cpptypes.fundamental_t
represents short unsigned int type
-
class pygccxml.declarations.cpptypes.signed_char_t
Bases: pygccxml.declarations.cpptypes.fundamental_t
represents signed char type
-
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
-
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.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
-
class pygccxml.declarations.cpptypes.unsigned_int_t
Bases: pygccxml.declarations.cpptypes.fundamental_t
represents unsigned int type
-
class pygccxml.declarations.cpptypes.void_t
Bases: pygccxml.declarations.cpptypes.fundamental_t
represents void type
-
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
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 details
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
- GCCXML generated unique declaration name
@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
-
class pygccxml.declarations.declaration.location_t(file_name='', line=-1)
Bases: object
provides information about the location of the declaration within the source file
-
as_tuple()
- return tuple(self.file_name, self.line)
-
file_name
- absolute source file name, type string
-
line
- line number, type int
decl_factory
defines default declarations factory class
-
class pygccxml.declarations.decl_factory.decl_factory_t
Bases: object
declarations factory class
creates declarations factory
-
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
-
clone(increment_level=True)
-
instance
-
is_builtin_decl(decl)
-
level
-
print_calldef_info(decl=None)
-
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(decls, fpath)
dump declarations tree rooted at each of the included nodes to the file
| Parameters: |
- decls – either a single :class:declaration_t object or list of :class:declaration_t objects
- fpath – file name
|
-
pygccxml.declarations.decl_printer.print_declarations(decls, detailed=True, recursive=True, writer=<function <lambda> at 0x11fdf50>, verbose=True)
print declarations tree rooted at each of the included nodes.
| Parameter: | 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
creates class that describes C++ enum declaration
The items of the list ‘values’ may either be strings containing
the enumeration value name or tuples (name, numeric value).
| Parameters: |
- name (str) – enum name
- parent (declaration_t) – Parent declaration
- values (list) – Enumeration values
|
-
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.
| Parameter: | 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 few “find” algorithms on declarations tree
-
class pygccxml.declarations.matcher.matcher
class-namespace, contains implementation of few “find” algorithms and
definition of related exception classes
-
exception declaration_not_found_t(matcher)
Bases: exceptions.RuntimeError
exception, that will be raised, if 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, that will be raised, if 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.
| Parameter: | access_type
– declaration access type, could be “public”, “private”, “protected” |
-
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:
-
| Parameters: |
- return_type (string or instance of type_t derived class) – callable return type
- arg_types (list) – list of function argument types. arg_types can contain.
Any item within the list could be string or instance
of type_t derived class. If you don’t want
some argument to participate in match you can put None.
|
For example:
calldef_matcher_t( arg_types=[ 'int &', None ] )
will match all functions that takes 2 arguments, where the first one is
reference to integer and second any
-
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.
| Parameter: | function – callable, that takes single argument - declaration instance
should return True or False |
-
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 )
| Parameters: |
- decl_type (any class that derives from declaration_t class) – declaration type to match by. For example enumeration_t.
- name (str) – declaration name, could be full name.
- header_dir (str) – absolute directory path
- header_file (str) – absolute file path
|
-
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:
-
| Parameter: | symbol (str) – operator symbol |
-
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.
| Parameters: |
- regex (string, an instance of this class will compile it for you) – regular expression
- function – function that will be called to get an information from
declaration as string. As input this function takes single
argument - reference to a declaration. Return value
should be string. If function is None, then the matcher
will use declaration name.
|
-
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:
-
| Parameter: | type (string or instance of type_t derived class) – variable type |
-
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.
| Parameter: | access_type (:class:VIRTUALITY_TYPES defines few constants for your convenience.) – declaration access type |
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
creates call_redirector_t instance.
| Parameters: |
- name – name of method, to be called on every object in the decls list
- decls – list 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.compiler = "GCCXML 1.127"
you can write:
global_namespace.classes().compiler = "GCCXML 1.127"
The same functionality could be applied on “set” methods too.
| Parameter: | decls (list of declaration wrappers) – list of declarations to operate on. |
-
to_list()
namespace
defines class, that describes C++ namespace declaration
-
class pygccxml.declarations.namespace.namespace_t(name='', declarations=None)
Bases: pygccxml.declarations.scopedef.scopedef_t
describes C++ namespace
creates class that describes C++ namespace declaration
-
adopt_declaration(decl)
-
declarations
- list of all declarations, defined in the namespace
-
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 is matched 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 is matched 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 are matched 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 are matched 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 is matched 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 are matched defined criteria
-
i_depend_on_them(recursive=True)
-
namespace(name=None, function=None, recursive=None)
- returns reference to namespace declaration, that is matched defined criteria
-
namespaces(name=None, function=None, recursive=None, allow_empty=None)
- returns a set of namespace declarations, that are matched defined criteria
-
ns(name=None, function=None, recursive=None)
- returns reference to namespace declaration, that is matched defined criteria
-
nss(name=None, function=None, recursive=None, allow_empty=None)
- returns a set of namespace declarations, that are matched defined criteria
-
remove_declaration(decl)
removes decl from members list
| Parameter: | 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:
- name - declaration name, could be full qualified name
- header_dir - directory, to which belongs file, that the declaration was declared in.
header_dir should be absolute path.
- header_file - file that the declaration was declared in.
- function - user ( your ) custom criteria. The interesting thing is that
this function will be joined with other arguments ( criteria ).
- 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.
-
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, that will be raised, if 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
- 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:
- from type to declarations
- from type to declarations for non-recursive queries
- from type to name to declarations
- 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, that will be raised, if 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)
- returns reference to variable declaration, that is matched defined criteria
-
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)
- returns a set of variable declarations, that are matched defined criteria
templates
template instantiation parser
This module provides functionality necessary to
C++ template instantiations
-
pygccxml.declarations.templates.args(decl_string)
returns list of template arguments
-
pygccxml.declarations.templates.is_instantiation(decl_string)
returns True if decl_string is template instantiation and False otherwise
| Parameter: | 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
-
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
creates class that describes C++ typedef
-
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
Do 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
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
- implements functionality, needed for convenient work with C++ class declarations
-
pygccxml.declarations.type_traits.class_traits
- 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)
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
-
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
- returns reference to enum declaration
-
pygccxml.declarations.type_traits.enum_traits
- 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
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
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
- returns True, if type represents C++ class definition, False otherwise
-
pygccxml.declarations.type_traits.is_class_declaration
- 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
- 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::string, 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::string, 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_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
implements functionality, needed for convenient work with smart 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
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_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_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)
Bases: pygccxml.declarations.declaration.declaration_t
describes C++ global and member variable declaration
creates class that describes C++ global or member variable
-
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)
-
type
- reference to the variable type
-
type_qualifiers
- reference to the type_qualifiers_t instance
-
value
- string, that contains the variable value