pygccxml.declarations.type_traits module

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 ?

array_item_type(type_)

returns array item type

array_size(type_)

returns array size

base_type(type_)

returns base type.

For const int will return int

decompose_class(type_)

implementation details

decompose_type(tp)

Implementation detail

does_match_definition(given, main, secondary)

implementation details

is_arithmetic(type_)

returns True, if type represents C++ integral or floating point type, False otherwise

is_array(type_)

returns True, if type represents C++ array type, False otherwise

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
is_calldef_pointer(type_)

returns True, if type represents pointer to free/member function, False otherwise

is_const(type_)

returns True, if type represents C++ const type, False otherwise

is_elaborated(type_)

returns True, if type represents C++ elaborated type, False otherwise

is_floating_point(type_)

returns True, if type represents C++ floating point type, False otherwise

is_fundamental(type_)

returns True, if type represents C++ fundamental type

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
is_pointer(type_)

returns True, if type represents C++ pointer type, False otherwise

is_reference(type_)

returns True, if type represents C++ reference type, False otherwise

is_same(type1, type2)

returns True, if type1 and type2 are same types

is_std_ostream(type_)

Returns True, if type represents C++ std::ostream, False otherwise.

is_std_string(type_)

Returns True, if type represents C++ std::string, False otherwise.

is_std_wostream(type_)

Returns True, if type represents C++ std::wostream, False otherwise.

is_std_wstring(type_)

Returns True, if type represents C++ std::wstring, False otherwise.

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
is_void_pointer(type_)

returns True, if type represents void*, False otherwise

is_volatile(type_)

returns True, if type represents C++ volatile type, False otherwise

remove_alias(type_)

Returns type_t without typedef

Parameters:type (type_t | declaration_t) – type or declaration
Returns:the type associated to the inputted declaration
Return type:type_t
remove_const(type_)

removes const from the type definition

If type is not const type, it will be returned as is

remove_cv(type_)

removes const and volatile from the type definition

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

remove_elaborated(type_)

removes type-declaration class-binder elaborated_t from the type_

If type_ is not elaborated_t, it will be returned as is

remove_pointer(type_)

removes pointer from the type definition

If type is not pointer type, it will be returned as is.

remove_reference(type_)

removes reference from the type definition

If type is not reference type, it will be returned as is.

remove_volatile(type_)

removes volatile from the type definition

If type is not volatile type, it will be returned as is