MCPcopy Create free account
hub / github.com/pybind/pybind11 / native_enum

Method native_enum

include/pybind11/native_enum.h:25–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23 using Underlying = typename std::underlying_type<EnumType>::type;
24
25 native_enum(handle parent_scope,
26 const char *name,
27 const char *native_type_name,
28 const char *class_doc = "")
29 : detail::native_enum_data(
30 parent_scope, name, native_type_name, class_doc, make_record()) {
31 if (detail::get_local_type_info(typeid(EnumType)) != nullptr
32 || detail::get_global_type_info(typeid(EnumType)) != nullptr) {
33 pybind11_fail(
34 "pybind11::native_enum<...>(\"" + enum_name_encoded
35 + "\") is already registered as a `pybind11::enum_` or `pybind11::class_`!");
36 }
37 if (detail::global_internals_native_enum_type_map_contains(enum_type_index)) {
38 pybind11_fail("pybind11::native_enum<...>(\"" + enum_name_encoded
39 + "\") is already registered!");
40 }
41 arm_finalize_check();
42 }
43
44 /// Export enumeration entries into the parent scope
45 native_enum &export_values() {

Callers

nothing calls this directly

Tested by

no test coverage detected