pygccxml.declarations.enumeration module

defines class, that describes C++ enum

class enumeration_t(name='', values=None)

Bases: pygccxml.declarations.declaration.declaration_t, pygccxml.declarations.byte_info.byte_info, pygccxml.declarations.elaborated_info.elaborated_info

describes C++ enum

append_value(valuename, valuenum=None)

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.
attributes

GCCXML attributes, set using __attribute__((gccxml(“…”)))

@type: str

byte_align

Alignment of this declaration/type in bytes

Returns:Alignment of this declaration/type in bytes
Return type:int
byte_size

Size of this declaration/type in bytes

Returns:Size of this declaration/type in bytes
Return type:int
cache

Implementation detail.

Reference to instance of algorithms_cache_t class.

create_decl_string(with_defaults=True)
decl_string

Declaration full name.

elaborated_type_specifier

Elaborated specifier (can be – struct, union, class or enum).

Returns:elaborated specifier
Return type:str
get_mangled_name()
get_name2value_dict()

returns a dictionary, that maps between enum name( key ) and enum value( value )

has_value_name(name)

Check if this enum has a particular name among its values.

Parameters:name (str) – Enumeration value name
Return type:True if there is an enumeration value with the given name
i_depend_on_them(recursive=True)

Return list of all types and declarations the declaration depends on

is_artificial

Describes whether declaration is compiler generated or not

@type: bool

location

Location of the declaration within source file

@type: location_t

mangled

Unique declaration name generated by the compiler.

For GCCXML, you can get the mangled name for all the declarations. When using CastXML, calling mangled is only allowed on functions and variables. For other declarations it will raise an exception.

Returns:the mangled name
Return type:str
name

Declaration name @type: str

parent

Reference to parent declaration.

@type: declaration_t

partial_decl_string

Declaration full name.

partial_name

Declaration name, without template default arguments.

Right now std containers is the only classes that support this functionality.

top_parent

Reference to top parent declaration.

@type: declaration_t

values

A list of tuples (valname(str), valnum(int)) that contain the enumeration values. @type: list