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().

Parameters:
  • 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(unused_code_sink)
generate_declaration(sink, module)
get_module()

Get the Module object this class belongs to

module

Get the Module object this class belongs to

set_module(module)

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

Previous topic

function: C/C++ function wrappers

Next topic

cppclass: wrap C++ classes or C structures

This Page