diff --git a/doc/v2/has_back_reference.html b/doc/v2/has_back_reference.html index ed8b0342..7e3a8609 100644 --- a/doc/v2/has_back_reference.html +++ b/doc/v2/has_back_reference.html @@ -13,7 +13,7 @@ p.c3 {font-style: italic} h2.c2 {text-align: center} h1.c1 {text-align: center} - + @@ -97,8 +97,8 @@ namespace boost { namespace python
Specializations may substitute a value convertible to true for value iff for each invocation of - class_<WrappedClass>::def_init(args<type-sequence... - >()), there exists a corresponding constructor + class_<WrappedClass>::def(init<type-sequence... + >()), there exists a corresponding constructor WrappedClass::WrappedClass(PyObject*, type-sequence... ). If such a specialization exists, the WrappedClass constructors will be called with a "back diff --git a/doc/v2/manage_new_object.html b/doc/v2/manage_new_object.html index 3efec0eb..f6b6168d 100644 --- a/doc/v2/manage_new_object.html +++ b/doc/v2/manage_new_object.html @@ -116,7 +116,7 @@ using namespace boost::python; BOOST_PYTHON_MODULE_INIT(my_module) { def("make_foo", make_foo, return_value_policy<manage_new_object>()) - class_<Foo>() + class_<Foo>("Foo") .def("get_x", &Foo::get_x) ; } diff --git a/doc/v2/reference_existing_object.html b/doc/v2/reference_existing_object.html index 59a47216..624bfc08 100644 --- a/doc/v2/reference_existing_object.html +++ b/doc/v2/reference_existing_object.html @@ -144,7 +144,7 @@ using namespace boost::python; BOOST_PYTHON_MODULE_INIT(singleton) { def("get_it", get_it, reference_existing_object()); - class_<Singleton>() + class_<Singleton>("Singleton") .def("exchange", &Singleton::exchange) ; } diff --git a/doc/v2/return_internal_reference.html b/doc/v2/return_internal_reference.html index 596ed2c6..f2b032a8 100644 --- a/doc/v2/return_internal_reference.html +++ b/doc/v2/return_internal_reference.html @@ -186,13 +186,12 @@ class Foo using namespace boost::python; BOOST_PYTHON_MODULE_INIT(internal_refs) { - class_<Bar>() + class_<Bar>("Bar") .def("get_x", &Bar::get_x) .def("set_x", &Bar::set_x) ; - class_<Foo>() - .def_init(args<int>()) + class_<Foo>("Foo", init<int>()) .def("get_bar", &Foo::get_bar , return_internal_reference<>()) ; diff --git a/doc/v2/return_value_policy.html b/doc/v2/return_value_policy.html index 88a72a0c..8f5d779d 100644 --- a/doc/v2/return_value_policy.html +++ b/doc/v2/return_value_policy.html @@ -1,89 +1,106 @@ - + + + + - Boost.Python - <boost/python/return_value_policy.hpp> + Boost.Python - + <boost/python/return_value_policy.hpp> + + +
-

-

+

C++ Boost

+

Boost.Python

-

Header <boost/python/return_value_policy.hpp>

+

Header + <boost/python/return_value_policy.hpp>

+

Contents

-
Introduction +
Introduction
- -
Classes +
Classes
-
Class Template return_value_policy +
Class Template + return_value_policy
-
Class Template - return_value_policy synopsis + return_value_policy synopsis
+
+
- -
Example +
Example

Introduction

- - return_value_policy instantiations are simply models - of CallPolicies which are composed of a ResultConverterGenerator and optional Base CallPolicies. + return_value_policy instantiations are simply models of CallPolicies which are composed of a ResultConverterGenerator + and optional Base CallPolicies.

Classes

-

Class template return_value_policy

- +

Class template + return_value_policy

- - - + + + + + + + + + - - + +
return_value_policy template parameters
Parameter - - Requirements - - Default
ResultConverterGenerator + ParameterRequirementsDefault
ResultConverterGenerator A model of ResultConverterGenerator. + "ResultConverterGenerator.html">ResultConverterGenerator.
Base + BaseA model of CallPolicies - - default_call_policies + A model of CallPoliciesdefault_call_policies
-

Class template return_value_policy synopsis

+

Class template + return_value_policy synopsis

 namespace boost { namespace python
 {
@@ -97,9 +114,9 @@ namespace boost { namespace python
 
     

Example

-

C++ Module Definition

+

C++ Module Definition

-#include <boost/python/module.hpp>
+#include <boost/python/module_init.hpp>
 #include <boost/python/class.hpp>
 #include <boost/python/copy_const_reference.hpp>
 #include <boost/python/return_value_policy.hpp>
@@ -118,20 +135,16 @@ struct Foo {
 using namespace boost::python;
 BOOST_PYTHON_MODULE_INIT(my_module)
 {
-   module("my_module")
-      .add(
-         class_<Bar>()
-         )
-      .add(
-         class_<Foo>()
-            .def_init(args<int>())
-            .def("get_bar", &Foo::get_bar
-                , return_value_policy<copy_const_reference>())
-         )
-       ;
+   class_<Bar>("Bar");
+
+   class_<Foo>("Foo", init<int>())
+      .def("get_bar", &Foo::get_bar
+          , return_value_policy<copy_const_reference>())
+      ;
 }
 
-

Python Code

+ +

Python Code

 >>> from my_module import *
 >>> f = Foo(3)         # create a Foo object
@@ -140,9 +153,13 @@ BOOST_PYTHON_MODULE_INIT(my_module)
 
     

Revised - 15 February, 2002 + 15 February, 2002 +

-

© Copyright Dave - Abrahams 2002. All Rights Reserved. +

© Copyright Dave Abrahams 2002. All Rights + Reserved.

+ + diff --git a/doc/v2/to_python_converter.html b/doc/v2/to_python_converter.html index a2a985d8..f6682242 100644 --- a/doc/v2/to_python_converter.html +++ b/doc/v2/to_python_converter.html @@ -1,96 +1,114 @@ - + + + + - Boost.Python - <boost/python/to_python_converter.hpp> + Boost.Python - + <boost/python/to_python_converter.hpp> + + +
-

-

+

C++ Boost

+

Boost.Python

-

Header <boost/python/to_python_converter.hpp>

+

Header + <boost/python/to_python_converter.hpp>

+

Contents

-
Introduction +
Introduction
- -
Classes +
Classes
-
Class Template to_python_converter +
Class Template + to_python_converter
-
Class Template - to_python_converter synopsis + to_python_converter synopsis
Class Template - to_python_converter constructor + to_python_converter constructor
+
+
-
Example +
Example

Introduction

- - to_python_converter registers a conversion from - objects of a given C++ type into a Python object. + to_python_converter registers a conversion from objects of a + given C++ type into a Python object.

Classes

-

Class template to_python_converter

- - to_python_converter adds a wrapper around a static - member function of its second template parameter, handling - low-level details such as insertion into the converter registry. +

Class template + to_python_converter

+ to_python_converter adds a wrapper around a static member + function of its second template parameter, handling low-level details + such as insertion into the converter registry. - - - + + + + + + + + - + - - - + +
to_python_converter template parameters
-In the table below, x denotes an object of type T + In the table below, x denotes an object of type + T
Parameter - - Requirements - - Description
T + ParameterRequirementsDescription
T + The C++ type of the source object in the conversion + The C++ type of the source object in the conversion
Conversion + ConversionPyObject* p = Conversion::convert(x),
- if p == 0, PyErr_Occurred() != 0. +
+ PyObject* p = Conversion::convert(x),
+ if p == 0, PyErr_Occurred() != 0.
A class type whose static member function - convert does the real work of the conversion. - -
A class type whose static member function convert + does the real work of the conversion.
-

Class template to_python_converter synopsis

+

Class template + to_python_converter synopsis

 namespace boost { namespace python
 {
@@ -102,34 +120,31 @@ namespace boost { namespace python
 }}
 
-

Class template to_python_converter constructor

+

Class template + to_python_converter constructor

 to_python_converter();
 
-
Effects: Registers a to_python converter which uses - Conversion::convert() to do its work. - + Conversion::convert() to do its work.

Example

+ This example presumes that someone has implemented the standard noddy example + module from the Python documentation, and placed the corresponding + declarations in "noddy.h". Because + noddy_NoddyObject is the ultimate trivial extension type, + the example is a bit contrived: it wraps a function for which all + information is contained in the type of its return value. -This example presumes that someone has implemented the standard noddy example -module from the Python documentation, and placed the corresponding -declarations in "noddy.h". Because -noddy_NoddyObject is the ultimate trivial extension type, -the example is a bit contrived: it wraps a function for which all -information is contained in the type of its return value. - -

C++ module definition

- +

C++ module definition

 #include <boost/python/reference.hpp>
-#include <boost/python/module.hpp>
-#include "noddy.h"
+#include <boost/python/module_init.hpp>
+#include "noddy.h"
 
 struct tag {};
 tag make_tag() { return tag(); }
@@ -146,15 +161,12 @@ struct tag_to_noddy
 
 BOOST_PYTHON_MODULE_INIT(to_python_converter)
 {
-    module("to_python_converter")
-        .def("make_tag", make_tag)
-        ;
+    def("make_tag", make_tag);
     to_python_converter<tag, tag_to_noddy>();
 }
 
-

Python code

- +

Python code

 >>> import to_python_converter
 >>> def always_none():
@@ -180,10 +192,13 @@ BOOST_PYTHON_MODULE_INIT(to_python_converter)
 
     

Revised - 05 November, 2001 + 29 September, 2002 +

- -

© Copyright Dave - Abrahams 2002. All Rights Reserved. +

© Copyright Dave Abrahams 2002. All Rights + Reserved.

+ +