pygccxml.declarations.container_traits module

Define a few algorithms that deal with different properties of std containers.

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

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