mirror of
https://github.com/boostorg/python.git
synced 2026-01-24 18:12:43 +00:00
Use qualname for enum repr
This commit is contained in:
committed by
Stefan Seefeld
parent
a498e2458c
commit
c4e3b13dc2
@@ -5,6 +5,7 @@
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/enum.hpp>
|
||||
#include <boost/python/operators.hpp>
|
||||
#include <boost/python/scope.hpp>
|
||||
#include "test_class.hpp"
|
||||
@@ -17,6 +18,8 @@
|
||||
typedef test_class<> X;
|
||||
typedef test_class<1> Y;
|
||||
|
||||
enum color { red = 0, blue = 1, green = 2 };
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, X const& x)
|
||||
{
|
||||
return s << x.value();
|
||||
@@ -45,6 +48,13 @@ BOOST_PYTHON_MODULE(nested_ext)
|
||||
class_<Y>("Y", init<int>())
|
||||
.def(str(self))
|
||||
;
|
||||
|
||||
// so will the enum `color`
|
||||
enum_<color>("color")
|
||||
.value("red", red)
|
||||
.value("green", green)
|
||||
.value("blue", blue)
|
||||
;
|
||||
}
|
||||
|
||||
// The generated docstring will use the fully-qualified name of Y
|
||||
|
||||
Reference in New Issue
Block a user