enum: wrap enumrations

Wraps enumerations

class pybindgen.enum.Enum(name, values, values_prefix='', cpp_namespace=None, outer_class=None, import_from_module=None)

Bases: object

Class that adds support for a C/C++ enum type

Creates a new enum wrapper, which should be added to a module with module.add_enum().

  • name – C name of the enum type
  • values – a list of strings with all enumeration value names, or list of (name, C-value-expr) tuples.
  • values_prefix – prefix to add to value names, or None
  • cpp_namespace – optional C++ namespace identifier, or None. Note: this namespace is in addition to whatever namespace of the module the enum belongs to. Typically this parameter is to be used when wrapping enums declared inside C++ classes.
  • import_from_module – if not None, the enum is defined in another module, this parameter gives the name of the module
generate_declaration(sink, module)

Get the Module object this class belongs to


Get the Module object this class belongs to


Set the Module object this class belongs to; can only be set once