Shiboken::Enum Namespace

namespace Shiboken::Enum

Namespace for enum-related functionality. More...

Header: #include <sbkenum.h>

Functions

PyTypeObject *createPythonEnum(PyObject *module, const char *fullName, const char *[] enumItemStrings, const int64_t[] enumValues)
PyTypeObject *createPythonEnum(PyTypeObject *scope, const char *fullName, const char *[] enumItemStrings, const IntT[] enumValues)
PyTypeObject *createPythonEnum(const char *fullName, PyObject *pyEnumItems, const char *enumTypeName = "Enum", PyObject *callDict = nullptr)
void setTypeConverter(PyTypeObject *type, SbkConverter *converter, SbkConverter *flagsConverter = nullptr)

Detailed Description

Function Documentation

PyTypeObject *Enum::createPythonEnum(PyObject *module, const char *fullName, const char *[] enumItemStrings, const int64_t[] enumValues)

Creates a Python enum named fullName in module from the item names enumItemStrings and the values enumValues.

template <typename IntT> PyTypeObject *Enum::createPythonEnum(PyTypeObject *scope, const char *fullName, const char *[] enumItemStrings, const IntT[] enumValues)

Creates a Python enum named fullName in scope from the item names enumItemStrings and the values enumValues.

This template removes duplication by inlining necessary type casts.

PyTypeObject *Enum::createPythonEnum(const char *fullName, PyObject *pyEnumItems, const char *enumTypeName = "Enum", PyObject *callDict = nullptr)

Creates a Python enum type from a set of provided key/value pairs.

ParameterMeaning
fullNameThe full name (including module and package depth) to be used for the newly created enum type.
pyEnumItemsThe key/value pairs to be used for the enum.
enumTypeNameThe name of the enum type to be used (i.e., "IntEnum", "Flag", etc) from Python's enum module.
callDictThe dictionary to be used for the call, allowing for additional keyword arguments to be passed, such as "boundary=KEEP".

void Enum::setTypeConverter(PyTypeObject *type, SbkConverter *converter, SbkConverter *flagsConverter = nullptr)

Sets the type converter of the enum/flag type to converter and flagsConverter.