Package pygccxml :: Package declarations :: Module enumeration :: Class enumeration_t |

# type enumeration_t

source code

                   object --+
                            |
    declaration.declaration_t --+
                                |
                               enumeration_t

describes C++ enum

Instance Methods
__init__(self, name=`'````'`, values=None) creates class that describes C++ enum declaration | source code
__eq__(self, other) function will return true, if both declarations refers to the same object. | source code
append_value(self, valuename, valuenum=None) Append another enumeration value to the enum. | source code
has_value_name(self, name) Check if this enum has a particular name among its values. | source code
get_name2value_dict(self) returns a dictionary, that maps between enum name( key ) and enum value( value ) | source code
i_depend_on_them(self, recursive=True) return list of all types and declarations the declaration depends on | source code
Inherited from `declaration.declaration_t`: `__lt__`, `__ne__`, `__str__`, `create_decl_string`

Properties
list | values A list of tuples (valname(str), valnum(int)) that contain the enumeration values.
| byte_size Size of this class in bytes @type: int
| byte_align Alignment of this class in bytes @type: int
Inherited from `declaration.declaration_t`: `attributes`, `cache`, `compiler`, `decl_string`, `demangled`, `is_artificial`, `location`, `mangled`, `name`, `parent`, `partial_decl_string`, `partial_name`, `top_parent`

Method Details

### __init__(self, name=`'````'`, values=None) (Constructor) | source code
creates class that describes C++ enum declaration The items of the list 'values' may either be strings containing the enumeration value name or tuples (name, numvalue). Parameters: `name` (str) - Enum name `parent` (declaration_t) - Parent declaration `values` (list) - Enumeration values Overrides: declaration.declaration_t.__init__

### __eq__(self, other) (Equality operator) | source code
function will return true, if both declarations refers to the same object. This function could be implemented in terms of _get__cmp__data, but in this case it will downgrade performance. self.mangled property is not compared, because it could be chaned from one compilation time to an other. Overrides: declaration.declaration_t.__eq__ (inherited documentation)

### append_value(self, valuename, valuenum=None) | source code
Append another enumeration value to the enum. The numeric value may be None in which case it is automatically determined by increasing the value of the last item. When the 'values' attribute is accessed the resulting list will be in the same order as append_value() was called. Parameters: `valuename` (str) - The name of the value. `valuenum` (int) - The numeric value or None.

### has_value_name(self, name) | source code
Check if this enum has a particular name among its values. Parameters: `name` (str) - Enumeration value name Returns: True if there is an enumeration value with the given name

### i_depend_on_them(self, recursive=True) | source code
return list of all types and declarations the declaration depends on Overrides: declaration.declaration_t.i_depend_on_them (inherited documentation)

Property Details

### values A list of tuples (valname(str), valnum(int)) that contain the enumeration values. Get Method: _get_values(self) Set Method: _set_values(self, values) Type: list

### byte_size Size of this class in bytes @type: int Get Method: _get_byte_size(self) Set Method: _set_byte_size(self, new_byte_size)

### byte_align Alignment of this class in bytes @type: int Get Method: _get_byte_align(self) Set Method: _set_byte_align(self, new_byte_align)