I am trying to wrap an enum class in a c++ header file for use in a cython project.I have googled around and can not find out how to achieve this - is it supported?
enum class Color {red, green = 20, blue};
cdef extern from "colors.h":
cdef cppclass Color:
pass
cdef extern from "colors.h" namespace "Color":
cdef Color red
cdef Color green
cdef Color blue
cdef class PyColor:
cdef Color thisobj
def __cinit__(self, int val):
self.thisobj = val
def get_color_type(self):
cdef c = {red : "red", green : "green", blue : "blue"}
return c[self.thisobj]