xo-pyreflect: bind Metatype; + TypeDescr.metatype
This commit is contained in:
parent
e57ba44ae7
commit
bd8c2c4e13
1 changed files with 13 additions and 0 deletions
|
|
@ -22,6 +22,17 @@ namespace xo {
|
|||
namespace reflect {
|
||||
PYBIND11_MODULE(PYREFLECT_MODULE_NAME(), m) {
|
||||
|
||||
m.doc() = "pybind11 plugin for xo-reflect";
|
||||
|
||||
py::enum_<Metatype>(m, "Metatype")
|
||||
.value("invalid", Metatype::mt_invalid)
|
||||
.value("atomic", Metatype::mt_atomic)
|
||||
.value("pointer", Metatype::mt_pointer)
|
||||
.value("vector", Metatype::mt_vector)
|
||||
.value("struct", Metatype::mt_struct)
|
||||
.value("function", Metatype::mt_function)
|
||||
;
|
||||
|
||||
/* note: possibly move this to pytime/ if/when we provide it */
|
||||
//py::class_<utc_nanos>(m, "utc_nanos");
|
||||
|
||||
|
|
@ -32,8 +43,10 @@ namespace xo {
|
|||
.def_static("lookup_by_name", &TypeDescrBase::lookup_by_name)
|
||||
.def_static("print_reflected_types",
|
||||
[](){ TypeDescrBase::print_reflected_types(std::cout); })
|
||||
|
||||
.def_property_readonly("canonical_name", &TypeDescrBase::canonical_name)
|
||||
.def_property_readonly("short_name", &TypeDescrBase::short_name)
|
||||
.def_property_readonly("metatype", &TypeDescrBase::metatype)
|
||||
.def_property_readonly("complete_flag", &TypeDescrBase::complete_flag)
|
||||
.def("__repr__", &TypeDescrBase::display_string);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue