Package pygccxml :: Package declarations :: Module algorithm

Module algorithm

source code

defines few unrelated algorithms, that works on declarations

Classes
match_declaration_t
helper class for different search algorithms.
visit_function_has_not_been_found_t
exception that is raised, from apply_visitor, when a visitor could not be applied.
Functions
 
declaration_path(decl, with_defaults=True)
returns a list of parent declarations names
source code
 
partial_declaration_path(decl)
returns a list of parent declarations names without template arguments that have default value
source code
 
get_named_parent(decl)
returns a reference to a named parent declaration
source code
 
full_name_from_declaration_path(dpath) source code
 
full_name(decl, with_defaults=True)
returns full name of the declaration
source code
 
make_flatten(decl_or_decls)
converts tree representation of declarations to flatten one.
source code
 
get_global_namespace(decls) source code
 
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
source code
 
find_declaration(declarations, type=None, name=None, parent=None, recursive=True, fullname=None)
returns single declaration that match criteria, defined by developer.
source code
 
find_first_declaration(declarations, type=None, name=None, parent=None, recursive=True, fullname=None)
returns first declaration that match criteria, defined by developer
source code
 
declaration_files(decl_or_decls)
returns set of files
source code
 
apply_visitor(visitor, decl_inst)
applies a visitor on declaration instance
source code
Function Details

declaration_path(decl, with_defaults=True)

source code 

returns a list of parent declarations names

Parameters:
  • decl (declaration_t) - declaration for which declaration path should be calculated
Returns:
[names], where first item contains top parent name and last item contains decl name

partial_declaration_path(decl)

source code 

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

Parameters:
  • decl (declaration_t) - declaration for which declaration path should be calculated
Returns:
[names], where first item contains top parent name and last item contains decl name

get_named_parent(decl)

source code 

returns a reference to a named parent declaration

Parameters:
Returns:
reference to declaration_t or None if not found

full_name(decl, with_defaults=True)

source code 

returns full name of the declaration

Parameters:
  • decl (declaration_t) - declaration for which full name should be calculated. If decl belongs to unnamed namespace, then full_name is not valid C++ full name.
Returns:
full name of declarations.

make_flatten(decl_or_decls)

source code 

converts tree representation of declarations to flatten one.

Parameters:
Returns:
[ all internal declarations ]

find_all_declarations(declarations, type=None, name=None, parent=None, recursive=True, fullname=None)

source code 

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

For more information about arguments see match_declaration_t class.

Returns:
[ matched declarations ]

find_declaration(declarations, type=None, name=None, parent=None, recursive=True, fullname=None)

source code 

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.

Returns:
matched declaration declaration_t or None

find_first_declaration(declarations, type=None, name=None, parent=None, recursive=True, fullname=None)

source code 

returns first declaration that match criteria, defined by developer

For more information about arguments see match_declaration_t class.

Returns:
matched declaration declaration_t or None

declaration_files(decl_or_decls)

source code 

returns set of files

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

Parameters:
Returns:
set( declaration file names )

apply_visitor(visitor, decl_inst)

source code 

applies a visitor on declaration instance

Parameters: