@@ -17,12 +17,15 @@ struct enum_ : public objects::enum_base
1717{
1818 typedef objects::enum_base base;
1919
20+ // Declare a new enumeration type in the current scope()
2021 enum_ (char const * name);
22+
23+ // Add a new enumeration value with the given name and value.
2124 inline enum_<T>& value (char const * name, T);
2225
2326 private:
2427 static PyObject* to_python (void const * x);
25- static void * convertible (PyObject* obj);
28+ static void * convertible_from_python (PyObject* obj);
2629 static void construct (PyObject* obj, converter::rvalue_from_python_stage1_data* data);
2730};
2831
@@ -31,32 +34,42 @@ inline enum_<T>::enum_(char const* name)
3134 : base(
3235 name
3336 , &enum_<T>::to_python
34- , &enum_<T>::convertible
37+ , &enum_<T>::convertible_from_python
3538 , &enum_<T>::construct
3639 , type_id<T>())
3740{
3841}
3942
40- // This is the conversion function that gets registered for converting
43+ // This is the conversion function that gets registered for converting
44+ // these enums to Python.
4145template <class T >
4246PyObject* enum_<T>::to_python(void const * x)
4347{
4448 return base::to_python (
45- converter::registered<T>::converters.class_object
49+ converter::registered<T>::converters.m_class_object
4650 , static_cast <long >(*(T const *)x));
4751}
4852
53+ //
54+ // The following two static functions serve as the elements of an
55+ // rvalue from_python converter for the enumeration type.
56+ //
57+
58+ // This checks that a given Python object can be converted to the
59+ // enumeration type.
4960template <class T >
50- void * enum_<T>::convertible (PyObject* obj)
61+ void * enum_<T>::convertible_from_python (PyObject* obj)
5162{
5263 return PyObject_IsInstance (
5364 obj
5465 , upcast<PyObject>(
55- converter::registered<T>::converters.class_object ))
66+ converter::registered<T>::converters.m_class_object ))
5667
5768 ? obj : 0 ;
5869}
59-
70+
71+ // Constructs an instance of the enumeration type in the from_python
72+ // data.
6073template <class T >
6174void enum_<T>::construct(PyObject* obj, converter::rvalue_from_python_stage1_data* data)
6275{
0 commit comments