Package pygccxml :: Package declarations :: Module container_traits :: Class container_traits_impl_t

# ClassType container_traits_impl_t

source code

this class implements the functionality needed for convinient 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 parsers the class name in order to extract all the information.

Instance Methods

__init__(self, container_name, element_type_index, element_type_typedef, defaults_remover, key_type_index=None, key_type_typedef=None) container_name - std container name... | source code

name(self) | source code

get_container_or_none(self, type) returns reference to the class declaration or None | source code

is_my_case(self, type) checks, whether type is STD container or not | source code

class_declaration(self, type) returns reference to the class declaration | source code

is_sequence(self, type) | source code

is_mapping(self, type) | source code

element_type(self, type) returns reference to the class value\mapped type declaration | source code

key_type(self, type) returns reference to the class key type declaration | source code

remove_defaults(self, type_or_string) remove template defaults from a template class instantiation | source code

Method Details

### __init__(self, container_name, element_type_index, element_type_typedef, defaults_remover, key_type_index=None, key_type_typedef=None)
(Constructor)

source code

    container_name - std container name
    element_type_index - position of value\mapped type within template
      arguments list
    element_type_typedef - class typedef to the value\mapped type
    key_type_index - position of key type within template arguments list
    key_type_typedef - class typedef to the key type

### remove_defaults(self, type_or_string)

source code

    remove template defaults from a template class instantiation

    For example:
        std::vector< int, std::allocator< int > >
    will become
        std::vector< int >