|
Library of Assembled Shared Sources
|
Base class of all enum definitions. More...
#include <enum_definition.h>

Public Member Functions | |
| const char * | name () const |
| The name of the Python enum type. | |
| const char * | doc () const |
| Optional docstring for the Python enum type. | |
| PyObject * | type () const |
| The Python enum type object, after freezeDefinition() has been called. | |
| PyObject * | freezeDefinition (const char *moduleName, const char *scopeName) |
| Freeze the enum definition and create the Python enum type. | |
Protected Member Functions | |
| EnumDefinitionBase (const char *name) | |
| Construct enum definition with name only. | |
| EnumDefinitionBase (const char *name, const char *doc) | |
| Construct enum definition with name and documentation. | |
| TPyObjPtr | valueObject (PyObject *obj) const |
| Returns the value of an enum instances as a Python object. | |
Base class of all enum definitions.
If you define your own custom enum definition, you must derive from this class so that you can add your enum to a module or class with PY_MODULE_ENUM() or PY_CLASS_ENUM().
This class is typically not used directly by user code. Use the provided IntEnumDefinition, StrEnumDefinition, IntFlagDefinition, or EnumDefinition template classes instead.
Definition at line 219 of file enum_definition.h.
|
protected |
Construct enum definition with name only.
| name | Python class name for the enum type (must have static storage duration) |
Definition at line 200 of file enum_definition.cpp.
References name().
Referenced by lass::python::EnumDefinition< EnumType, ValueType >::EnumDefinition(), lass::python::EnumDefinition< EnumType, ValueType >::EnumDefinition(), lass::python::EnumDefinition< EnumType, ValueType >::EnumDefinition(), lass::python::EnumDefinition< EnumType, ValueType >::EnumDefinition(), lass::python::IntEnumDefinition< EnumType >::IntEnumDefinition(), lass::python::IntEnumDefinition< EnumType >::IntEnumDefinition(), lass::python::IntEnumDefinition< EnumType >::IntEnumDefinition(), and lass::python::IntEnumDefinition< EnumType >::IntEnumDefinition().
|
protected |
Construct enum definition with name and documentation.
| name | Python class name for the enum type (must have static storage duration) |
| doc | Optional docstring for the Python enum type (must have static storage duration, or nullptr) |
Definition at line 205 of file enum_definition.cpp.
| PyObject * lass::python::EnumDefinitionBase::freezeDefinition | ( | const char * | moduleName, |
| const char * | scopeName ) |
Freeze the enum definition and create the Python enum type.
PY_MODULE_ENUM() or PY_CLASS_ENUM() to add the enum to a module or class, which will call this method at the appropriate time. Definition at line 247 of file enum_definition.cpp.
|
protected |
Returns the value of an enum instances as a Python object.
If the object is not an instance of this enum type, a Python exception will be set and a null pointer will be returned.
Definition at line 230 of file enum_definition.cpp.
Referenced by lass::python::EnumDefinition< EnumType, ValueType >::get(), and lass::python::IntEnumDefinition< EnumType >::get().