2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-22 17:32:55 +00:00

enum export

[SVN r16604]
This commit is contained in:
Dave Abrahams
2002-12-13 20:04:34 +00:00
parent eab084c9a2
commit 4a5817d8ba
7 changed files with 39 additions and 1 deletions

View File

@@ -23,6 +23,9 @@ struct enum_ : public objects::enum_base
// Add a new enumeration value with the given name and value.
inline enum_<T>& value(char const* name, T);
// Add all of the defined enumeration values to the current scope with the
// same names used here.
inline enum_<T>& export_values();
private:
static PyObject* to_python(void const* x);
static void* convertible_from_python(PyObject* obj);
@@ -86,6 +89,13 @@ inline enum_<T>& enum_<T>::value(char const* name, T x)
return *this;
}
template <class T>
inline enum_<T>& enum_<T>::export_values()
{
this->enum_base::export_values();
return *this;
}
}} // namespace boost::python
#endif // ENUM_DWA200298_HPP

View File

@@ -25,6 +25,7 @@ struct BOOST_PYTHON_DECL enum_base : python::api::object
, type_info);
void add_value(char const* name, long value);
void export_values();
static PyObject* to_python(PyTypeObject* type, long x);
};