diff --git a/doc/v2/data_members.html b/doc/v2/data_members.html index 820bb1d4..5ec6ff01 100644 --- a/doc/v2/data_members.html +++ b/doc/v2/data_members.html @@ -1,109 +1,118 @@ - + + +
+|
- |
Boost.Python-Header <boost/python/data_members.hpp>+Header + <boost/python/data_members.hpp>+ |
+
make_getter() and
- make_setter() are
- the functions used internally by class_<>::make_setter() are the
+ functions used internally by class_<>::def_readonly and
class_<>::def_readwrite to
- produce Python callable objects which wrap C++ data members.
+ "class.html#class_-spec-modifiers">def_readwrite to produce
+ Python callable objects which wrap C++ data members.
template <class C, class D> -objects::function* make_getter(D C::*pm); +object make_getter(D C::*pm); template <class C, class D, class Policies> -objects::function* make_getter(D C::*pm, Policies const& policies); +object make_getter(D C::*pm, Policies const& policies);
Policies is a model of CallPolicies.
+ Policies is a model of CallPolicies.from_python to C*, and returns the
- corresponding member D member of the C
- object, converted to_python. If
- policies is supplied, it will be applied to the
- function as described here.
+ from_python to
+ C*, and returns the corresponding member D
+ member of the C object, converted to_python.
+ If policies is supplied, it will be applied to the
+ function as described here.PyObject* which
- refers to the new Python callable object.
+ template <class C, class D> -objects::function* make_setter(D C::*pm); +object make_setter(D C::*pm); template <class C, class D, class Policies> -objects::function* make_setter(D C::*pm, Policies const& policies); +object make_setter(D C::*pm, Policies const& policies);
Policies is a model of CallPolicies.
+ Policies is a model of CallPolicies.from_python to C* and
D const&, respectively, and sets the
- corresponding D member of the C
- object. If policies is supplied, it will be applied
- to the function as described here.
+ corresponding D member of the C object. If
+ policies is supplied, it will be applied to the function
+ as described here.PyObject* which refers to the new Python callable
- object.
+ The code below uses make_getter and make_setter to expose a - data member as functions: - +
The code below uses make_getter and make_setter to expose a data + member as functions:
#include <boost/python/data_members.hpp>
#include <boost/python/module.hpp>
@@ -119,14 +128,10 @@ using namespace boost::python;
BOOST_PYTHON_MODULE_INIT(data_members_example)
{
- module("data_members_example")
- .add(
- class_<X>("X")
- .def_init(args<int>())
- .def("get", make_getter(&X::y))
- .def("set", make_setter(&X::y))
- )
- ;
+ class_<X>("X", init<int>())
+ .def("get", make_getter(&X::y))
+ .def("set", make_setter(&X::y))
+ ;
}
It can be used this way in Python:
@@ -142,9 +147,13 @@ BOOST_PYTHON_MODULE_INIT(data_members_example)
- 8 May 2002 + 29 September 2002 + +
- -© Copyright Dave - Abrahams 2002. All Rights Reserved. +
© Copyright Dave Abrahams 2002. All Rights + Reserved.
+ +