pygccxml.declarations package¶
Overview¶
Contains classes that describe different C++ declarations
-
pygccxml.declarations.
access_type_matcher
¶ see
access_type_matcher_t
for documentationalias of
access_type_matcher_t
-
pygccxml.declarations.
all_container_traits
= (<pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>)¶ tuple of all STD container traits classes
-
pygccxml.declarations.
and_matcher
¶ see
and_matcher_t
for documentationalias of
and_matcher_t
-
pygccxml.declarations.
calldef_matcher
¶ see
calldef_matcher_t
for documentationalias of
calldef_matcher_t
-
pygccxml.declarations.
custom_matcher
¶ see
custom_matcher_t
for documentationalias of
custom_matcher_t
-
pygccxml.declarations.
declaration_matcher
¶ see
declaration_matcher_t
for documentationalias of
declaration_matcher_t
-
pygccxml.declarations.
namespace_matcher
¶ see
namespace_matcher_t
for documentationalias of
namespace_matcher_t
-
pygccxml.declarations.
not_matcher
¶ see
not_matcher_t
for documentationalias of
not_matcher_t
-
pygccxml.declarations.
operator_matcher
¶ see
operator_matcher_t
for documentationalias of
operator_matcher_t
-
pygccxml.declarations.
or_matcher
¶ see
or_matcher_t
for documentationalias of
or_matcher_t
-
pygccxml.declarations.
regex_matcher
¶ see
regex_matcher_t
for documentationalias of
regex_matcher_t
-
pygccxml.declarations.
sequential_container_traits
= [<pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>]¶ list, that contains all STD container traits classes
-
pygccxml.declarations.
variable_matcher
¶ see
variable_matcher_t
for documentationalias of
variable_matcher_t
-
pygccxml.declarations.
virtuality_type_matcher
¶ see
virtuality_type_matcher_t
for documentationalias 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
ordecl_visitor_t
) – instance
-
class
pygccxml.declarations.algorithm.
match_declaration_t
(type=None, decl_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 type, for example
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 instanceReturn type: bool
-
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
¶
-
cmp_data
¶ Data used for comparison between declarations.
-
container_element_type
¶
-
container_key_type
¶
-
declaration_path
¶
-
demangled_name
¶
-
disable
()¶
-
enable
()¶
-
enabled
¶
-
full_name
¶
-
full_partial_name
¶
-
normalized_full_name_false
¶
-
normalized_full_name_true
¶
-
normalized_name
¶
-
normalized_partial_name
¶
-
partial_declaration_path
¶
-
reset
()¶
-
reset_access_type
()¶
-
reset_name_based
()¶
-
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.
argument_t
(name='', type=None, decl_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), decl_type=keywd.get(‘decl_type’, self.decl_type), default_value=keywd.get(‘default_value’, self.default_value), attributes=keywd.get(‘attributes’, self.attributes ))
-
decl_type
¶
-
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
¶ Deprecated since v1.8.0. Will be removed in v1.9.0
-
-
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
-
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
- decl – reference to a
-
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
-
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 classReturn 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
¶
-
-
class
pygccxml.declarations.class_declaration.
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
-
-
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
-
declaration_path
¶
-
declaration_path_hash
¶
-
is_virtual
¶ indicates whether the inheritance is virtual or not
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>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>, <pygccxml.declarations.container_traits.container_traits_impl_t object>)¶ 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)¶ Find the container traits type of a declaration.
Parameters: cls_or_string (str | declarations.declaration_t) – a string Returns: a container traits Return type: declarations.container_traits
cpptypes¶
defines classes, that describe C++ types
-
pygccxml.declarations.cpptypes.
FUNDAMENTAL_TYPES
= {'short unsigned int': <pygccxml.declarations.cpptypes.short_unsigned_int_t object>, 'jdouble': <pygccxml.declarations.cpptypes.jdouble_t object>, '__java_float': <pygccxml.declarations.cpptypes.jfloat_t object>, 'int': <pygccxml.declarations.cpptypes.int_t object>, 'void': <pygccxml.declarations.cpptypes.void_t object>, 'float': <pygccxml.declarations.cpptypes.float_t object>, 'jlong': <pygccxml.declarations.cpptypes.jlong_t object>, 'long unsigned int': <pygccxml.declarations.cpptypes.long_unsigned_int_t object>, 'complex double': <pygccxml.declarations.cpptypes.complex_double_t object>, 'char': <pygccxml.declarations.cpptypes.char_t object>, '__java_long': <pygccxml.declarations.cpptypes.jlong_t object>, '__java_int': <pygccxml.declarations.cpptypes.jint_t object>, 'long int': <pygccxml.declarations.cpptypes.long_int_t object>, 'signed int': <pygccxml.declarations.cpptypes.int_t object>, 'jfloat': <pygccxml.declarations.cpptypes.jfloat_t object>, '__int128_t': <pygccxml.declarations.cpptypes.int128_t object>, 'long long int': <pygccxml.declarations.cpptypes.long_long_int_t object>, 'unsigned int': <pygccxml.declarations.cpptypes.unsigned_int_t object>, '__java_byte': <pygccxml.declarations.cpptypes.jbyte_t object>, 'long long unsigned int': <pygccxml.declarations.cpptypes.long_long_unsigned_int_t object>, 'jchar': <pygccxml.declarations.cpptypes.jchar_t object>, 'short int': <pygccxml.declarations.cpptypes.short_int_t object>, 'signed short int': <pygccxml.declarations.cpptypes.short_int_t object>, 'long double': <pygccxml.declarations.cpptypes.long_double_t object>, 'double': <pygccxml.declarations.cpptypes.double_t object>, 'complex long double': <pygccxml.declarations.cpptypes.complex_long_double_t object>, '__java_short': <pygccxml.declarations.cpptypes.jshort_t object>, 'jshort': <pygccxml.declarations.cpptypes.jshort_t object>, '__java_boolean': <pygccxml.declarations.cpptypes.jboolean_t object>, 'jint': <pygccxml.declarations.cpptypes.jint_t object>, '__java_char': <pygccxml.declarations.cpptypes.jchar_t object>, 'bool': <pygccxml.declarations.cpptypes.bool_t object>, 'wchar_t': <pygccxml.declarations.cpptypes.wchar_t object>, 'signed char': <pygccxml.declarations.cpptypes.signed_char_t object>, '__java_double': <pygccxml.declarations.cpptypes.jdouble_t object>, 'jbyte': <pygccxml.declarations.cpptypes.jbyte_t object>, 'jboolean': <pygccxml.declarations.cpptypes.jboolean_t object>, '__uint128_t': <pygccxml.declarations.cpptypes.uint128_t object>, 'unsigned char': <pygccxml.declarations.cpptypes.unsigned_char_t object>, 'complex float': <pygccxml.declarations.cpptypes.complex_float_t object>}¶ 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
-
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
anddeclaration_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:
-
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)¶
-
-
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.
-
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¶
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¶
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.
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.
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.
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.
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.
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.
-
pygccxml.declarations.namespace.
get_global_namespace
(decls)¶ Get the global namespace (::) from a declaration tree.
Parameters: decls (list[declaration_t]) – a list of declarations Returns: the global namespace_t object (::) Return type: namespace_t
-
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.
Returns: List[declarations.declaration_t]
-
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)¶ Deprecated method. Use the namespace() method instead.
Deprecated since v1.8.0. Will be removed in v1.9.0
-
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
-
pygccxml.declarations.scopedef.
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 declarationReturn type: set(declaration file names)
-
pygccxml.declarations.scopedef.
find_all_declarations
(declarations, type=None, decl_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.scopedef.
find_declaration
(declarations, type=None, decl_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.scopedef.
find_first_declaration
(declarations, type=None, decl_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.scopedef.
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 declarationReturn type: [ all internal declarations ]
-
class
pygccxml.declarations.scopedef.
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
-
exception
-
class
pygccxml.declarations.scopedef.
scopedef_t
(name='')¶ Bases:
pygccxml.declarations.declaration.declaration_t
Base class for
namespace_t
andclass_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 seethe 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.
Returns: List[declarations.declaration_t]
-
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:
- 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 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)¶ Deprecated since v1.8.0. Will be removed in v1.9.0
-
scopedef_t.
variable
(name=None, function=None, type=None, decl_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, decl_type=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)¶
-
scopedef_t.
vars
(name=None, function=None, type=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)¶ Deprecated since v1.8.0. Will be removed in v1.9.0
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.
normalize_full_name_false
(decl)¶ Cached variant of normalize
Parameters: decl (declaration.declaration_t) – the declaration Returns: normalized name Return type: str
-
pygccxml.declarations.templates.
normalize_full_name_true
(decl)¶ Cached variant of normalize
Parameters: decl (declaration.declaration_t) – the declaration Returns: normalized name Return type: str
-
pygccxml.declarations.templates.
normalize_name
(decl)¶ Cached variant of normalize
Parameters: decl (declaration.declaration_t) – the declaration Returns: normalized name Return type: str
-
pygccxml.declarations.templates.
normalize_partial_name
(decl)¶ Cached variant of normalize
Parameters: decl (declaration.declaration_t) – the declaration Returns: normalized name Return type: str
-
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, decl_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
-
decl_type
¶ reference to the original
decl_type
-
i_depend_on_them
(recursive=True)¶
-
type
¶ Deprecated since v1.8.0. Will be removed in v1.9.0
-
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
-
pygccxml.declarations.type_traits.
base_type
(type_)¶ returns base type.
For const int will return int
-
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.
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_bool
(type_)¶ Check if type is of boolean type.
Parameters: type (type_t) – The type to be checked Returns: True if type is a boolean, False otherwise. Return type: bool
-
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_const
(type_)¶ returns True, if type represents C++ const type, False otherwise
-
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_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_)¶ Check if type is a C++ integral type
Parameters: type (type_t) – The type to be checked Returns: True if type is a C++ integral type, False otherwise. Return type: bool
-
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_void
(type_)¶ Check if type is of void type.
Parameters: type (type_t) – The type to be checked Returns: True if type is void, False otherwise. Return type: bool
-
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
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, decl_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.
-
decl_type
¶ reference to the variable
decl_type
-
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
¶ Deprecated since v1.8.0. Will be removed in v1.9.0
-
type_qualifiers
¶ reference to the
type_qualifiers_t
instance
-
value
¶ string, that contains the variable value
-