pygccxml.declarations.class_declaration module

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 ACCESS_TYPES

Bases: object

class that defines “access” constants

ALL = ['public', 'private', 'protected']
PRIVATE = 'private'
PROTECTED = 'protected'
PUBLIC = 'public'
class CLASS_TYPES

Bases: object

class that defines “class” type constants

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

Bases: pygccxml.declarations.declaration.declaration_t

describes class declaration

aliases

List of aliases to this instance

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.

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

class class_t(name='', class_type='class', is_abstract=False)

Bases: pygccxml.declarations.scopedef.scopedef_t, pygccxml.declarations.byte_info.byte_info, pygccxml.declarations.elaborated_info.elaborated_info

describes class definition

ALLOW_EMPTY_MDECL_WRAPPER = False
RECURSIVE_DEFAULT = True
adopt_declaration(decl, access)

adds new declaration to the class

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

List of aliases to this instance

attributes

GCCXML attributes, set using __attribute__((gccxml(“…”)))

@type: str

bases

list of base classes

byte_align

Alignment of this declaration/type in bytes

Returns:Alignment of this declaration/type in bytes
Return type:int
byte_size

Size of this declaration/type in bytes

Returns:Size of this declaration/type in bytes
Return type:int
cache

Implementation detail.

Reference to instance of algorithms_cache_t class.

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

class_type

describes class type

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

create_decl_string(with_defaults=True)
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

decl_string

Declaration full name.

declarations

List of children declarations.

Returns:List[declarations.declaration_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

derived

list of derived classes

elaborated_type_specifier

Elaborated specifier (can be – struct, union, class or enum).

Returns:elaborated specifier
Return type:str
enumeration(name=None, function=None, header_dir=None, header_file=None, recursive=None)

returns reference to enumeration declaration, that is matched defined criteria

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

find_out_member_access_type(member)

returns member access type

Parameters:member (declaration_t) – member of the class
Return type::class:ACCESS_TYPES
get_mangled_name()
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 ]
i_depend_on_them(recursive=True)

Return list of all types and declarations the declaration depends on

init_optimizer()

Initializes query optimizer state.

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

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

is_abstract

describes whether class abstract or not

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
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

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

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

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

name

Declaration name @type: str

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

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

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.

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

top_parent

Reference to top parent declaration.

@type: declaration_t

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

returns reference to typedef declaration, that is matched defined criteria

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

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

returns reference to variable declaration, that is matched defined criteria

variables(name=None, function=None, decl_type=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)

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

get_partial_name(name)
class 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

related_class

reference to base or derived class