pygccxml.declarations.type_traits_classes module

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

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

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

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

class declaration_xxx_traits(declaration_class)

Bases: object

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

Implemented functionality:
  • find out whether a declaration is a desired one

  • get reference to the declaration

get_declaration(type_)

returns reference to the declaration

Precondition: self.is_my_case( type ) == True

is_my_case(type_)

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

enum_declaration(type_)

returns reference to enum declaration

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

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

find_copy_constructor(type_)

Returns reference to copy constructor.

Parameters

type (declarations.class_t) – the class to be searched.

Returns

the copy constructor

Return type

declarations.constructor_t

find_noncopyable_vars(class_type, already_visited_cls_vars=None)

Returns list of all noncopyable variables.

If an already_visited_cls_vars list is provided as argument, the returned list will not contain these variables. This list will be extended with whatever variables pointing to classes have been found.

Parameters
  • class_type (declarations.class_t) – the class to be searched.

  • already_visited_cls_vars (list) – optional list of vars that should not be checked a second time, to prevent infinite recursions.

Returns

list of all noncopyable variables.

Return type

list

find_trivial_constructor(type_)

Returns reference to trivial constructor.

Parameters

type (declarations.class_t) – the class to be searched.

Returns

the trivial constructor

Return type

declarations.constructor_t

has_any_non_copyconstructor(decl_type)

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

has_copy_constructor(class_)

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

has_destructor(class_)

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

has_public_assign(class_)

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

has_public_constructor(class_)

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

has_public_destructor(decl_type)

returns True, if class has public destructor, False otherwise

has_trivial_constructor(class_)

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

has_vtable(decl_type)

True, if class has virtual table, False otherwise

is_base_and_derived(based, derived)

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

is_binary_operator(oper)

returns True, if operator is binary operator, otherwise False

is_class(type_)

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

is_class_declaration(type_)

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

is_convertible(source, target)

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

is_copy_constructor(constructor)

Check if the declaration is a copy constructor,

Parameters

constructor (declarations.constructor_t) – the constructor to be checked.

Returns

True if this is a copy constructor, False instead.

Return type

bool

is_enum(type_)

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

is_noncopyable(class_, already_visited_cls_vars=None)

Checks if class is non copyable

Parameters
  • class (declarations.class_t) – the class to be checked

  • already_visited_cls_vars (list) – optional list of vars that should not be checked a second time, to prevent infinite recursions. In general you can ignore this argument, it is mainly used during recursive calls of is_noncopyable() done by pygccxml.

Returns

if the class is non copyable

Return type

bool

is_struct(declaration)

Returns True if declaration represents a C++ struct

Parameters

declaration (declaration_t) – the declaration to be checked.

Returns

True if declaration represents a C++ struct

Return type

bool

is_trivial_constructor(constructor)

Check if the declaration is a trivial constructor.

Parameters

constructor (declarations.constructor_t) – the constructor to be checked.

Returns

True if this is a trivial constructor, False instead.

Return type

bool

is_unary_operator(oper)

returns True, if operator is unary operator, otherwise False

is_union(declaration)

Returns True if declaration represents a C++ union

Parameters

declaration (declaration_t) – the declaration to be checked.

Returns

True if declaration represents a C++ union

Return type

bool